/* ==================================================
   PREMIUM LIGHT GREY DESIGN SYSTEM
   ================================================== */

:root {
    --header-height: 70px;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --primary: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --bg-page: #f8fafc;
    --bg-header: #ffffff;
    --bg-sidebar: #0f172a;
    /* Dark sleek sidebar */
    --border-subtle: rgba(0, 0, 0, 0.05);
    --bg-card: #ffffff;
    --radius-xl: 1.5rem;
    --radius-2xl: 2.5rem;
}

/* Base Body Styles */
body {
    background-color: var(--bg-page) !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Outfit', sans-serif;
    color: #334155;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==================================================
   GLOBAL FIXED LAYOUT (Responsive)
   ================================================== */

.dashboard-header {
    position: relative !important;
    width: 100%;
    height: var(--header-height);
    z-index: 2000 !important;
    background: var(--bg-header) !important;
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between !important;
    padding: 0 1.5rem !important;
}

.sidebar {
    position: fixed !important;
    top: 0;
    left: -100%;
    /* Hidden on mobile */
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 5000 !important;
    background: var(--bg-sidebar) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

.sidebar.show {
    left: 0 !important;
}

.main-content {
    margin-left: 0;
    /* Full width on mobile */
    min-height: 100vh;
    width: 100%;
    padding: 1.5rem !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desktop Overrides */
@media (min-width: 1024px) {
    .sidebar {
        left: 0;
        top: 0;
        z-index: 5001 !important;
        box-shadow: none;
        border-right: 1px solid rgba(255, 255, 255, 0.05);
    }

    .sidebar.sidebar-collapsed {
        width: var(--sidebar-collapsed-width) !important;
    }

    .dashboard-header {
        width: 100% !important;
    }

    .sidebar-collapsed .dashboard-header {
        width: 100% !important;
    }

    .main-content {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
        padding: 2.5rem !important;
    }

    .main-content.sidebar-collapsed {
        margin-left: var(--sidebar-collapsed-width);
        width: calc(100% - var(--sidebar-collapsed-width));
    }
}

/* ==================================================
   SIDEBAR & NAV COMPONENTS
   ================================================== */

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-title {
    color: #94a3b8;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.1em;
}

.nav-link {
    display: flex !important;
    align-items: center;
    gap: 14px;
    padding: 0.875rem 1.5rem;
    color: #94a3b8 !important;
    transition: all 0.3s ease;
    text-decoration: none !important;
    font-weight: 600;
    margin: 4px 12px;
    border-radius: 12px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    color: #fff !important;
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), #6366f1) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-link.active .nav-icon {
    opacity: 1;
}

.sidebar-collapsed .nav-text,
.sidebar-collapsed .caret,
.sidebar-collapsed .sidebar-title,
.sidebar-collapsed #mobileClose {
    display: none !important;
}

.sidebar-collapsed .nav-link {
    justify-content: center !important;
    padding: 1rem !important;
    margin: 8px !important;
}

.sidebar-collapsed .nav-icon {
    margin: 0 !important;
    font-size: 1.25rem;
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: rgba(0, 0, 0, 0.1);
}

.submenu.show {
    max-height: 500px;
}

.submenu .nav-link {
    padding-left: 3.5rem;
    font-size: 0.85rem;
}

/* ==================================================
   STAT CARDS & COMPONENTS
   ================================================== */

.stat-card {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05);
    border-color: rgba(79, 70, 229, 0.2);
}

/* ==================================================
   REPORTS & TABLE STYLES (Responsive Scroll)
   ================================================== */

.panel-table-container {
    background: #fff;
    border-radius: var(--radius-xl);
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.overflow-x-auto {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.panel-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
    /* Force scroll on small screens for structure */
}

@media (max-width: 640px) {
    .panel-table {
        min-width: 800px;
    }
}

.panel-table th {
    background: #f8fafc;
    padding: 1.25rem 1.5rem;
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #f1f5f9;
}

.panel-table td {
    padding: 1.5rem;
    background: #fff;
    border-bottom: 1px solid #f8fafc;
    color: #475569;
    font-size: 14px;
}

/* Badge System */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    min-width: 90px;
}

.badge-success {
    background: #ecfdf5 !important;
    color: #059669 !important;
    border: 1px solid #d1fae5 !important;
}

.badge-warning {
    background: #fffbeb !important;
    color: #d97706 !important;
    border: 1px solid #fef3c7 !important;
}

.badge-danger {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fee2e2 !important;
}

.badge-info {
    background: #eff6ff !important;
    color: #2563eb !important;
    border: 1px solid #dbeafe !important;
}

.badge-secondary {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
}

/* ==================================================
   DARK MODE SYSTEM
   ================================================== */

body.dark-mode {
    background-color: #0f172a !important;
    color: #f1f5f9;
}

body.dark-mode .dashboard-header {
    background-color: #0f172a !important;
    border-color: #1e293b;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

body.dark-mode .bg-white,
body.dark-mode .stat-card,
body.dark-mode .panel-table-container,
body.dark-mode .panel-table td {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

body.dark-mode .panel-table th {
    background-color: #0f172a !important;
    color: #94a3b8;
    border-bottom-color: #334155;
}

body.dark-mode .text-slate-800,
body.dark-mode .text-slate-700 {
    color: #f1f5f9 !important;
}

body.dark-mode .text-slate-400 {
    color: #94a3b8 !important;
}

/* Dark Mode Badges */
body.dark-mode .badge-success {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #34d399 !important;
    border: none !important;
}

body.dark-mode .badge-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #fbbf24 !important;
    border: none !important;
}

body.dark-mode .badge-danger {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #f87171 !important;
    border: none !important;
}

body.dark-mode .badge-info {
    background: rgba(37, 99, 235, 0.1) !important;
    color: #60a5fa !important;
    border: none !important;
}

/* Override Tailwind Backgrounds in Dark Mode */
body.dark-mode .bg-indigo-50,
body.dark-mode .bg-emerald-50,
body.dark-mode .bg-amber-50,
body.dark-mode .bg-rose-50,
body.dark-mode .bg-slate-50,
body.dark-mode .bg-slate-100 {
    background-color: rgba(255, 255, 255, 0.03) !important;
    color: #f1f5f9 !important;
}

body.dark-mode .border-slate-200,
body.dark-mode .border-slate-100 {
    border-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-mode .text-indigo-600,
body.dark-mode .text-emerald-600,
body.dark-mode .text-amber-600,
body.dark-mode .text-rose-600 {
    color: #fff !important;
}

body.dark-mode input.form-input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #fff !important;
}

body.dark-mode .scrolling-title-pro span {
    color: #fff !important;
}

body.dark-mode .scrolling-title-container-pro {
    background: transparent !important;
}

body.dark-mode .bg-slate-50\/50 {
    background-color: rgba(30, 41, 59, 0.5) !important;
}

/* ==================================================
   AUTHENTICATION PAGES (Neural Track)
   ================================================== */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 0% 0%, #1e1b4b 0%, #0f172a 100%);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-2xl);
    padding: 3rem;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
    animation: authFadeIn 0.8s ease-out;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    box-shadow: 0 10px 40px rgba(79, 70, 229, 0.4);
    margin: 0 auto 2rem;
}

.auth-title {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 900;
    text-align: center;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: #94a3b8;
    text-align: center;
    font-size: 0.875rem;
    margin-bottom: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 700;
}

.form-premium-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    color: #fff !important;
    padding: 1rem 1.25rem !important;
    font-weight: 600 !important;
    width: 100%;
    outline: none;
    transition: all 0.3s ease;
}

.form-premium-input:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.btn-premium-auth {
    background: var(--primary) !important;
    color: #fff !important;
    padding: 1rem !important;
    border-radius: 16px !important;
    font-weight: 800 !important;
    font-size: 0.875rem !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    width: 100%;
    border: none !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    margin-top: 2rem;
    transition: all 0.3s ease;
}

.btn-premium-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.5);
    background: #6366f1 !important;
}

/* Profile Dropdown Refinement */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 260px;
    background: #fff;
    border-radius: 20px;
    padding: 0.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5000;
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

body.dark-mode .profile-dropdown {
    background: #1e293b;
    border-color: #334155;
}

/* Hamburger Toggle for Mobile */
#mobileToggle {
    display: flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    cursor: pointer;
}

body.dark-mode #mobileToggle {
    background: #1e293b;
    color: #94a3b8;
}

@media (min-width: 1024px) {
    #mobileToggle {
        display: none;
    }
}

/* ==================================================
   ANIMATED DASHBOARD TITLE (SCROLL + PAUSE)
   ================================================== */
.scrolling-title-container-pro {
    width: 100%;
    overflow: hidden;
    position: relative;
    background: transparent;
}

.scrolling-title-pro {
    display: inline-block;
    white-space: nowrap;
    animation: title-scroll-right 60s linear infinite;
    will-change: transform;
}

.title-text-pro {
    font-size: 1.5rem;
    font-weight: 900;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0 2rem;
}

@keyframes title-scroll-right {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(100vw);
    }

    100% {
        transform: translateX(100vw);
    }
}

body.dark-mode .title-text-pro {
    color: #f1f5f9;
}