/* ========== GLOBAL RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: #f8fafc;
    color: #0f172a;
    transition: background 0.2s, color 0.2s;
}

body.dark {
    background: #0f172a;
    color: #e2e8f0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #e2e8f0;
}
::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 10px;
}

/* ========== APP LAYOUT ========== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: #ffffff;
    box-shadow: 2px 0 12px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease, transform 0.2s;
    z-index: 100;
}
body.dark .sidebar {
    background: #1e293b;
    box-shadow: 2px 0 8px rgba(0,0,0,0.3);
}
.sidebar.collapsed {
    width: 72px;
}
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .sidebar-nav span,
.sidebar.collapsed .sidebar-footer span {
    display: none;
}
.sidebar.collapsed .nav-link i {
    margin-right: 0;
}
.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid #eef2ff;
}
body.dark .sidebar-brand {
    border-bottom-color: #334155;
}
.sidebar-brand i {
    color: #3b82f6;
}
.sidebar-nav ul {
    list-style: none;
    padding: 20px 12px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 12px;
    color: #334155;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}
body.dark .nav-link {
    color: #cbd5e1;
}
.nav-link i {
    width: 24px;
    font-size: 1.2rem;
}
.nav-link.active {
    background: #3b82f6;
    color: white;
}
.nav-link:hover:not(.active) {
    background: #f1f5f9;
}
body.dark .nav-link:hover:not(.active) {
    background: #334155;
}
.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid #eef2ff;
}
body.dark .sidebar-footer {
    border-top-color: #334155;
}
.collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    font-size: 0.9rem;
    width: 100%;
}
body.dark .collapse-btn {
    color: #cbd5e1;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: auto;
}
.top-header {
    background: white;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 50;
}
body.dark .top-header {
    background: #1e293b;
}
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    margin-right: 12px;
}
.header-search {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 40px;
    padding: 8px 16px;
    gap: 8px;
}
body.dark .header-search {
    background: #334155;
}
.global-search-input {
    border: none;
    background: transparent;
    outline: none;
    width: 240px;
}
.header-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}
.dark-mode-toggle, .notification-bell, .profile-dropdown {
    cursor: pointer;
    position: relative;
}
.notification-bell .badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background: #ef4444;
    color: white;
    border-radius: 20px;
    font-size: 10px;
    padding: 2px 6px;
}
.profile-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-dropdown img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.dropdown-menu, .notification-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
    width: 200px;
    z-index: 200;
    padding: 8px 0;
}
body.dark .dropdown-menu, body.dark .notification-dropdown {
    background: #2d3a4e;
}
.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: #0f172a;
}
body.dark .dropdown-menu a {
    color: #e2e8f0;
}
.hidden {
    display: none;
}

/* CARDS & CHARTS */
.page-container {
    padding: 28px 24px;
}
.page-header {
    margin-bottom: 28px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    transition: 0.2s;
    position: relative;
    overflow: hidden;
}
body.dark .stat-card {
    background: #1e293b;
}
.stat-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 8px;
}
.stat-icon {
    position: absolute;
    bottom: 16px;
    right: 16px;
    font-size: 2rem;
    opacity: 0.2;
}
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}
.chart-card {
    background: white;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
body.dark .chart-card {
    background: #1e293b;
}
.chart-card h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

/* TABLES */
.table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-top: 20px;
}
body.dark .table-wrapper {
    background: #1e293b;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eef2ff;
}
body.dark .data-table th, body.dark .data-table td {
    border-bottom-color: #334155;
}
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-searching { background: #fef9c3; color: #854d0e; }
.status-assigned { background: #dbeafe; color: #1e40af; }
.status-onway { background: #e9d5ff; color: #6b21a5; }
.status-completed { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.btn-action {
    background: none;
    border: none;
    cursor: pointer;
    margin: 0 4px;
    font-size: 1rem;
}
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}
.filter-bar select, .filter-bar input {
    padding: 8px 12px;
    border-radius: 40px;
    border: 1px solid #cbd5e1;
    background: white;
}
body.dark .filter-bar select, body.dark .filter-bar input {
    background: #2d3a4e;
    border-color: #475569;
    color: white;
}
.pagination {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}
.pagination button {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
}
body.dark .pagination button {
    background: #334155;
    border-color: #475569;
}

/* LOGIN PAGE */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.login-container {
    background: white;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}
.login-container h2 {
    margin-bottom: 24px;
    text-align: center;
}
.login-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}
.login-container button {
    width: 100%;
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        transition: left 0.2s;
    }
    .sidebar.mobile-open {
        left: 0;
    }
    .mobile-menu-toggle {
        display: block;
    }
    .main-content {
        width: 100%;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}