/* ═══════════════════════════════════════════════════════════
   ABSENSI RFID — DESIGN SYSTEM
   Versi: 2.0 | Android-inspired Material Design
═══════════════════════════════════════════════════════════ */

/* ── 1. CSS CUSTOM PROPERTIES ─────────────────────────────── */
:root {
    /* Brand */
    --primary: #4361ee;
    --primary-soft: rgba(67, 97, 238, 0.12);
    --primary-hover: #3a56d4;

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Neutrals */
    --bg: #eef0f8;
    --surface: #ffffff;
    --surface-alt: #f8f9fc;
    --border: #e5e9f2;
    --text: #1e2235;
    --text-sub: #64748b;
    --text-muted: #94a3b8;

    /* Elevation */
    --shadow-xs: 0 1px 4px rgba(30, 34, 53, .05);
    --shadow-sm: 0 2px 12px rgba(30, 34, 53, .07);
    --shadow-md: 0 6px 24px rgba(30, 34, 53, .10);
    --shadow-lg: 0 12px 40px rgba(30, 34, 53, .13);

    /* Sizing */
    --sidebar-w: 240px;
    --sidebar-mini-w: 72px;
    --topbar-h: 64px;
    --bottomnav-h: 64px;
    --radius-sm: .5rem;
    --radius: .875rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.5rem;
    --radius-pill: 999px;

    /* Transitions */
    --trans-fast: .15s ease;
    --trans: .25s cubic-bezier(.25, .8, .25, 1);
    --trans-slow: .4s cubic-bezier(.16, 1, .3, 1);
}

[data-bs-theme="dark"] {
    --bg: #0d1117;
    --surface: #161b27;
    --surface-alt: #1e2535;
    --border: rgba(255, 255, 255, .07);
    --text: #e8ecf4;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    --shadow-xs: 0 1px 4px rgba(0, 0, 0, .25);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, .35);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, .45);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
    --primary-soft: rgba(67, 97, 238, .2);
}

/* ── 2. BASE ──────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .9375rem;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

body.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.font-outfit {
    font-family: 'Outfit', sans-serif;
}

/* ── 3. LAYOUT SHELL ──────────────────────────────────────── */
#wrapper {
    display: flex;
    min-height: 100vh;
}

#sidebar-wrapper {
    width: var(--sidebar-w);
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1040;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: width var(--trans);
    overflow: hidden;
}

#page-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
}

/* ── 4. TOPBAR ────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.topbar-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform var(--trans-fast), box-shadow var(--trans-fast);
}

.topbar-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(67, 97, 238, .3);
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--trans-fast), color var(--trans-fast);
    cursor: pointer;
    padding: 0;
}

.btn-icon:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ── 5. SIDEBAR NAV ───────────────────────────────────────── */
.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 1.1rem;
    border-bottom: 1px solid var(--border);
    gap: .75rem;
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 1rem;
}

.sidebar-brand-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .75rem .6rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar-section-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: .5rem .75rem .25rem;
    white-space: nowrap;
}

.nav-link-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-sub);
    font-size: .875rem;
    font-weight: 500;
    transition: background var(--trans-fast), color var(--trans-fast);
    margin-bottom: 2px;
    white-space: nowrap;
    position: relative;
}

.nav-link-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-link-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.nav-link-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

.nav-icon-box {
    width: 32px;
    height: 32px;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .875rem;
    transition: transform var(--trans-fast);
}

.nav-link-item:hover .nav-icon-box,
.nav-link-item.active .nav-icon-box {
    transform: scale(1.1);
}

/* Icon box color variants */
.nav-icon-primary {
    background: rgba(67, 97, 238, .12);
    color: #4361ee;
}

.nav-icon-success {
    background: rgba(16, 185, 129, .12);
    color: #10b981;
}

.nav-icon-warning {
    background: rgba(245, 158, 11, .12);
    color: #f59e0b;
}

.nav-icon-danger {
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
}

.nav-icon-info {
    background: rgba(59, 130, 246, .12);
    color: #3b82f6;
}

.nav-icon-secondary {
    background: rgba(100, 116, 139, .12);
    color: #64748b;
}

.nav-icon-dark {
    background: rgba(30, 34, 53, .1);
    color: var(--text);
}

.sidebar-footer {
    padding: .875rem .75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .5rem;
    border-radius: var(--radius-sm);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .82rem;
    flex-shrink: 0;
    object-fit: cover;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: .82rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    background: var(--bs-danger);
    color: #ffffff;
    border: none;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--trans-fast), transform var(--trans-fast);
    white-space: nowrap;
}

.btn-logout:hover {
    background: #dc3545;
    color: #ffffff;
    transform: translateY(-1px);
}

/* ── 6. BOTTOM NAV (Mobile) ───────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .08);
    z-index: 1040;
    padding: .5rem 0 env(safe-area-inset-bottom, .5rem);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: .25rem .5rem;
    text-decoration: none;
    color: var(--text-muted);
    min-width: 0;
    flex: 1;
    transition: color var(--trans-fast);
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-pill {
    width: 48px;
    height: 28px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--trans-fast);
    margin-bottom: 1px;
}

.bottom-nav-item.active .bottom-nav-pill {
    background: var(--primary-soft);
}

.bottom-nav-label {
    font-size: .65rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

/* ── 7. MAIN CONTENT ──────────────────────────────────────── */
#main-content-area {
    flex: 1;
    padding: 1.5rem;
}

@keyframes fadeSlideIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    99% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 767.98px) {
    #main-content-area {
        padding: 1rem;
        padding-bottom: calc(var(--bottomnav-h) + 1.5rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ── 8. PAGE HEADER (Hero Row) ────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.page-header-sub {
    font-size: .82rem;
    color: var(--text-muted);
    margin: .2rem 0 0;
}

.page-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

/* ── 9. CARDS ─────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--trans), box-shadow var(--trans);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-inner {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.card-header-icon {
    width: 36px;
    height: 36px;
    border-radius: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .9rem;
}

.card-header-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: .95rem;
    color: var(--text);
    margin: 0;
}

.card-header-sub {
    font-size: .72rem;
    color: var(--text-muted);
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

/* ── 10. STAT CARDS ───────────────────────────────────────── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--trans), box-shadow var(--trans);
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: .06;
    background: currentColor;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: .875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card-body {
    flex: 1;
    min-width: 0;
}

.stat-card-value {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.75rem;
    line-height: 1;
    margin-bottom: .2rem;
}

.stat-card-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* Stat card color variants */
.stat-primary .stat-card-icon {
    background: rgba(67, 97, 238, .12);
    color: #4361ee;
}

.stat-primary .stat-card-value {
    color: #4361ee;
}

.stat-success .stat-card-icon {
    background: rgba(16, 185, 129, .12);
    color: #10b981;
}

.stat-success .stat-card-value {
    color: #10b981;
}

.stat-warning .stat-card-icon {
    background: rgba(245, 158, 11, .12);
    color: #f59e0b;
}

.stat-warning .stat-card-value {
    color: #f59e0b;
}

.stat-danger .stat-card-icon {
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
}

.stat-danger .stat-card-value {
    color: #ef4444;
}

.stat-info .stat-card-icon {
    background: rgba(59, 130, 246, .12);
    color: #3b82f6;
}

.stat-info .stat-card-value {
    color: #3b82f6;
}

.stat-secondary .stat-card-icon {
    background: rgba(100, 116, 139, .12);
    color: #64748b;
}

.stat-secondary .stat-card-value {
    color: #64748b;
}

/* ── 11. TABLES ───────────────────────────────────────────── */
.table {
    color: var(--text);
    font-size: .875rem;
    margin-bottom: 0;
}

.table thead th {
    background: var(--surface-alt);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding: .875rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: .875rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background: var(--primary-soft);
}

[data-bs-theme="dark"] .table-light {
    background: var(--surface-alt) !important;
}

[data-bs-theme="dark"] .table-light th {
    background: var(--surface-alt);
}

/* ── 12. FORMS ────────────────────────────────────────────── */
.form-control,
.form-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: .6rem .9rem;
    font-size: .875rem;
    transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
}

/* Fix Bootstrap form-floating padding that was overridden by the rule above */
.form-floating>.form-control,
.form-floating>.form-select {
    height: calc(3.5rem + 2px);
    padding: 1rem .9rem;
}

.form-floating>.form-select {
    padding-top: 1.625rem;
    padding-bottom: .625rem;
}

.form-control:focus,
.form-select:focus {
    background: var(--surface);
    color: var(--text);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background: var(--surface-alt);
    border-color: var(--border);
    color: var(--text);
}

.form-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: .4rem;
}

/* ── 13. BUTTONS ──────────────────────────────────────────── */
.btn {
    font-weight: 600;
    font-size: .875rem;
    border-radius: var(--radius-sm);
    padding: .55rem 1.25rem;
    transition: transform var(--trans-fast), box-shadow var(--trans-fast), background var(--trans-fast);
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: 0 4px 14px rgba(67, 97, 238, .4);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, .35);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, .35);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
    color: #fff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, .35);
}

.btn-info {
    background: var(--info);
    color: #fff;
}

.btn-info:hover {
    background: #2563eb;
    color: #fff;
}

.btn-light {
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-light:hover {
    background: var(--border);
    color: var(--text);
}

/* Outline variants */
.btn-outline-primary {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.btn-outline-danger {
    border: 1.5px solid var(--danger);
    color: var(--danger);
    background: transparent;
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, .1);
    color: var(--danger);
}

.btn-outline-success {
    border: 1.5px solid var(--success);
    color: var(--success);
    background: transparent;
}

.btn-outline-success:hover {
    background: rgba(16, 185, 129, .1);
    color: var(--success);
}

.btn-outline-info {
    border: 1.5px solid var(--info);
    color: var(--info);
    background: transparent;
}

.btn-outline-info:hover {
    background: rgba(59, 130, 246, .1);
    color: var(--info);
}

.btn-outline-secondary {
    border: 1.5px solid var(--border);
    color: var(--text-sub);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--surface-alt);
    color: var(--text);
}

/* Size modifiers */
.btn-sm {
    padding: .38rem .875rem;
    font-size: .8rem;
}

.btn-lg {
    padding: .7rem 1.6rem;
    font-size: .95rem;
}

/* Rounded pill */
.btn-pill {
    border-radius: var(--radius-pill) !important;
}

/* ── 14. BADGES ───────────────────────────────────────────── */
.badge {
    font-size: .72rem;
    font-weight: 600;
    padding: .3em .7em;
    border-radius: .4rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.badge.rounded-pill {
    border-radius: var(--radius-pill);
}

/* ── 15. MODALS ───────────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.1rem 1.4rem .9rem;
}

.modal-header .modal-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text);
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: .875rem 1.4rem;
}

.modal-body {
    padding: 1.25rem 1.4rem;
}

/* ── 16. ALERTS ───────────────────────────────────────────── */
.alert {
    border: none;
    border-radius: var(--radius);
    padding: .875rem 1.25rem;
    font-size: .875rem;
}

/* ── 17. PROGRESS ─────────────────────────────────────────── */
.progress {
    border-radius: var(--radius-pill);
    background: var(--surface-alt);
    height: 8px;
}

.progress-bar {
    border-radius: var(--radius-pill);
}

/* ── 18. UTILITIES ────────────────────────────────────────── */
.rounded-4 {
    border-radius: var(--radius-lg) !important;
}

.rounded-3 {
    border-radius: var(--radius) !important;
}

.shadow-xs {
    box-shadow: var(--shadow-xs) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

.bg-soft {
    background-color: var(--bg) !important;
}

.bg-surface {
    background-color: var(--surface) !important;
}

.text-main {
    color: var(--text) !important;
}

.text-sub {
    color: var(--text-sub) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Dark mode overrides */
[data-bs-theme="dark"] .bg-white {
    background: var(--surface) !important;
}

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

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

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-end {
    border-color: var(--border) !important;
}

[data-bs-theme="dark"] .card-header {
    background: var(--surface-alt) !important;
}

[data-bs-theme="dark"] .modal-content {
    background: var(--surface);
}

.hover-lift {
    transition: transform var(--trans), box-shadow var(--trans);
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md) !important;
}

.transition-all {
    transition: all var(--trans);
}

/* Glassmorphism */
.glassmorphism {
    background: rgba(255, 255, 255, .85) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .25) !important;
}

[data-bs-theme="dark"] .glassmorphism {
    background: rgba(22, 27, 39, .85) !important;
    border-color: rgba(255, 255, 255, .07) !important;
}

.bg-white\/80 {
    background: rgba(255, 255, 255, .8) !important;
}

/* Page loader */
.page-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

/* ── 19. SELECT2 OVERRIDE ─────────────────────────────────── */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    min-height: calc(1.5em + 1.2rem + 2px);
    padding: .4rem .75rem;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection,
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown,
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-search__field {
    background: var(--surface-alt);
    border-color: var(--border);
    color: var(--text);
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option {
    color: var(--text);
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: var(--primary);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: var(--text);
    line-height: 1.5;
}

/* ── 20. DATATABLES OVERRIDE ──────────────────────────────── */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: .35rem .75rem;
    font-size: .82rem;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    color: var(--text-muted);
    font-size: .8rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: .4rem !important;
    font-size: .8rem !important;
    color: var(--text-sub) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background: var(--surface-alt);
    border-color: var(--border);
    color: var(--text);
}

/* ── 21. RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 767.98px) {
    #sidebar-wrapper {
        display: none !important;
    }

    .topbar {
        padding: 0 1rem;
    }

    .topbar-title {
        font-size: .95rem;
    }

    #main-content-area {
        padding: .875rem .875rem calc(var(--bottomnav-h) + 1.25rem + env(safe-area-inset-bottom, 0px));
    }

    .stat-card {
        padding: .875rem 1rem;
    }

    .stat-card-value {
        font-size: 1.4rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: .875rem 1rem;
    }

    .page-header-title {
        font-size: 1.1rem;
    }
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none !important;
    }
}

/* ── 22. MISC COMPONENTS ──────────────────────────────────── */
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
    flex-shrink: 0;
}

.table-row-new {
    animation: fadeSlideIn .5s ease-in-out;
    background: rgba(16, 185, 129, .04) !important;
}

/* Offcanvas */
.offcanvas {
    background: var(--surface);
}

.offcanvas-header {
    border-bottom: 1px solid var(--border);
}

/* Input group */
.input-group-text {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-sub);
    border-radius: var(--radius-sm);
}

/* Dropdown */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    background: var(--surface);
    font-size: .875rem;
}

.dropdown-item {
    color: var(--text);
    border-radius: .35rem;
}

.dropdown-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

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

/* ── 23. ANDROID-LIKE UI ENHANCEMENTS ─────────────────────── */
/* Floating Action Button (FAB) */
.fab-container {
    position: fixed;
    bottom: calc(var(--bottomnav-h) + 1.5rem + env(safe-area-inset-bottom, 0px));
    right: 1.5rem;
    z-index: 1030;
    display: none;
    /* Only visible on mobile */
}

@media (max-width: 767.98px) {
    .fab-container {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: .5rem;
    }

    .btn-fab-hide-mobile {
        display: none !important;
    }
}

.btn-fab {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.btn-fab:hover,
.btn-fab:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
    background: var(--primary-hover);
    color: #fff;
}

/* Mobile Bottom Sheet Modal */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0 !important;
        display: flex;
        align-items: flex-end;
        min-height: 100%;
        padding-top: 2rem;
        /* space from top */
    }

    .modal-content {
        border-radius: 1.5rem 1.5rem 0 0 !important;
        border: none;
        border-bottom: none;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        width: 100%;
    }

    .modal.fade .modal-dialog {
        transform: translate(0, 100%) !important;
        transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1) !important;
    }

    .modal.show .modal-dialog {
        transform: translate(0, 0) !important;
    }

    .modal-header {
        border-bottom: none !important;
        padding: 1.5rem 1.5rem 0.5rem !important;
        position: relative;
    }

    .modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }

    /* Ensure symmetry for card body on mobile */
    .card-body {
        padding: 1rem !important;
    }
}

/* Responsive Card List for Tables on Mobile */
@media (max-width: 767.98px) {
    .table-responsive-cards {
        border: none !important;
    }

    .table-responsive-cards thead {
        display: none;
    }

    .table-responsive-cards table,
    .table-responsive-cards tbody,
    .table-responsive-cards tr,
    .table-responsive-cards td {
        display: block;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .table-responsive-cards table {
        margin: 0 auto !important;
    }

    .table-responsive-cards tr {
        background: var(--surface) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius) !important;
        margin: 0 auto 1rem !important;
        padding: 0.5rem 1rem !important;
        box-shadow: var(--shadow-sm);
        box-sizing: border-box !important;
    }

    [data-bs-theme="dark"] .table-responsive-cards tr {
        background: var(--surface-alt) !important;
    }

    .table-responsive-cards td {
        padding: 0.5rem 0;
        border: none !important;
        border-bottom: 1px dashed var(--border) !important;
        text-align: right;
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
        min-height: 40px;
    }

    .table-responsive-cards td:last-child {
        border-bottom: none !important;
    }

    .table-responsive-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.8rem;
        color: var(--text-sub);
        text-align: left;
        margin-right: auto;
        padding-right: 1rem;
    }

    /* Hide specific dataTables elements that don't fit well */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_info {
        display: none !important;
    }

    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
        margin-bottom: 1rem;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .dataTables_wrapper .dataTables_paginate {
        text-align: center !important;
        margin-top: 1rem;
    }
}

/* Modern App UI Header (Global) */
.app-page-header {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    padding: 2rem 1.5rem 3.5rem;
    border-radius: 0 0 2rem 2rem;
    margin: -1.5rem -1.5rem 0;
    box-shadow: 0 10px 30px rgba(67, 97, 238, 0.2);
    position: relative;
    overflow: hidden;
}

.app-page-header::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.app-page-header::before {
    content: '';
    position: absolute;
    left: -30px;
    bottom: -30px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.app-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    position: relative;
    z-index: 2;
    color: white;
}

.app-page-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    position: relative;
    z-index: 2;
    color: white;
}

.app-card-overlap {
    margin-top: -2.5rem;
    position: relative;
    z-index: 3;
}

/* -- CUSTOM FORM FLOATING ICON -------------------------------- */
.form-floating-icon {
    position: relative;
}

.form-floating-icon .icon-prefix {
    position: absolute;
    top: 50%;
    left: 1.25rem;
    transform: translateY(-50%);
    z-index: 5;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: all var(--trans);
}

.form-floating-icon .form-control,
.form-floating-icon .form-select {
    padding-left: 3.2rem !important;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: none;
    transition: all var(--trans);
}

.form-floating-icon .form-select {
    padding-top: 1.625rem !important;
    padding-bottom: 0.625rem !important;
}

.form-floating-icon>.form-select~label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

.form-floating-icon label {
    padding-left: 3.2rem !important;
}

.form-floating-icon .form-control:focus,
.form-floating-icon .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-floating-icon .form-control:focus~.icon-prefix,
.form-floating-icon .form-select:focus~.icon-prefix {
    color: var(--primary);
}

/* -- CUSTOM BUTTON OUTLINES -------------------------------- */
.btn-outline-warning {
    border: 1px solid #ffc107;
    color: #ffc107;
    background-color: transparent;
}

.btn-outline-warning:hover {
    background-color: #ffc107;
    color: #000;
}

.btn-outline-danger {
    border: 1px solid #dc3545;
    color: #dc3545;
    background-color: transparent;
}

.btn-outline-danger:hover {
    background-color: #dc3545;
    color: #fff;
}

/* ── Hak Akses Toggle Card ─────────────────────────────── */
.hover-toggle-card:hover {
    background: var(--primary-soft) !important;
    border-color: var(--primary) !important;
}
.hover-toggle-card:has(input:checked) {
    background: var(--primary-soft) !important;
    border-color: var(--primary) !important;
}
.form-check.form-switch .form-check-input {
    margin-top: 0;
}