/* Modern Dashboard Styles with Theme Support */

/* Light Mode (Default) */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-blue: #2C4A73;
    --accent-purple: #5A4F82;
    --accent-green: #1E8A7A;
    --accent-orange: #CBAF5E;
    --accent-red: #D64545;
    --border-color: #e2e8f0;
    --hover-bg: #f1f5f9;
    --price-color: #2C4A73;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Dark Mode */
    [data-theme="dark"] {
    --bg-primary: #121921;      /* پس‌زمینه بسیار تیره، مکمل برند */
    --bg-secondary: #182330;    /* کمی روشن‌تر برای بخش‌های داخلی */
    --bg-card: #1E2A3A;         /* کارت‌ها، با کنتراست مناسب */
    --bg-sidebar: #0F1620;      /* سایدبار جدی‌تر و متمرکز */

    --text-primary: #F8FAFC;    /* متن سفید-آبی بسیار خوانا */
    --text-secondary: #A7B4C5;  /* خاکستری آبی؛ خوانا اما نرم */

    --border-color: #2C3A4A;    /* نوارهای کنتراست پایین */

    --hover-bg: #243447;        /* رنگ هاور هماهنگ با برند */
    --price-color: #ffffff;     /* رنگ قیمت سفید در حالت تاریک */
      --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Sidebar Styles */
.modern-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-sidebar);
    padding: 2rem 0;
    z-index: 1000;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

/* Sidebar Close Button */
.sidebar-close-btn {
    display: none;
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sidebar-close-btn:hover {
    background: var(--hover-bg);
    color: var(--accent-red);
}

@media (max-width: 1024px) {
    .sidebar-close-btn {
        display: flex;
    }
}

.sidebar-header {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: bold;
}

.sidebar-logo i {
    color: var(--accent-blue);
    font-size: 1.5rem;
}

.sidebar-user {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    text-align: center;
}

.sidebar-user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.5rem;
}

.sidebar-user-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.sidebar-user-role {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.sidebar-nav {
    padding: 1.5rem 0;
}

.nav-section-title {
    padding: 0 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-nav-link.active {
    background: var(--accent-blue);
    color: white;
}

.sidebar-nav-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-blue);
}

.sidebar-nav-link i {
    width: 20px;
    text-align: center;
}

.nav-badge {
    margin-right: auto;
    background: var(--accent-red);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    margin-right: 280px;
    min-height: 100vh;
    padding: 2rem;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.top-bar-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
    width: 200px;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    cursor: pointer;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card.blue::before {
    background: var(--accent-blue);
}

.stat-card.purple::before {
    background: var(--accent-purple);
}

.stat-card.green::before {
    background: var(--accent-green);
}

.stat-card.orange::before {
    background: var(--accent-orange);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.stat-card-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card.blue .stat-card-icon {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.stat-card.purple .stat-card-icon {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-purple);
}

.stat-card.green .stat-card-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.stat-card.orange .stat-card-icon {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-orange);
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.stat-change.up {
    color: var(--accent-green);
}

.stat-change.down {
    color: var(--accent-red);
}

.stat-change-text {
    color: var(--text-secondary);
}

/* Chart Card */
.chart-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-filter {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--accent-blue);
    color: white;
}

.chart-container {
    height: 300px;
    position: relative;
}

/* Table Card */
.table-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Horizontal Scroll for Tables */
.table-card .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

/* Base button styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
     justify-content: center;
    gap: 0.5rem;
}

/* Primary button with centered content */
.btn-primary {
    background: var(--accent-blue);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--hover-bg);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
    max-width: fit-content;
}

.btn-secondary.btn-sm {
    margin-right: 0;
    margin-top: 0.5rem;
}

.btn-primary.btn-sm,
.btn-danger.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    max-width: fit-content;
    padding: 0.375rem 0.75rem;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

.modern-table thead {
    background: var(--bg-secondary);
}

.modern-table th {
    padding: 1rem 1.5rem;
    text-align: right;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modern-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.modern-table tr:hover {
    background: var(--bg-secondary);
}

.modern-table tr:last-child td {
    border-bottom: none;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1f2e8;
    color: #0d6e4f;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

[data-theme="dark"] .badge-success {
    background: rgba(16, 185, 129, 0.25);
    color: #86efac;
}

[data-theme="dark"] .badge-warning {
    background: rgba(245, 158, 11, 0.25);
    color: #fcd34d;
}

[data-theme="dark"] .badge-danger {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

[data-theme="dark"] .badge-info {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    background: var(--accent-blue);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 998;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* Hide button when menu is open */
body.menu-open .mobile-menu-btn {
    opacity: 0;
    pointer-events: none;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .modern-sidebar {
        transform: translateX(100%);
        transition: transform 0.3s ease;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    }
    
    .modern-sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 0.75rem;
        padding: 4rem 1rem 1rem 1rem;
        margin-bottom: 0;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .page-title {
        font-size: 1.25rem;
        width: 100%;
        text-align: right;
        margin: 0;
    }
    
    .search-box {
        display: none;
    }
    
    .main-content {
        padding: 1rem;
        padding-top: 0rem;
    }
    
    .top-bar-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .notification-center {
        display: flex;
        gap: 0.5rem;
    }
    
    .user-menu {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
        margin-right: auto;
    }

    .user-menu span {
        display: none;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .table-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .table-actions .btn {
        flex: 1;
        min-width: 48%;
    }
}

@media (max-width: 480px) {
    .table-actions {
        flex-direction: column;
    }

    .table-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

    .user-avatar {
        width: 32px;
        height: 32px;
    }
    
    .notification-icon {
        padding: 0.625rem;
    }
    
    .notification-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* Notification Center */
.notification-center {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.notification-icon-wrapper {
    position: relative;
}

.notification-icon {
    position: relative;
    background: var(--bg-secondary);
    border: none;
    border-radius: 10px;
    padding: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-icon:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
}

.notification-icon svg {
    display: block;
}

.notification-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: var(--accent-red);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 380px;
    max-width: 90vw;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

/* Dropdown overlay for mobile */
.notification-dropdown::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: -1;
}

/* Fix dropdown position on mobile */
@media (max-width: 768px) {
    .notification-dropdown::before {
        display: block;
    }
    
    .notification-dropdown.active::before {
        opacity: 1;
        visibility: visible;
    }
    
    .notification-dropdown {
        position: fixed;
        top: 5rem;
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        width: auto;
        max-width: none;
        transform: translateY(-20px);
        border-radius: 16px;
        display: flex;
        flex-direction: column;
        z-index: 1100;
    }
    
    .notification-dropdown.active {
        transform: translateY(0);
    }
    
    .notification-dropdown-body {
        max-height: none;
        flex: 1;
        overflow-y: auto;
    }
    
    .notification-dropdown-header {
        flex-shrink: 0;
    }
    
    .notification-dropdown-footer {
        flex-shrink: 0;
    }
}

@media (min-width: 769px) {
    .notification-dropdown::before {
        display: none;
    }
}

.notification-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-dropdown-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Dropdown close button */
.dropdown-close-btn {
    display: none;
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.dropdown-close-btn:hover {
    background: var(--hover-bg);
    color: var(--accent-red);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .dropdown-close-btn {
        display: flex;
    }
}

.notification-dropdown-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.notification-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.notification-dropdown-body {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    transition: background 0.2s ease;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: #f0f9ff;
}

[data-theme="dark"] .notification-item:hover {
    background: var(--bg-secondary);
}

.notification-item-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: #1e40af;
    font-size: 1.1rem;
}

.notification-item-icon.notification-type-success {
    background: #d1f2e8;
    color: #0d6e4f;
}

.notification-item-icon.notification-type-warning {
    background: #fef3c7;
    color: #92400e;
}

.notification-item-icon.notification-type-error {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .notification-item-icon {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

[data-theme="dark"] .notification-item-icon.notification-type-success {
    background: rgba(16, 185, 129, 0.25);
    color: #86efac;
}

[data-theme="dark"] .notification-item-icon.notification-type-warning {
    background: rgba(245, 158, 11, 0.25);
    color: #fcd34d;
}

[data-theme="dark"] .notification-item-icon.notification-type-error {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.notification-item-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-item-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.notification-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.notification-empty i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.notification-empty p {
    font-size: 0.9rem;
    margin: 0;
}

.notification-dropdown-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.notification-dropdown-footer a {
    display: block;
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.notification-dropdown-footer a:hover {
    color: #2563eb;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--hover-bg);
}

/* Horizontal scrollbar for tables */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Theme Toggle Button */
.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    color: var(--text-primary);
}

.theme-toggle:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
}

.theme-toggle-icon {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-toggle-icon {
    transform: rotate(20deg);
}

/* Theme toggle animation */
[data-theme="dark"] .sun-icon {
    display: none;
}

[data-theme="light"] .moon-icon,
:root:not([data-theme]) .moon-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: inline-block;
}

[data-theme="light"] .sun-icon,
:root:not([data-theme]) .sun-icon {
    display: inline-block;
}

/* Smooth theme transition */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.modern-sidebar,
.stat-card,
.chart-card,
.table-card,
.notification-dropdown,
.search-box,
.user-menu,
.notification-icon {
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Form Responsive Styles */
@media (max-width: 768px) {
    /* Form inputs - full width on mobile */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        width: 100% !important;
        max-width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem !important;
    }
    
    /* Form container adjustments */
    .chart-card {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .chart-title {
        font-size: 1.125rem;
        width: 100%;
    }
    
    /* Form grid - single column on mobile */
    div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Form padding */
    div[style*="padding: 2rem"] {
        padding: 1rem !important;
    }
    
    /* Button layout - stack vertically on mobile */
    div[style*="display: flex"][style*="gap: 1rem"][style*="justify-content: center"] {
        flex-direction: column;
        gap: 0.75rem !important;
    }
    
    .btn {
        width: 100%;
        padding: 0.875rem 1rem !important;
        font-size: 1rem !important;
    }
    
    /* Category selector container */
    div[style*="background: var(--bg-secondary)"][style*="border: 1px solid var(--border-color)"][style*="border-radius: 12px"] {
        padding: 1rem !important;
    }
    
    /* Selected preview - responsive */
    div[id="selected-preview"] {
        min-height: auto !important;
        gap: 0.5rem !important;
    }
    
    /* Labels - better spacing on mobile */
    label {
        font-size: 0.95rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Top bar - responsive */
    .top-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .top-bar-actions {
        width: 100%;
    }
    
    .top-bar-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* Extra small devices */
    .chart-card {
        padding: 0.75rem;
    }
    
    div[style*="padding: 2rem"] {
        padding: 0.75rem !important;
    }
    
    .chart-title {
        font-size: 1rem;
    }
    
    .page-title {
        font-size: 1.125rem;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        padding: 0.75rem 0.875rem !important;
        font-size: 16px;
    }
    
    .btn {
        padding: 0.75rem 0.875rem !important;
        font-size: 0.95rem !important;
    }
}
