/* ==========================================================================
   HRIS Amalina (Amalina Islamic School) — tema dashboard (Bootstrap 5.3)
   ========================================================================== */

:root {
    --hr-sidebar-width: 264px;
    --hr-sidebar-mini: 76px;
    /* Sidebar biru: teks putih di atas biru tua (kontras ≥ 7:1) */
    --hr-sidebar-bg: #1e40af;
    --hr-sidebar-bg-gradient: linear-gradient(180deg, #1e3a8a 0%, #1e40af 55%, #1d4ed8 100%);
    --hr-sidebar-text: #ffffff;
    --hr-sidebar-icon: #dbeafe;
    --hr-sidebar-muted: #bfdbfe;      /* label seksi */
    --hr-sidebar-hover: rgba(255, 255, 255, .14);
    --hr-sidebar-active-bg: #ffffff;
    --hr-sidebar-active-text: #1e3a8a;
    --hr-accent: #2563eb;
    --hr-body-bg: #f1f5f9;
    --hr-card-border: #e2e8f0;
    --hr-heading: #0f172a;
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: #334155;
    --bs-border-radius: .55rem;
}

body {
    background: var(--hr-body-bg);
    font-size: .925rem;
}

h1, h2, h3, h4, h5, h6, .h-heading { color: var(--hr-heading); font-weight: 700; }
a { text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--hr-accent); --bs-btn-border-color: var(--hr-accent); --bs-btn-hover-bg: #1d4ed8; --bs-btn-hover-border-color: #1d4ed8; }
.text-primary { color: var(--hr-accent) !important; }
.bg-primary { background-color: var(--hr-accent) !important; }

/* ---------------------------------------------------------------- Layout */
.app-wrapper { min-height: 100vh; }

/* !important: Bootstrap 5.3 membuat .offcanvas-lg transparan pada layar ≥ 992px */
.app-sidebar,
.app-sidebar.offcanvas-lg {
    width: var(--hr-sidebar-width);
    background-color: var(--hr-sidebar-bg) !important;
    background-image: var(--hr-sidebar-bg-gradient) !important;
    color: var(--hr-sidebar-text);
}

@media (min-width: 992px) {
    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1030;
        transition: width .2s ease;
    }
    .app-main { margin-left: var(--hr-sidebar-width); transition: margin-left .2s ease; }

    body.sidebar-mini .app-sidebar { width: var(--hr-sidebar-mini); }
    body.sidebar-mini .app-main { margin-left: var(--hr-sidebar-mini); }
    body.sidebar-mini .app-sidebar .nav-text,
    body.sidebar-mini .app-sidebar .nav-section,
    body.sidebar-mini .app-sidebar .brand-text,
    body.sidebar-mini .app-sidebar .sidebar-period,
    body.sidebar-mini .app-sidebar .nav-badge { display: none !important; }
    body.sidebar-mini .app-sidebar .nav-link { justify-content: center; }
}

@media (max-width: 991.98px) {
    .app-sidebar.offcanvas-lg { --bs-offcanvas-width: var(--hr-sidebar-width); }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .18);
}
.brand-logo {
    width: 38px; height: 38px;
    border-radius: .6rem;
    background: #ffffff;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
    display: grid; place-items: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.slip-logo { width: 56px; height: 56px; object-fit: contain; }
.brand-text strong { display: block; color: #fff; font-size: .98rem; line-height: 1.2; }
.brand-text small { color: #dbeafe; font-size: .75rem; }

.sidebar-period {
    margin: .9rem 1rem .25rem;
    padding: .55rem .75rem;
    border-radius: .5rem;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .28);
    color: #ffffff;
    font-size: .76rem;
}

.sidebar-nav { overflow-y: auto; padding: .5rem .75rem 2rem; flex: 1; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .35); border-radius: 3px; }

.nav-section {
    color: var(--hr-sidebar-muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    padding: 1.1rem .75rem .4rem;
    border-top: 1px solid rgba(255, 255, 255, .18);
    margin-top: .35rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--hr-sidebar-text);
    padding: .55rem .75rem;
    border-radius: .5rem;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: 2px;
    border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; color: var(--hr-sidebar-icon); }
.sidebar-nav .nav-link:hover { background: var(--hr-sidebar-hover); color: #fff; border-left-color: #ffffff; }
.sidebar-nav .nav-link:hover i { color: #fff; }
.sidebar-nav .nav-link.active { background: var(--hr-sidebar-active-bg); color: var(--hr-sidebar-active-text); font-weight: 700; border-left-color: #93c5fd; box-shadow: 0 2px 8px rgba(15, 23, 42, .25); }
.sidebar-nav .nav-link.active i { color: var(--hr-sidebar-active-text); }
.app-sidebar .nav-badge { color: #1e293b; }
.app-sidebar .btn-close-white { opacity: .9; }
.sidebar-nav .nav-link:focus-visible { outline: 2px solid #ffffff; outline-offset: 1px; }
.nav-badge { margin-left: auto; font-size: .7rem; }

/* ---------------------------------------------------------------- Navbar */
.app-navbar {
    background: #fff;
    border-bottom: 1px solid var(--hr-card-border);
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: 64px;
}
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 700;
    font-size: .8rem;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    object-fit: cover;
}
.avatar-lg { width: 88px; height: 88px; font-size: 1.6rem; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }

.app-content { padding: 1.5rem; }
@media (max-width: 575.98px) { .app-content { padding: 1rem .75rem; } }

.app-footer { padding: 1rem 1.5rem; color: #94a3b8; font-size: .8rem; }

/* ---------------------------------------------------------------- Cards */
.card {
    border: 1px solid var(--hr-card-border);
    border-radius: .75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--hr-card-border);
    padding: .9rem 1.25rem;
    font-weight: 600;
    color: var(--hr-heading);
}
.card-header:first-child { border-radius: .75rem .75rem 0 0; }

.stat-card { position: relative; overflow: hidden; height: 100%; }
.stat-card .stat-icon {
    width: 46px; height: 46px;
    border-radius: .65rem;
    display: grid; place-items: center;
    font-size: 1.3rem;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; color: var(--hr-heading); line-height: 1.1; }
.stat-card .stat-label { font-size: .8rem; color: #64748b; font-weight: 500; }

.bg-soft-primary { background: #dbeafe; color: #1d4ed8; }
.bg-soft-success { background: #dcfce7; color: #15803d; }
.bg-soft-warning { background: #fef3c7; color: #b45309; }
.bg-soft-danger { background: #fee2e2; color: #b91c1c; }
.bg-soft-info { background: #e0f2fe; color: #0369a1; }
.bg-soft-secondary { background: #f1f5f9; color: #475569; }
.bg-soft-dark { background: #e2e8f0; color: #0f172a; }
.bg-soft-orange { background: #ffedd5; color: #c2410c; }
.text-orange { color: #ea580c !important; }
.bg-orange { background-color: #ea580c !important; }

/* ---------------------------------------------------------------- Tables */
.table { --bs-table-color: #334155; margin-bottom: 0; }
.table > thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
    border-bottom-width: 1px;
    white-space: nowrap;
}
.table > :not(caption) > * > * { padding: .7rem .85rem; vertical-align: middle; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8fafc; }

.page-header { margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.4rem; margin-bottom: .15rem; }
.breadcrumb { font-size: .8rem; margin-bottom: .35rem; }

.form-label { font-weight: 600; font-size: .83rem; color: #334155; }
.form-control, .form-select { border-color: #cbd5e1; }
.form-control:focus, .form-select:focus { border-color: #93c5fd; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.required::after { content: " *"; color: #dc2626; }

.nav-tabs .nav-link { color: #64748b; font-weight: 600; font-size: .875rem; }
.nav-tabs .nav-link.active { color: var(--hr-accent); }
.nav-scroll { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.nav-scroll .nav-link { white-space: nowrap; }

.filter-bar { background: #fff; border: 1px solid var(--hr-card-border); border-radius: .75rem; padding: 1rem; margin-bottom: 1rem; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: #94a3b8; }
.empty-state i { font-size: 2.4rem; display: block; margin-bottom: .5rem; }

.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.75rem; }
.timeline li::before { content: ""; position: absolute; left: .45rem; top: .4rem; bottom: -.2rem; width: 2px; background: #e2e8f0; }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: .2rem; width: 1rem; height: 1rem; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; }

.progress-thin { height: 6px; }
.dl-grid dt { font-weight: 500; color: #64748b; font-size: .82rem; }
.dl-grid dd { font-weight: 600; color: #0f172a; margin-bottom: .75rem; }

/* ---------------------------------------------------------------- Absensi */
.attendance-clock { font-size: 2.6rem; font-weight: 800; color: var(--hr-heading); letter-spacing: .02em; }
.camera-box {
    position: relative;
    background: #0f172a;
    border-radius: .75rem;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    max-height: 420px;
    margin: 0 auto;
}
.camera-box video, .camera-box img, .camera-box canvas { width: 100%; height: 100%; object-fit: cover; }
.camera-box video { transform: scaleX(-1); }
.camera-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #64748b; text-align: center; padding: 1rem; }
.selfie-thumb { width: 100%; max-width: 220px; border-radius: .5rem; border: 1px solid var(--hr-card-border); }

/* ---------------------------------------------------------------- Login */
.auth-page { min-height: 100vh; display: flex; }
.auth-side {
    background: linear-gradient(160deg, #0f172a 0%, #1e3a8a 100%);
    color: #e2e8f0;
}
.auth-side h2 { color: #fff; }

/* ---------------------------------------------------------------- Cetak */
@media print {
    .app-sidebar, .app-navbar, .app-footer, .no-print, .alert { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff; }
    .card { border: none; box-shadow: none; }
}
