/**
 * inSIM Ultra-Modern Filter Interface
 * Design System: Glassmorphism + Gradient + Dark Mode Ready
 * @version 3.2.0
 */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.18);

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

/* ============================================
   MAIN CONTAINER - SPLIT LAYOUT
   ============================================ */

.insim-modern-wrapper {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    margin: 20px 0;
    min-height: calc(100vh - 200px);
}

/* Left Panel - Filters */
.insim-filter-panel {
    position: sticky;
    top: 32px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.insim-filter-panel.collapsed {
    width: 60px !important;
    overflow: hidden;
}

.insim-filter-panel.collapsed .insim-filter-title {
    opacity: 0;
}

.insim-filter-panel.collapsed .insim-filter-content {
    display: none;
}

/* Right Panel - Results */
.insim-results-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

/* ============================================
   FILTER HEADER WITH GRADIENT
   ============================================ */

.insim-filter-header-modern {
    background: var(--bg-gradient);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.insim-filter-header-modern::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.insim-filter-title {
    position: relative;
    z-index: 1;
    color: white;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.insim-filter-title-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.insim-toggle-panel {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.insim-toggle-panel:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* ============================================
   FILTER CONTENT - SCROLLABLE
   ============================================ */

.insim-filter-content {
    padding: 20px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    overflow-x: hidden;
}

.insim-filter-content::-webkit-scrollbar {
    width: 6px;
}

.insim-filter-content::-webkit-scrollbar-track {
    background: transparent;
}

.insim-filter-content::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

/* Filter Categories - Accordion Style */
.insim-filter-category-modern {
    margin-bottom: 16px;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.insim-filter-category-modern:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.insim-category-header-modern {
    padding: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, #f8fafc, white);
    transition: all 0.3s ease;
    user-select: none;
}

.insim-category-header-modern:hover {
    background: linear-gradient(to right, #f1f5f9, white);
}

.insim-category-header-modern.active {
    background: linear-gradient(to right, #e0e7ff, white);
    border-bottom: 1px solid #e2e8f0;
}

.insim-category-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.insim-category-icon-modern {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.insim-category-toggle-icon {
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    font-size: 18px;
}

.insim-category-header-modern.active .insim-category-toggle-icon {
    transform: rotate(180deg);
}

.insim-category-body-modern {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.insim-category-body-modern.open {
    max-height: 800px;
    padding: 16px;
}

/* ============================================
   MODERN INPUT FIELDS
   ============================================ */

.insim-field-group {
    margin-bottom: 20px;
}

.insim-field-label-modern {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.insim-field-required {
    color: var(--danger);
}

.insim-input-modern,
.insim-select-modern {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
    color: var(--text-primary);
}

.insim-input-modern:focus,
.insim-select-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.insim-input-modern::placeholder {
    color: var(--text-muted);
}

/* Date Range */
.insim-date-range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}

.insim-date-separator {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
}

/* Checkbox Modern */
.insim-checkbox-modern {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.insim-checkbox-modern:hover {
    background: #f1f5f9;
}

.insim-checkbox-modern input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.insim-checkbox-modern label {
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    margin: 0;
}

/* ============================================
   ACTIVE FILTERS CHIPS
   ============================================ */

.insim-active-filters-modern {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.insim-active-filters-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #92400e;
    margin-bottom: 10px;
}

.insim-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.insim-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: white;
    border: 2px solid #fbbf24;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    transition: all 0.3s ease;
    animation: chipIn 0.3s ease;
}

@keyframes chipIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.insim-chip:hover {
    background: #fef3c7;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.insim-chip-remove {
    width: 16px;
    height: 16px;
    background: #f59e0b;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.insim-chip-remove:hover {
    background: #d97706;
    transform: scale(1.1);
}

/* ============================================
   RESULTS PANEL - DASHBOARD STYLE
   ============================================ */

.insim-results-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.insim-results-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.insim-results-title {
    color: white;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.insim-results-count-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: countPulse 2s ease-in-out infinite;
}

@keyframes countPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Stats Cards Grid */
.insim-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.insim-stat-card-modern {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.insim-stat-card-modern:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-4px);
}

.insim-stat-label-modern {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.insim-stat-value-modern {
    font-size: 28px;
    font-weight: 800;
    color: white;
    line-height: 1;
}

.insim-stat-unit {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-left: 4px;
}

/* ============================================
   CUSTOMER LIST - TABLE MODERN
   ============================================ */

.insim-results-body {
    flex: 1;
    padding: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.insim-customers-table-wrapper {
    flex: 1;
    overflow-y: auto;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
}

.insim-customers-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.insim-customers-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(to right, #f8fafc, white);
}

.insim-customers-table th {
    padding: 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid #e2e8f0;
}

.insim-customers-table tbody tr {
    transition: all 0.3s ease;
    background: white;
}

.insim-customers-table tbody tr:hover {
    background: #f8fafc;
    transform: scale(1.01);
    box-shadow: var(--shadow-sm);
}

.insim-customers-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: var(--text-primary);
}

.insim-customer-name {
    font-weight: 600;
    color: var(--primary);
}

.insim-customer-phone {
    font-family: 'Courier New', monospace;
    color: var(--text-secondary);
}

.insim-customer-email {
    color: var(--text-secondary);
    font-size: 13px;
}

.insim-badge-modern,
.insim-customer-orders {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
}

.insim-customer-spent {
    font-weight: 700;
    color: var(--success);
}

/* ============================================
   ACTION BUTTONS - FLOATING
   ============================================ */

.insim-actions-bar {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

.insim-btn-modern {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.insim-btn-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.insim-btn-modern:hover::before {
    width: 300px;
    height: 300px;
}

.insim-btn-primary-modern {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.insim-btn-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.insim-btn-secondary-modern {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.insim-btn-secondary-modern:hover {
    background: var(--primary);
    color: white;
}

.insim-btn-success-modern {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.insim-btn-success-modern:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */

.insim-loading-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.insim-spinner-modern {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.insim-loading-text {
    margin-top: 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.insim-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.insim-empty-icon {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.insim-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.insim-empty-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1400px) {
    .insim-modern-wrapper {
        grid-template-columns: 360px 1fr;
    }

    .insim-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .insim-modern-wrapper {
        grid-template-columns: 1fr;
    }

    .insim-filter-panel {
        position: relative;
        max-height: none;
    }

    .insim-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .insim-stats-grid {
        grid-template-columns: 1fr;
    }

    .insim-actions-bar {
        flex-direction: column;
    }

    .insim-btn-modern {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   ANIMATIONS & EFFECTS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.insim-fade-in {
    animation: fadeInUp 0.5s ease;
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.insim-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}
