/* ===== VakilNet admin panel — dark mode =====
   Activated by Bootstrap 5.3's native data-bs-theme="dark" on <html>.
   Bootstrap components (cards, tables, forms, modals, dropdowns, alerts,
   badges) flip automatically; these rules cover the custom components in
   extra.css / style.css so the panel looks native in dark.
   The light theme is untouched — every rule below is scoped to dark. */

[data-bs-theme="dark"] {
    color-scheme: dark;

    /* re-map the custom design tokens used across admin templates */
    --text-dark: #e2e8f0;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --bg-light: #1e293b;
}

/* ---- shell / layout ---- */
[data-bs-theme="dark"] .admin-body {
    background: #0f172a;
}

[data-bs-theme="dark"] .admin-main {
    background: #0f172a;
}

[data-bs-theme="dark"] .admin-topbar {
    background: #1e293b;
    box-shadow: 0 1px 8px rgba(0,0,0,.35);
}
[data-bs-theme="dark"] .topbar-search {
    background: #0f172a; border-color: #334155;
}
[data-bs-theme="dark"] .topbar-search:focus-within {
    border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,.15);
}
[data-bs-theme="dark"] .topbar-search input { color: #e2e8f0; }
[data-bs-theme="dark"] .topbar-search input::placeholder { color: #64748b; }
[data-bs-theme="dark"] .topbar-search i { color: #64748b; }
[data-bs-theme="dark"] .topbar-icon-btn { color: #94a3b8; }
[data-bs-theme="dark"] .topbar-icon-btn:hover { background: #334155; color: #e2e8f0; }
[data-bs-theme="dark"] .topbar-profile { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-bs-theme="dark"] .topbar-profile:hover,
[data-bs-theme="dark"] .topbar-profile[aria-expanded="true"] { background: #334155; border-color: #818cf8; }
[data-bs-theme="dark"] .topbar-profile img { border-color: #334155; }
[data-bs-theme="dark"] .topbar-profile-info strong { color: #e2e8f0; }
[data-bs-theme="dark"] .topbar-profile-info small { color: #94a3b8; }
[data-bs-theme="dark"] .topbar-profile-caret { color: #94a3b8; }
[data-bs-theme="dark"] .notif-menu { background: #1e293b; border-color: #334155; }

/* sidebar is already dark; just keep it consistent */
[data-bs-theme="dark"] .sidebar-link { color: rgba(255, 255, 255, .72); }
[data-bs-theme="dark"] .sidebar-link:hover { background: rgba(255, 255, 255, .1); color: #fff; }
[data-bs-theme="dark"] .sidebar-badge { box-shadow: none; }

/* collapsed rail group toggle + flyout submenu */
[data-bs-theme="dark"] .sidebar-flyout {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 14px 44px rgba(0, 0, 0, .55);
}
[data-bs-theme="dark"] .sidebar-flyout-head {
    color: #94a3b8;
    border-bottom-color: #334155;
}
[data-bs-theme="dark"] .sidebar-flyout-link { color: #e2e8f0; }
[data-bs-theme="dark"] .sidebar-flyout-link i { color: #a5b4fc; }
[data-bs-theme="dark"] .sidebar-flyout-link:hover { background: rgba(102, 126, 234, .18); color: #fff; }
[data-bs-theme="dark"] .sidebar-flyout-link.active { background: var(--primary-gradient); color: #fff; }
[data-bs-theme="dark"] .sidebar-flyout-link.active i { color: #fff; }

/* ---- cards & widgets ---- */
[data-bs-theme="dark"] .card {
    background: #1e293b;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
}

[data-bs-theme="dark"] .card-header {
    background: #1e293b;
    border-bottom-color: #334155;
}

[data-bs-theme="dark"] .card-footer {
    background: #1e293b;
    border-top-color: #334155;
}

[data-bs-theme="dark"] .card-title { color: #e2e8f0; }

[data-bs-theme="dark"] .card-title i { color: var(--primary); }

/* the templates use bg-white on card headers — map it to the surface */
[data-bs-theme="dark"] .card-header.bg-white,
[data-bs-theme="dark"] .card-footer.bg-white,
[data-bs-theme="dark"] .bg-white {
    background-color: #1e293b !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #334155 !important;
}

[data-bs-theme="dark"] .text-bg-light {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .stat-card {
    background: #1e293b;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .3);
}

[data-bs-theme="dark"] .stat-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

[data-bs-theme="dark"] .stat-card-header { color: #94a3b8; }
[data-bs-theme="dark"] .stat-value { color: #f1f5f9; }
[data-bs-theme="dark"] .stat-trend { color: #a7f3d0 !important; }

[data-bs-theme="dark"] .quick-action-card {
    background: #1e293b;
    color: #e2e8f0;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .3);
}

[data-bs-theme="dark"] .quick-action-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}

[data-bs-theme="dark"] .quick-action-title { color: #f1f5f9; }
[data-bs-theme="dark"] .quick-action-desc { color: #94a3b8; }

/* ---- tables ---- */
[data-bs-theme="dark"] .admin-table thead {
    background: #334155;
}

[data-bs-theme="dark"] .admin-table th {
    border-bottom-color: #334155;
    color: #94a3b8;
}

[data-bs-theme="dark"] .admin-table td {
    border-bottom-color: #334155;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .admin-table tbody tr:hover {
    background: #263449;
}

/* .table-light theads used across admin templates */
[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #334155;
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: #475569;
    --bs-table-hover-bg: #3d4a63;
    --bs-table-striped-bg: #2d3a52;
}

[data-bs-theme="dark"] .table {
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: #334155;
}

[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
    --bs-table-color-state: #f1f5f9;
}

[data-bs-theme="dark"] .table-hover > tbody > tr:hover {
    --bs-table-hover-bg: #263449;
}

/* ---- forms / inputs ---- */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #0f172a;
    border-color: var(--primary);
    color: #e2e8f0;
    box-shadow: 0 0 0 .2rem rgba(102, 126, 234, .25);
}

[data-bs-theme="dark"] .form-control::placeholder { color: #64748b; }

[data-bs-theme="dark"] .form-label { color: #cbd5e1; }

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

[data-bs-theme="dark"] .input-group-text {
    background-color: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

[data-bs-theme="dark"] .form-text,
[data-bs-theme="dark"] .text-muted { color: #94a3b8 !important; }

[data-bs-theme="dark"] code {
    background: #0f172a;
    color: #93c5fd;
}

/* ---- lists ---- */
[data-bs-theme="dark"] .list-group-item {
    background: transparent;
    border-color: #334155;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .list-group-item:hover { background: rgba(255, 255, 255, .03); }

[data-bs-theme="dark"] .list-group-item a { color: #cbd5e1; }

[data-bs-theme="dark"] .border {
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .border-dashed {
    border-color: #475569 !important;
}

/* ---- activity feed (admin dashboard) ---- */
[data-bs-theme="dark"] .activity-title { color: #e2e8f0; }
[data-bs-theme="dark"] .activity-desc { color: #94a3b8; }
[data-bs-theme="dark"] .activity-time { color: #64748b; }

/* ---- buttons ---- */
[data-bs-theme="dark"] .btn-light {
    background-color: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .btn-light:hover {
    background-color: #3d4a63;
    border-color: #56637e;
    color: #fff;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    color: #94a3b8;
    border-color: #475569;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #334155;
    border-color: #64748b;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .btn-outline-primary,
[data-bs-theme="dark"] .btn-outline-danger {
    background-color: transparent;
}

/* ---- pagination ---- */
[data-bs-theme="dark"] .page-link {
    background-color: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

[data-bs-theme="dark"] .page-link:hover {
    background-color: #334155;
    color: #fff;
}

[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: #1e293b;
    color: #475569;
}

/* ---- modals / dropdowns (Bootstrap flips them, keep consistent) ---- */
[data-bs-theme="dark"] .modal-content { background: #1e293b; }
[data-bs-theme="dark"] .modal-header { border-bottom-color: #334155; }
[data-bs-theme="dark"] .modal-footer { border-top-color: #334155; }
[data-bs-theme="dark"] .modal-title { color: #e2e8f0; }

[data-bs-theme="dark"] .dropdown-menu { background: #1e293b; }
[data-bs-theme="dark"] .dropdown-item { color: #cbd5e1; }
[data-bs-theme="dark"] .dropdown-item:hover { background: #334155; color: #fff; }
[data-bs-theme="dark"] .dropdown-divider { border-color: #334155; }

/* ---- misc ---- */
[data-bs-theme="dark"] .nav-pills .nav-link { color: #94a3b8; }
[data-bs-theme="dark"] .nav-pills .nav-link.active {
    background: var(--primary-gradient);
    color: #fff;
}

[data-bs-theme="dark"] .nav-tabs .nav-link { color: #94a3b8; }
[data-bs-theme="dark"] .nav-tabs .nav-link.active { color: #e2e8f0; }

[data-bs-theme="dark"] .profile-tabs { border-bottom-color: #334155; }

[data-bs-theme="dark"] .alert { border-color: #334155; }

[data-bs-theme="dark"] hr { border-color: #334155; }

/* specialty tree — child rows */
[data-bs-theme="dark"] .rounded.border { border-color: #334155 !important; }

/* selected row (users page) */
[data-bs-theme="dark"] .admin-table tbody tr.selected,
[data-bs-theme="dark"] .admin-table tbody tr.selected:hover {
    background: #263449 !important;
    color: #e2e8f0;
}

/* smooth transition between themes — keep hover transform + shadow animated too */
html[data-bs-theme] body,
html[data-bs-theme] .card,
html[data-bs-theme] .stat-card,
html[data-bs-theme] .quick-action-card,
html[data-bs-theme] .admin-topbar {
    transition: background-color .25s ease, color .25s ease, border-color .25s ease,
                transform .3s ease, box-shadow .3s ease;
}

/* ==========================================================================
   PUBLIC SITE dark mode (home, search, blog, news, Q&A, profile, panel)
   Scoped to [data-bs-theme="dark"] so the light theme is untouched.
   ========================================================================== */
[data-bs-theme="dark"] body { background: #0f172a; }

/* ---- navbar ---- */
[data-bs-theme="dark"] .main-navbar {
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 2px 20px rgba(0, 0, 0, .4);
}
[data-bs-theme="dark"] .nav-link-main { color: #cbd5e1 !important; }
[data-bs-theme="dark"] .nav-link-main:hover { background: rgba(102, 126, 234, .15); color: #fff !important; }
[data-bs-theme="dark"] .nav-link-main.active { color: #a5b4fc !important; }
[data-bs-theme="dark"] .btn-login { border-color: #a5b4fc; color: #a5b4fc; }
[data-bs-theme="dark"] .btn-login:hover { background: #667eea; color: #fff; }

/* ---- theme toggle + lang switcher ---- */
[data-bs-theme="dark"] .theme-toggle-btn { background: rgba(102, 126, 234, .15); }
[data-bs-theme="dark"] .lang-btn { background: rgba(102, 126, 234, .15); color: #a5b4fc; }
[data-bs-theme="dark"] .lang-btn:hover { background: rgba(102, 126, 234, .3); }
[data-bs-theme="dark"] .lang-dropdown { background: #1e293b; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
[data-bs-theme="dark"] .lang-option { color: #cbd5e1; }
[data-bs-theme="dark"] .nav-dropdown-menu { background: #1e293b; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
[data-bs-theme="dark"] .nav-dropdown-menu a { color: #cbd5e1; }
[data-bs-theme="dark"] .nav-dropdown-menu a:hover { background: rgba(102, 126, 234, .15); color: #fff; }
[data-bs-theme="dark"] .lang-option:hover, [data-bs-theme="dark"] .lang-option.active { background: #334155; color: #fff; }

/* ---- hero sections (keep gradient) ---- */
[data-bs-theme="dark"] .hero-search { background: #1e293b; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
[data-bs-theme="dark"] .hero-search input, [data-bs-theme="dark"] .hero-search select {
    background: #1e293b; color: #e2e8f0;
}
[data-bs-theme="dark"] .hero-search input::placeholder { color: #64748b; }
[data-bs-theme="dark"] .search-input-group { border-color: #334155; }
[data-bs-theme="dark"] .hero-search input:focus, [data-bs-theme="dark"] .hero-search select:focus {
    background: #1e293b; color: #e2e8f0;
}

/* ---- section headings ---- */
[data-bs-theme="dark"] .section-title { color: #f1f5f9; }
[data-bs-theme="dark"] .section-subtitle { color: #94a3b8; }

/* ---- cards: lawyer / category / news / qa / popular ---- */
[data-bs-theme="dark"] .lawyer-card,
[data-bs-theme="dark"] .popular-lawyer-card,
[data-bs-theme="dark"] .category-card,
[data-bs-theme="dark"] .news-card,
[data-bs-theme="dark"] .news-card-site,
[data-bs-theme="dark"] .card-split,
[data-bs-theme="dark"] .card-featured,
[data-bs-theme="dark"] .featured-news-card {
    background: #1e293b;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
}
[data-bs-theme="dark"] .lawyer-card:hover,
[data-bs-theme="dark"] .popular-lawyer-card:hover,
[data-bs-theme="dark"] .news-card:hover,
[data-bs-theme="dark"] .card-split:hover,
[data-bs-theme="dark"] .card-featured:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, .5);
}
[data-bs-theme="dark"] .lawyer-card-header { background: linear-gradient(135deg, rgba(102,126,234,.12), rgba(118,75,162,.12)); }
[data-bs-theme="dark"] .lawyer-avatar { border-color: #334155; }
[data-bs-theme="dark"] .verified-badge { border-color: #1e293b; }
[data-bs-theme="dark"] .lawyer-name,
[data-bs-theme="dark"] .category-name,
[data-bs-theme="dark"] .popular-name,
[data-bs-theme="dark"] .news-title,
[data-bs-theme="dark"] .card-title,
[data-bs-theme="dark"] .featured-title { color: #f1f5f9; }
[data-bs-theme="dark"] .lawyer-title,
[data-bs-theme="dark"] .category-count,
[data-bs-theme="dark"] .popular-meta,
[data-bs-theme="dark"] .news-excerpt,
[data-bs-theme="dark"] .news-footer,
[data-bs-theme="dark"] .card-text,
[data-bs-theme="dark"] .featured-excerpt { color: #94a3b8; }
[data-bs-theme="dark"] .lawyer-stats { border-top-color: #334155; }
[data-bs-theme="dark"] .stat-item .stat-num { color: #f1f5f9; }
[data-bs-theme="dark"] .stat-item .stat-label { color: #64748b; }

/* ---- Q&A ---- */
[data-bs-theme="dark"] .qa-card { background: #1e293b; box-shadow: 0 4px 20px rgba(0, 0, 0, .3); }
[data-bs-theme="dark"] .qa-card:hover { box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
[data-bs-theme="dark"] .qa-question { color: #f1f5f9; }
[data-bs-theme="dark"] .qa-answer { color: #94a3b8; }
[data-bs-theme="dark"] .qa-meta { color: #64748b; }
[data-bs-theme="dark"] .qa-footer { border-top-color: #334155; }

/* ---- search / filter sidebar ---- */
[data-bs-theme="dark"] .filter-sidebar { background: #1e293b; box-shadow: 0 4px 20px rgba(0, 0, 0, .3); }
[data-bs-theme="dark"] .filter-title { color: #f1f5f9; }
[data-bs-theme="dark"] .filter-group { border-bottom-color: #334155; }
[data-bs-theme="dark"] .filter-group-title { color: #e2e8f0; }
[data-bs-theme="dark"] .custom-checkbox { color: #94a3b8; }
[data-bs-theme="dark"] .custom-checkbox .count { background: #334155; color: #cbd5e1; }
[data-bs-theme="dark"] .range-slider input[type="range"] { background: #334155; }
[data-bs-theme="dark"] .filter-modal-content { background: #1e293b; }
[data-bs-theme="dark"] .filter-modal-header { border-bottom-color: #334155; }
[data-bs-theme="dark"] .filter-modal-title { color: #f1f5f9; }

/* ---- mobile bottom nav ---- */
[data-bs-theme="dark"] .mobile-bottom-nav {
    background: #1e293b;
    border-top-color: #334155;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, .4);
}
[data-bs-theme="dark"] .mobile-bottom-nav .nav-item { color: #94a3b8; }
[data-bs-theme="dark"] .mobile-bottom-nav .nav-item.active { color: #a5b4fc; }

/* ---- auth pages ---- */
[data-bs-theme="dark"] .auth-form-side { background: #0f172a; }
[data-bs-theme="dark"] .btn-back { color: #94a3b8; }
[data-bs-theme="dark"] .btn-back:hover { background: #1e293b; color: #a5b4fc; }
[data-bs-theme="dark"] .form-header-icon { background: rgba(102, 126, 234, .2); }
[data-bs-theme="dark"] .form-title { color: #f1f5f9; }
[data-bs-theme="dark"] .form-subtitle { color: #94a3b8; }
[data-bs-theme="dark"] .form-label { color: #cbd5e1; }
[data-bs-theme="dark"] .form-control-custom {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
[data-bs-theme="dark"] .form-control-custom:focus { border-color: #667eea; }
[data-bs-theme="dark"] .form-control-custom::placeholder { color: #475569; }
[data-bs-theme="dark"] .input-wrapper i { color: #64748b; }
[data-bs-theme="dark"] .divider { color: #94a3b8; }
[data-bs-theme="dark"] .divider::before, [data-bs-theme="dark"] .divider::after { background: #334155; }
[data-bs-theme="dark"] .social-btn {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}
[data-bs-theme="dark"] .social-btn:hover { background: #334155; }
[data-bs-theme="dark"] .register-link { color: #94a3b8; }
[data-bs-theme="dark"] .register-link a { color: #a5b4fc; }
[data-bs-theme="dark"] .role-toggle .btn-outline-primary { border-color: #475569; color: #cbd5e1; }

/* ---- panel (lawyer dashboard) uses the public navbar + Bootstrap cards ---- */
[data-bs-theme="dark"] .panel-body { background: #0f172a; }
[data-bs-theme="dark"] .panel-body .card-header.bg-white,
[data-bs-theme="dark"] .panel-body .bg-white { background-color: #1e293b !important; }

/* ---- footer already dark; soften the top edge ---- */
[data-bs-theme="dark"] .footer { border-top: 1px solid #1e293b; }

/* ---- lawyer profile Questions tab: best-answer highlight ---- */
[data-bs-theme="dark"] .answer-item {
    background: #1e293b;
    border-color: #334155;
}
[data-bs-theme="dark"] .answer-item:hover { border-color: #475569; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
[data-bs-theme="dark"] .answer-item.answer-accepted {
    background: linear-gradient(135deg, #2b2410 0%, #3a2e12 100%);
    border-color: #8a6d1f;
    box-shadow: 0 4px 16px rgba(245, 158, 11, .12);
}

/* ---- content pages (blog/news) ---- */
[data-bs-theme="dark"] .article-body,
[data-bs-theme="dark"] .post-content { color: #cbd5e1; }
[data-bs-theme="dark"] .news-card-site:hover { box-shadow: 0 15px 40px rgba(0, 0, 0, .5); }

/* ---- in-app notification bells ---- */
[data-bs-theme="dark"] .notif-menu { background: #1e293b; }
[data-bs-theme="dark"] .notif-menu .dropdown-item { color: #e2e8f0; }
[data-bs-theme="dark"] .notif-menu .dropdown-item:hover { background: rgba(59, 130, 246, .18); color: #fff; }

/* ---- lawyer panel sidebar (dark) ---- */
[data-bs-theme="dark"] .panel-sidebar-inner {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
}
[data-bs-theme="dark"] .panel-profile {
    background: linear-gradient(135deg, rgba(102,126,234,.14), rgba(118,75,162,.10));
    border-bottom-color: #334155;
}
[data-bs-theme="dark"] .panel-profile:hover { background: linear-gradient(135deg, rgba(102,126,234,.22), rgba(118,75,162,.16)); }
[data-bs-theme="dark"] .panel-avatar img { border-color: #334155; }
[data-bs-theme="dark"] .panel-profile-info strong { color: #e2e8f0; }
[data-bs-theme="dark"] .panel-profile-info small { color: #94a3b8; }
[data-bs-theme="dark"] .panel-menu-item { color: #cbd5e1; }
[data-bs-theme="dark"] .panel-menu-item i { color: #94a3b8; }
[data-bs-theme="dark"] .panel-menu-item:hover { background: rgba(102,126,234,.14); color: #fff; }
[data-bs-theme="dark"] .panel-menu-item:hover i { color: #a5b4fc; }
[data-bs-theme="dark"] .panel-menu-item.active {
    background: linear-gradient(135deg, rgba(102,126,234,.26), rgba(118,75,162,.18));
    color: #c7d2fe;
}
[data-bs-theme="dark"] .panel-menu-item.active i { color: #a5b4fc; }
[data-bs-theme="dark"] .panel-menu-section { color: #64748b; }
[data-bs-theme="dark"] .panel-menu-section::after { background: #334155; }
[data-bs-theme="dark"] .panel-sidebar-footer { border-top-color: #334155; }
[data-bs-theme="dark"] .panel-menu-item-danger, [data-bs-theme="dark"] .panel-menu-item-danger i { color: #f87171; }
[data-bs-theme="dark"] .panel-menu-item-danger:hover { background: rgba(248,113,113,.12); color: #fca5a5; }
[data-bs-theme="dark"] .panel-close { background: #334155; color: #cbd5e1; }
[data-bs-theme="dark"] .panel-close:hover { background: #475569; color: #fff; }
[data-bs-theme="dark"] .panel-menu-badge { color: #fff; }
