/* ============================================================
   JGS SAMBHAV — dark-theme.css  (v4)
   data-theme="dark" is on BODY element
   ============================================================ */

/* Body itself */
body[data-theme="dark"],
html[data-theme="dark"] body {
    background-color: #0F172A !important;
    color: #E2E8F0 !important;
}

    /* All direct children and common wrappers */
    body[data-theme="dark"] *,
    html[data-theme="dark"] body * {
        border-color: #334155;
    }

    /* ── Main content / page wrapper ── */
    body[data-theme="dark"] .main-panel,
    body[data-theme="dark"] .main-content,
    body[data-theme="dark"] .content-wrapper,
    body[data-theme="dark"] .page-content,
    body[data-theme="dark"] .panel-content,
    body[data-theme="dark"] #main-panel,
    body[data-theme="dark"] #content,
    body[data-theme="dark"] .wrapper > div:not(.sidebar) {
        background-color: #131C2E !important;
    }

        body[data-theme="dark"] .main-panel > .content,
        body[data-theme="dark"] .main-panel > .content-fluid,
        body[data-theme="dark"] .content-area,
        body[data-theme="dark"] .inner-content {
            background-color: #131C2E !important;
        }

    /* The form and its children (content lives in form1 > div) */
    body[data-theme="dark"] form#form1 > div {
        background-color: #131C2E !important;
    }

    /* ── Sidebar ── */
    body[data-theme="dark"] .sidebar,
    body[data-theme="dark"] #sidebar,
    body[data-theme="dark"] .side-nav,
    body[data-theme="dark"] nav.sidebar {
        background-color: #0F172A !important;
    }

    body[data-theme="dark"] .sidebar-wrapper {
        background-color: #0F172A !important;
    }

    /* Logo white box */
    body[data-theme="dark"] .logo,
    body[data-theme="dark"] .sidebar .logo,
    body[data-theme="dark"] .sidebar-brand,
    body[data-theme="dark"] .navbar-header,
    body[data-theme="dark"] .brand-logo {
        background-color: #0F172A !important;
        border-bottom: 1px solid #1E293B !important;
    }

        body[data-theme="dark"] .logo a,
        body[data-theme="dark"] .logo .simple-text {
            color: #F1F5F9 !important;
        }

    /* Nav links */
    body[data-theme="dark"] .sidebar .nav li > a {
        color: #94A3B8 !important;
    }

        body[data-theme="dark"] .sidebar .nav li > a:hover {
            background: #1E293B !important;
            color: #F1F5F9 !important;
            opacity: 1 !important;
        }

    body[data-theme="dark"] .sidebar .nav li.active > a {
        background: #1E3A5F !important;
        color: #F1F5F9 !important;
        border-left: 3px solid #4D7FE8 !important;
    }

    body[data-theme="dark"] .sidebar .nav li > a i {
        color: #64748B !important;
    }

    body[data-theme="dark"] .sidebar .nav li.active > a i,
    body[data-theme="dark"] .sidebar .nav li > a:hover i {
        color: #4D7FE8 !important;
    }

    body[data-theme="dark"] .sidebar .nav li > a b {
        color: #64748B !important;
    }

    /* Sub-menus */
    body[data-theme="dark"] .sidebar .nav li .collapse li > a {
        color: #94A3B8 !important;
        background: transparent !important;
    }

        body[data-theme="dark"] .sidebar .nav li .collapse li.active > a,
        body[data-theme="dark"] .sidebar .nav li .collapse li > a:hover {
            color: #F1F5F9 !important;
            background: #1E293B !important;
        }

    /* Search */
    body[data-theme="dark"] .sidebar input[type="text"] {
        background: #1E293B !important;
        border-color: #334155 !important;
        color: #F1F5F9 !important;
    }

    /* User bottom */
    body[data-theme="dark"] .sidebar .user {
        background: #0F172A !important;
        border-top: 1px solid #1E293B !important;
    }

        body[data-theme="dark"] .sidebar .user a > span:first-child {
            color: #F1F5F9 !important;
        }

        body[data-theme="dark"] .sidebar .user p {
            color: #64748B !important;
        }

    /* ── Navbar ── */
    body[data-theme="dark"] .navbar,
    body[data-theme="dark"] .navbar.navbar-transparent,
    body[data-theme="dark"] .main-header,
    body[data-theme="dark"] header.topbar {
        background-color: #0F172A !important;
        box-shadow: 0 1px 6px rgba(0,0,0,0.5) !important;
    }

        body[data-theme="dark"] .navbar .breadcrumb li,
        body[data-theme="dark"] .navbar .breadcrumb li a {
            color: #94A3B8 !important;
        }

        body[data-theme="dark"] .navbar .navbar-nav > li > a {
            color: #64748B !important;
        }

            body[data-theme="dark"] .navbar .navbar-nav > li > a:hover {
                color: #F1F5F9 !important;
                background: #1E293B !important;
            }

        body[data-theme="dark"] .navbar .badge {
            background: #EF4444 !important;
            color: #fff !important;
        }

    /* ── Dropdown ── */
    body[data-theme="dark"] .dropdown-menu {
        background: #1E293B !important;
        border: 1px solid #334155 !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
    }

        body[data-theme="dark"] .dropdown-menu li a,
        body[data-theme="dark"] .dropdown-item {
            color: #94A3B8 !important;
        }

            body[data-theme="dark"] .dropdown-menu li a:hover,
            body[data-theme="dark"] .dropdown-item:hover {
                background: #263347 !important;
                color: #F1F5F9 !important;
            }

    /* ── Cards ── */
    body[data-theme="dark"] .card {
        background: #1E293B !important;
        border-color: #334155 !important;
        color: #E2E8F0 !important;
    }

    body[data-theme="dark"] .card-header {
        background: #1E293B !important;
        border-color: #334155 !important;
        color: #F1F5F9 !important;
    }

    /* ── Tables ── */
    body[data-theme="dark"] table thead th {
        background: linear-gradient(90deg,#1e3a5f,#1e40af) !important;
        color: #fff !important;
        border-color: #334155 !important;
    }

    body[data-theme="dark"] table tbody td {
        background: #1E293B !important;
        border-color: #334155 !important;
        color: #CBD5E1 !important;
    }

    body[data-theme="dark"] table tbody tr:nth-child(even) td {
        background: #263347 !important;
    }

    body[data-theme="dark"] table tbody tr:hover td {
        background: #1A2844 !important;
    }

    /* ── Inputs ── */
    body[data-theme="dark"] input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),
    body[data-theme="dark"] select,
    body[data-theme="dark"] textarea {
        background-color: #1E293B !important;
        border-color: #334155 !important;
        color: #F1F5F9 !important;
    }

        body[data-theme="dark"] input::placeholder,
        body[data-theme="dark"] textarea::placeholder {
            color: #64748B !important;
        }

    body[data-theme="dark"] label {
        color: #94A3B8 !important;
    }

    /* ── Scrollbar ── */
    body[data-theme="dark"] .sidebar-wrapper::-webkit-scrollbar {
        width: 4px;
    }

    body[data-theme="dark"] .sidebar-wrapper::-webkit-scrollbar-track {
        background: #0F172A;
    }

    body[data-theme="dark"] .sidebar-wrapper::-webkit-scrollbar-thumb {
        background: #334155;
        border-radius: 4px;
    }

    /* ── LOGO FIX — override Material Dashboard's hardcoded white background ── */
    body[data-theme="dark"] .sidebar .logo,
    body[data-theme="dark"] .sidebar::after,
    body[data-theme="dark"] .sidebar[data-color="azure"]::after,
    body[data-theme="dark"] .sidebar[data-color="green"]::after,
    body[data-theme="dark"] .sidebar[data-color="orange"]::after,
    body[data-theme="dark"] .sidebar[data-color="danger"]::after,
    body[data-theme="dark"] .sidebar[data-color="rose"]::after {
        background: #0F172A !important;
        border-bottom: 1px solid #1E293B !important;
    }

        /* Material Dashboard often sets logo background via a pseudo-element or data attribute */
        body[data-theme="dark"] .sidebar .logo a.logo-normal,
        body[data-theme="dark"] .sidebar .logo a.logo-mini,
        body[data-theme="dark"] .sidebar .logo .logo-normal,
        body[data-theme="dark"] .sidebar .logo .logo-mini {
            background: transparent !important;
            color: #F1F5F9 !important;
        }

    /* The white box is likely a separate div above the sidebar nav */
    body[data-theme="dark"] .sidebar > div:first-child,
    body[data-theme="dark"] .sidebar-wrapper > .logo {
        background: #0F172A !important;
        border-bottom: 1px solid #1E293B !important;
    }

    /* Kill any box-shadow that creates white appearance */
    body[data-theme="dark"] .logo {
        background: #0F172A !important;
        box-shadow: none !important;
    }
