/* ==========================================================================
   ADMIN DASHBOARD 2.0 - MODERN LAYOUT
   ========================================================================== */

   :root {
    --app-bg: #f5f7fb;
    --app-surface: #ffffff;
    --app-surface-muted: #f8fafc;
    --app-border: #e5e7eb;
    --app-text: #0f172a;
    --app-text-muted: #64748b;
    --app-primary: #2563eb;
    --app-primary-hover: #1d4ed8;

    /* Legacy mapping */
    --bg-app: var(--app-bg);
    --bg-card: var(--app-surface);
    --text-main: var(--app-text);
    --text-muted: var(--app-text-muted);
    --brand: var(--app-primary);
    --brand-dark: var(--app-primary-hover);
    --brand-light: #6c8bff;
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 70px;
    --header-h: 64px;
    --border-soft: var(--app-border);
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 8px 24px rgba(37, 99, 235, 0.12);
    --sidebar-bg: var(--app-surface);
    --sidebar-active: rgba(37, 99, 235, 0.08);
}

[data-bs-theme="dark"] {
    --app-bg: #0f172a;
    --app-surface: #111827;
    --app-surface-muted: #1e293b;
    --app-border: #334155;
    --app-text: #f8fafc;
    --app-text-muted: #cbd5e1;
    --app-primary: #60a5fa;
    --app-primary-hover: #3b82f6;

    /* Legacy mapping override */
    --brand-light: #9eb4ff;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.3);
    --sidebar-active: rgba(96, 165, 250, 0.14);

    /* Override standard Bootstrap variables dynamically */
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-secondary-bg: var(--app-surface-muted);
    --bs-tertiary-bg: var(--app-bg);
    --bs-border-color: var(--app-border);
}

/* ==========================================================================
   GLOBAL DARK MODE OVERRIDES (BOOTSTRAP UTILITIES)
   ========================================================================== */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-body {
    background-color: var(--app-surface) !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: var(--app-surface-muted) !important;
}

[data-bs-theme="dark"] .text-dark {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .text-secondary {
    color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .card-header.bg-white,
[data-bs-theme="dark"] .card-footer.bg-white,
[data-bs-theme="dark"] .card-header.bg-light,
[data-bs-theme="dark"] .card-footer.bg-light {
    background-color: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .card {
    background-color: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: var(--app-surface-muted);
    --bs-table-color: var(--app-text);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .table th,
[data-bs-theme="dark"] .table td {
    color: var(--app-text);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: var(--app-surface-muted) !important;
    color: var(--app-text) !important;
}

/* Forms & Selects */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

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

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

/* Modals & Dropdowns */
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    background: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .modal-header .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

[data-bs-theme="dark"] .dropdown-menu {
    background: var(--app-surface);
    border-color: var(--app-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

[data-bs-theme="dark"] .dropdown-item {
    color: var(--app-text);
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background: var(--app-surface-muted);
    color: var(--app-text);
}

[data-bs-theme="dark"] .dropdown-divider {
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .dropdown-header {
    color: var(--app-text-muted);
}

/* Pagination */
[data-bs-theme="dark"] .pagination .page-link {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .pagination .page-link:hover {
    background-color: var(--app-surface-muted);
    color: var(--app-primary);
}

[data-bs-theme="dark"] .pagination .page-item.active .page-link {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
    color: #ffffff;
}

/* Buttons */
[data-bs-theme="dark"] .btn-primary {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
    color: #ffffff;
}

[data-bs-theme="dark"] .btn-primary:hover {
    background-color: var(--app-primary-hover);
    border-color: var(--app-primary-hover);
}

[data-bs-theme="dark"] .btn-outline-primary {
    color: var(--app-primary);
    border-color: var(--app-primary);
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
    background-color: var(--app-primary);
    color: #ffffff;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    color: var(--app-text);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--app-surface-muted);
    color: var(--app-text);
}

[data-bs-theme="dark"] .btn-white {
    background-color: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .btn-white:hover {
    background-color: var(--app-surface-muted) !important;
}

/* Custom Badges (Status / Role) */
[data-bs-theme="dark"] .badge.bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

[data-bs-theme="dark"] .badge.bg-warning-subtle {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #fde047 !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

[data-bs-theme="dark"] .badge.bg-primary-subtle {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #bfdbfe !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

[data-bs-theme="dark"] .badge.bg-success-subtle {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #a7f3d0 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

[data-bs-theme="dark"] .badge.bg-secondary-subtle {
    background-color: rgba(107, 114, 128, 0.15) !important;
    color: #cbd5e1 !important;
    border-color: rgba(107, 114, 128, 0.3) !important;
}

/* Segmented Switches */
[data-bs-theme="dark"] .seg-switch-container,
[data-bs-theme="dark"] .seg-switch {
    background: var(--app-surface-muted) !important;
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .seg-switch .seg-label {
    color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .seg-switch .seg-selector {
    background: var(--app-surface) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] #office-uk:checked + .seg-label,
[data-bs-theme="dark"] #office-all:checked + .seg-label,
[data-bs-theme="dark"] #office-pk:checked + .seg-label {
    color: var(--app-primary) !important;
}

/* Avatars */
[data-bs-theme="dark"] .avatar-box,
[data-bs-theme="dark"] .avatar-initial {
    background-color: var(--app-surface-muted) !important;
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .avatar-box span,
[data-bs-theme="dark"] .avatar-initial span {
    color: var(--app-text) !important;
}

/* Breadcrumbs */
[data-bs-theme="dark"] .breadcrumb-item a {
    color: var(--app-primary);
}

[data-bs-theme="dark"] .breadcrumb-item.active {
    color: var(--app-text-muted);
}


body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

/* =========================
   TOPBAR
   ========================= */
.admin-topbar {
    height: var(--header-h);
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-soft);
    z-index: 1020;
    transition: all 0.3s ease;
    left: var(--sidebar-w); /* Shifts with sidebar */
    width: calc(100% - var(--sidebar-w));
}

body.sidebar-collapsed .admin-topbar {
    left: var(--sidebar-w-collapsed);
    width: calc(100% - var(--sidebar-w-collapsed));
}

@media (max-width: 991.98px) {
    .admin-topbar {
        left: 0;
        width: 100%;
    }
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    transition: all 0.2s;
}
.btn-icon:hover {
    background: var(--border-soft);
    color: var(--brand);
}

.avatar-circle {
    width: 36px;
    height: 36px;
    background: color-mix(in srgb, var(--brand) 10%, transparent);
    color: var(--brand);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* =========================
   SIDEBAR
   ========================= */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-soft);
    z-index: 1030;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.sidebar-collapsed .admin-sidebar {
    width: var(--sidebar-w-collapsed);
}

.sidebar-header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--brand);
    white-space: nowrap;
    overflow: hidden;
}

body.sidebar-collapsed .logo-wrap .logo-text,
body.sidebar-collapsed .nav-group-label {
    opacity: 0;
    visibility: hidden;
    width: 0;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.nav-group-label {
    padding: 0 24px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
}

.nav-link i {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.nav-link:hover {
    color: var(--brand);
    background: color-mix(in srgb, var(--brand) 5%, transparent);
}

.nav-link.active {
    color: var(--brand);
    background: var(--sidebar-active);
    border-right: 3px solid var(--brand);
}

body.sidebar-collapsed .nav-link span {
    display: none;
}
body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding-inline: 0;
}

/* Collapsed state adjustments for brand header and bottom footer card elements */
body.sidebar-collapsed .logo-text-wrapper {
    display: none !important;
}

body.sidebar-collapsed .sidebar-header {
    justify-content: center !important;
    padding: 0 !important;
}

body.sidebar-collapsed .sidebar-header .d-flex.align-items-center {
    justify-content: center !important;
    width: 100%;
    gap: 0 !important;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 8px !important;
}

body.sidebar-collapsed .upgrade-card {
    display: none !important;
}

body.sidebar-collapsed .profile-card {
    justify-content: center !important;
    padding: 4px !important;
}

body.sidebar-collapsed .profile-info,
body.sidebar-collapsed .profile-card .text-muted {
    display: none !important;
}

/* Sidebar structure flex-shrink & background rules */
.sidebar-header {
    flex-shrink: 0;
    background-color: var(--app-surface) !important;
    border-bottom: 1px solid var(--app-border) !important;
}

.sidebar-content {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-footer {
    flex-shrink: 0;
    background-color: var(--app-surface) !important;
    border-top: 1px solid var(--app-border) !important;
    transition: all 0.3s ease;
}

/* Dark theme specific adjustments for bottom footer cards */
[data-bs-theme="dark"] .upgrade-card {
    background: linear-gradient(135deg, var(--app-surface-muted) 0%, var(--app-bg) 100%) !important;
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .upgrade-card h6 {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .upgrade-card p {
    color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .profile-card:hover {
    background-color: var(--app-surface-muted) !important;
}

/* Mobile Sidebar */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.show {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0,0,0,0.2);
    }
}

/* =========================
   MAIN CONTENT
   ========================= */
.admin-main {
    margin-left: var(--sidebar-w);
    margin-top: var(--header-h);
    padding: 30px;
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - var(--header-h));
}

body.sidebar-collapsed .admin-main {
    margin-left: var(--sidebar-w-collapsed);
}

@media (max-width: 991.98px) {
    .admin-main {
        margin-left: 0 !important;
        padding: 20px;
    }
}

/* =========================
   UTILITIES / OVERRIDES
   ========================= */
/* Card styles from previous theme */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

/* Scrollbar Polish */
.sidebar-content::-webkit-scrollbar {
    width: 4px;
}
.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border-soft);
    border-radius: 4px;
}

/* ==========================================================================
   HR ADMIN DASHBOARD 2.0 REDESIGN STYLES
   ========================================================================== */
.card {
    border-radius: 18px !important;
    border: 1px solid #e8edf5 !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.03) !important;
    background: #ffffff;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

/* Redesigned sidebar active class override */
.admin-sidebar .nav-link.active {
    color: var(--app-primary) !important;
    background: rgba(37, 99, 235, 0.08) !important;
    border-right: none !important;
    font-weight: 700;
}

.admin-sidebar .nav-link {
    font-size: 0.85rem;
    padding: 10px 18px;
    margin: 2px 10px;
    color: var(--app-text-muted);
}

.admin-sidebar .nav-link:hover {
    color: var(--app-primary);
    background: rgba(37, 99, 235, 0.04);
}

.admin-sidebar .nav-group-label {
    padding: 0 28px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--app-text-muted);
    letter-spacing: 0.08em;
}

/* Date Filter Style */
.date-filter-card {
    transition: background-color 0.18s;
}
.date-filter-card:hover {
    background-color: var(--app-surface-muted) !important;
}

/* Sparklines path scaling */
.sparkline {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.03));
}

/* Quick Action Tiles */
.quick-tile {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.quick-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    background: #ffffff !important;
    border-color: var(--app-primary) !important;
}

/* Module Cards */
.module-card {
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease;
}
.module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08) !important;
}

.module-illustration {
    border: 1px solid #f1f5f9;
    height: 90px;
}

/* Topbar Search Pill */
.search-bar-wrapper {
    background: #f8fafc;
    border-color: #e2e8f0 !important;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.search-bar-wrapper:focus-within {
    border-color: var(--app-primary) !important;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-bar-wrapper input::placeholder {
    color: var(--app-text-muted);
    font-weight: 500;
}

/* Profile Card Hover */
.profile-card {
    transition: background-color 0.18s;
}
.profile-card:hover {
    background-color: #f1f5f9;
}

/* Dropdowns & Modals borders */
.dropdown-menu {
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* General Layout spacing rules */
.admin-main {
    background-color: var(--app-bg);
}

/* Colors Utilities */
.text-purple {
    color: #8b5cf6 !important;
}
.bg-purple {
    background-color: #8b5cf6 !important;
}

