/* ============================================
   ROOT VARIABLES & RESET
   ============================================ */
:root {
    /* Light Theme Colors */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    /* Status Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --success-dark: #065f46;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-dark: #92400e;
    --error: #ef4444;
    --error-light: #fee2e2;
    --error-dark: #991b1b;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --info-dark: #1e3a8a;
    
    /* Card Colors */
    --bonus-bg: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    --bonus-color: #ea580c;
    --balance-bg: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    --balance-color: #059669;
    --hold-bg: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    --hold-color: #d97706;
    --total-bg: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    --total-color: #2563eb;
    
    /* Spacing & Sizing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
    --header-height: 70px;
    --border-radius: 12px;
    --box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    
    --bonus-bg: linear-gradient(135deg, #422006 0%, #78350f 100%);
    --balance-bg: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    --hold-bg: linear-gradient(135deg, #713f12 0%, #92400e 100%);
    --total-bg: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', 'Roboto', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: var(--transition);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: var(--box-shadow-lg);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 2rem;
}

.sidebar.collapsed .logo-text {
    display: none;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--background);
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.nav-item:hover {
    background: var(--background);
    color: var(--primary-color);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem;
    background: var(--error-light);
    color: var(--error-dark);
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--error);
    color: white;
    transform: translateY(-2px);
}

.sidebar.collapsed .logout-btn span {
    display: none;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 998;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    z-index: 1001;
    transition: transform 0.2s;
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

.mobile-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
}

.header-title h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.refresh-btn,
.theme-toggle button {
    background: var(--background);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.refresh-btn:hover,
.theme-toggle button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: rotate(90deg);
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.card-icon.bonus {
    background: var(--bonus-color);
}

.card-icon.balance {
    background: var(--balance-color);
}

.card-icon.hold {
    background: var(--hold-color);
}

.card-icon.total {
    background: var(--total-color);
}

.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-limited {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.badge-available {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-hold {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.badge-total {
    background: var(--info-light);
    color: var(--info-dark);
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.card-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
}

.bonus-card .card-value {
    color: var(--bonus-color);
}

.balance-card .card-value {
    color: var(--balance-color);
}

.hold-card .card-value {
    color: var(--hold-color);
}

.total-card .card-value {
    color: var(--total-color);
}

/* Progress Section */
.progress-section {
    margin-top: 0.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-note {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.card-note {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Buttons */
.primary-btn,
.secondary-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    margin-top: 0.75rem;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* ============================================
   BOTTOM SECTION
   ============================================ */
.bottom-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    padding: 0 2rem 2rem;
}

.info-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.info-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.info-card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.info-card-header h3 i {
    color: var(--primary-color);
}

.expected-amount {
    text-align: right;
}

.expected-amount span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

.expected-amount h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.info-card-body {
    padding: 2rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--surface);
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast i {
    font-size: 1.25rem;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--error);
}

.toast.warning i {
    color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bottom-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed !important;
        transform: translateX(-100%) !important;
        width: var(--sidebar-width) !important;
        z-index: 1000 !important;
        transition: transform 0.3s ease !important;
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%) !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: block !important;
        z-index: 1001 !important;
    }
    
    .mobile-overlay {
        display: none;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 999 !important;
        transition: opacity 0.3s ease;
    }
    
    .mobile-overlay.active {
        display: block !important;
        opacity: 1;
    }
    
    .header {
        padding: 1rem;
    }
    
    .header-title h1 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .bottom-section {
        padding: 0 1rem 1rem;
    }
    
    .toast-container {
        left: 1rem;
        right: 1rem;
    }
    
    .toast {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .header-title p {
        display: none;
    }
    
    .card-value {
        font-size: 1.875rem;
    }
    
    .info-card-body {
        padding: 1rem;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.info-card {
    animation: fadeIn 0.5s ease backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .header-right,
    .mobile-menu-btn {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* ============================================
   ADDITIONAL COMPONENTS FOR NEW PAGES
   ============================================ */

/* Content Section */
.content-section {
    padding: 0 2rem 2rem;
}

/* Data Table */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--background);
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--background);
}

.empty-row td {
    padding: 3rem 1rem;
    text-align: center;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
}

.search-box input {
    padding: 0.625rem 1rem 0.625rem 2.75rem;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    min-width: 250px;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-lg);
    border-color: var(--primary-color);
}

.category-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 1rem;
}

.category-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.article-count {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--background);
    border-radius: 15px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Articles List */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.article-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
}

.article-item:hover {
    background: var(--surface);
    box-shadow: var(--box-shadow);
}

.article-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.article-content {
    flex: 1;
}

.article-content h4 {
    font-size: 1rem;
    margin-bottom: 0.375rem;
}

.article-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.article-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.article-btn {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.article-btn:hover {
    background: var(--primary-hover);
    transform: translateX(4px);
}

/* Materials Components */
.materials-tabs {
    display: flex;
    gap: 1rem;
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-btn:hover:not(.active) {
    background: var(--background);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.material-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
}

.material-card:hover {
    box-shadow: var(--box-shadow-lg);
}

.material-preview {
    aspect-ratio: 16/9;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-secondary);
}

.preview-placeholder i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    display: block;
}

.material-info {
    padding: 1.25rem;
}

.material-info h4 {
    font-size: 1rem;
    margin-bottom: 0.375rem;
}

.material-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.material-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    padding: 0.5rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Link Section */
.link-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.link-item {
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--border-radius);
}

.link-details label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.link-input-group {
    display: flex;
    gap: 0.75rem;
}

.link-input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.875rem;
}

.copy-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--primary-hover);
}

/* Messages Layout */
.messages-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    padding: 2rem;
    height: calc(100vh - var(--header-height) - 4rem);
}

.conversations-panel,
.chat-panel {
    background: var(--surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.conversation-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-filter {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-filter.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.badge-count {
    background: white;
    color: var(--primary-color);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
}

.conversation-item:hover {
    background: var(--background);
}

.conversation-item.active {
    background: var(--background);
    border-left: 3px solid var(--primary-color);
}

.conversation-avatar {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.conversation-details {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.375rem;
}

.conversation-header h4 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.conversation-header .time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.conversation-preview {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Chat Panel */
.chat-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-user-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.status {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.status.online i {
    color: var(--success);
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-date-divider {
    text-align: center;
    margin: 1rem 0;
}

.message-date-divider span {
    background: var(--background);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.message.sent {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.message-content {
    max-width: 60%;
}

.message.sent .message-content {
    align-items: flex-end;
}

.message-header {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sender-name {
    font-weight: 600;
}

.message-bubble {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    background: var(--background);
}

.message.sent .message-bubble {
    background: var(--primary-color);
    color: white;
}

.message-bubble p {
    margin: 0;
    line-height: 1.5;
}

.typing-indicator {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.typing-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.typing-dots {
    display: flex;
    gap: 0.375rem;
    padding: 0.875rem 1rem;
    background: var(--background);
    border-radius: 12px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

.chat-input-area {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background: var(--background);
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* Settings Components */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.settings-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.settings-tab.active {
    background: var(--primary-color);
    color: white;
}

.settings-tab:hover:not(.active) {
    background: var(--background);
}

.settings-content {
    display: none;
}

.settings-content.active {
    display: block;
}

.settings-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.profile-picture-section {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--border-radius);
}

.profile-picture {
    width: 100px;
    height: 100px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition);
}

.text-btn:hover {
    color: var(--primary-color);
}

.text-btn.text-danger:hover {
    color: var(--error);
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.alert i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-info {
    background: var(--info-light);
    color: var(--info-dark);
    border: 1px solid var(--info);
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--border-radius);
}

.setting-info h4 {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.setting-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 28px;
    transition: var(--transition);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

.danger-card {
    border-color: var(--error);
}

.danger-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.danger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--error-light);
    border-radius: var(--border-radius);
}

.danger-item h4 {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
    color: var(--error-dark);
}

.danger-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.danger-btn {
    padding: 0.75rem 1.5rem;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.danger-btn:hover {
    background: var(--error-dark);
    transform: translateY(-2px);
}

/* Responsive Updates */
@media (max-width: 1024px) {
    .messages-container {
        grid-template-columns: 300px 1fr;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .content-section {
        padding: 0 1rem 1rem;
    }
    
    .messages-container {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .conversations-panel {
        display: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .materials-grid,
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .search-box input {
        min-width: auto;
        width: 100%;
    }
    
    .header-actions {
        flex-direction: column;
    }
    
    .link-input-group {
        flex-direction: column;
    }
    
    .profile-picture-section {
        flex-direction: column;
        text-align: center;
    }
    
    .setting-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .danger-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}
