/* =========================================================
   SIMONCI - Sistem Monitoring CCTV RSUD Ploso
   Tema: Kuning Hangat (Warm Yellow)
   ========================================================= */

:root {
    --warm-50:  #fffbeb;
    --warm-100: #fff3d6;
    --warm-200: #ffe4a3;
    --warm-300: #ffd166;
    --warm-400: #fbb03b;
    --warm-500: #f5a623;
    --warm-600: #e08e0b;
    --warm-700: #b8720a;
    --warm-800: #8a5608;
    --ink-900:  #3a2c1a;
    --ink-700:  #5c4a33;
    --ink-500:  #8a7861;
    --danger:   #d64545;
    --danger-bg:#fdecec;
    --safe:     #2f9e5c;
    --safe-bg:  #e8f7ef;
    --radius:   14px;
    --shadow:   0 4px 18px rgba(180, 130, 20, 0.12);
}

* { box-sizing: border-box; }

body {
    font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(180deg, var(--warm-50) 0%, #fffefb 260px);
    color: var(--ink-900);
    min-height: 100vh;
}

a { text-decoration: none; }

/* ---------- Topbar ---------- */
.topbar {
    background: linear-gradient(135deg, var(--warm-500), var(--warm-400));
    box-shadow: var(--shadow);
    padding: .6rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    font-weight: 800;
    letter-spacing: .3px;
}

.topbar .brand img {
    height: 38px;
    width: 38px;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
    padding: 3px;
}

.topbar .brand small {
    display: block;
    font-weight: 500;
    font-size: .72rem;
    opacity: .92;
}

.btn-toggle-sidebar {
    border: none;
    background: rgba(255,255,255,.25);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.2rem;
}

.topbar .user-chip {
    background: rgba(255,255,255,.22);
    color: #fff;
    padding: .35rem .8rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.topbar .user-chip .role-tag {
    background: rgba(0,0,0,.18);
    padding: .1rem .5rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* ---------- Layout ---------- */
.app-wrapper {
    display: flex;
    min-height: calc(100vh - 62px);
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--warm-200);
    padding: 1rem .75rem;
    transition: margin-left .25s ease;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: var(--ink-700);
    font-weight: 700;
    padding: .65rem .9rem;
    border-radius: 10px;
    margin-bottom: .25rem;
    font-size: .93rem;
}

.sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; color: var(--warm-600); }

.sidebar .nav-link:hover { background: var(--warm-50); }

.sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--warm-500), var(--warm-400));
    color: #fff;
}
.sidebar .nav-link.active i { color: #fff; }

.sidebar .nav-section-title {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-500);
    font-weight: 800;
    margin: 1rem .8rem .35rem;
}

.main-content {
    flex-grow: 1;
    padding: 1.25rem 1.4rem 3rem;
    min-width: 0;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--ink-900);
    margin: 0;
}

.page-header p {
    color: var(--ink-500);
    margin: .15rem 0 0;
    font-size: .88rem;
}

/* ---------- Cards ---------- */
.card-warm {
    background: #fff;
    border: 1px solid var(--warm-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-warm .card-header {
    background: var(--warm-50);
    border-bottom: 1px solid var(--warm-200);
    border-radius: var(--radius) var(--radius) 0 0 !important;
    font-weight: 800;
    color: var(--ink-900);
}

.stat-card {
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    color: #fff;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat-card i.bg-icon {
    position: absolute;
    right: -10px;
    bottom: -12px;
    font-size: 4.2rem;
    opacity: .18;
}
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: .82rem; opacity: .92; font-weight: 700; margin-top: .3rem;}

.stat-card.warm  { background: linear-gradient(135deg, var(--warm-500), var(--warm-400)); }
.stat-card.gold  { background: linear-gradient(135deg, #f7b733, #ffd166); }
.stat-card.danger{ background: linear-gradient(135deg, #e2604f, #f28b6a); }
.stat-card.safe  { background: linear-gradient(135deg, #2f9e5c, #57c288); }

/* ---------- Buttons ---------- */
.btn-warm {
    background: linear-gradient(135deg, var(--warm-500), var(--warm-400));
    border: none;
    color: #fff;
    font-weight: 700;
    border-radius: 10px;
    padding: .5rem 1.1rem;
}
.btn-warm:hover { color: #fff; filter: brightness(1.05); }
.btn-outline-warm {
    border: 1.5px solid var(--warm-500);
    color: var(--warm-700);
    background: #fff;
    font-weight: 700;
    border-radius: 10px;
}
.btn-outline-warm:hover { background: var(--warm-50); color: var(--warm-800); }

/* ---------- Tables ---------- */
.table-warm thead th {
    background: var(--warm-100);
    color: var(--ink-900);
    font-weight: 800;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    border-bottom: none;
    white-space: nowrap;
}
.table-warm tbody tr:hover { background: var(--warm-50); }
.table-warm td { vertical-align: middle; font-size: .9rem; }

/* ---------- Badges ---------- */
.badge-kondisi {
    padding: .3rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}
.badge-aman { background: var(--safe-bg); color: var(--safe); }
.badge-tidak-aman { background: var(--danger-bg); color: var(--danger); }

.badge-role-admin { background:#8a5608; color:#fff; padding:.2rem .55rem;border-radius:999px;font-size:.7rem;font-weight:800;}
.badge-role-petugas { background:#6b7b8c; color:#fff; padding:.2rem .55rem;border-radius:999px;font-size:.7rem;font-weight:800;}

/* ---------- Location entry row (form entri) ---------- */
.lokasi-item {
    border: 1px solid var(--warm-200);
    border-radius: 12px;
    padding: .9rem 1rem;
    margin-bottom: .7rem;
    background: #fffdf8;
}
.lokasi-item.is-tidak-aman { border-color: #f3b8b0; background: #fff7f5; }
.lokasi-item .lokasi-title {
    font-weight: 800;
    color: var(--ink-900);
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.lokasi-item .lokasi-title .no-badge {
    background: var(--warm-500);
    color: #fff;
    font-size: .72rem;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}
.kondisi-toggle .btn-check + label {
    border-radius: 10px !important;
    font-weight: 700;
}
.detail-wrap { display: none; margin-top: .6rem; }
.detail-wrap.show { display: block; }

/* ---------- Login page ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, var(--warm-200), var(--warm-50) 55%);
    padding: 1rem;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(180,130,20,.22);
    max-width: 400px;
    width: 100%;
    padding: 2.1rem 1.9rem;
}
.login-card img.logo { height: 74px; margin-bottom: .5rem; }
.login-card h1 { font-size: 1.3rem; font-weight: 800; margin-bottom: .1rem; }
.login-card p.subtitle { color: var(--ink-500); font-size: .87rem; margin-bottom: 1.4rem; }

/* ---------- Misc ---------- */
.filter-bar { background:#fff; border:1px solid var(--warm-200); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom:1.1rem;}
footer.app-footer { text-align:center; color: var(--ink-500); font-size:.8rem; padding: 1.5rem 0 .5rem; }

.form-label { font-weight: 700; color: var(--ink-900); font-size: .87rem; }
.form-control:focus, .form-select:focus { border-color: var(--warm-400); box-shadow: 0 0 0 .2rem rgba(245,166,35,.18); }

/* ---------- Tabel Pivot (Laporan Harian & Bulanan) ---------- */
.table-pivot { font-size: .85rem; }
.table-pivot th, .table-pivot td { text-align: center; vertical-align: middle; }
.table-pivot td.lokasi-cell { text-align: left; font-weight: 700; }
.table-pivot thead th.shift-head-1 { background: var(--warm-200); border-left: 2px solid var(--warm-500); }
.table-pivot thead th.shift-head-2 { background: #ffe9c2; border-left: 2px solid var(--warm-500); }
.table-pivot thead th.shift-head-3 { background: #ffdfa8; border-left: 2px solid var(--warm-500); }
.table-pivot td.col-group-start { border-left: 2px solid var(--warm-300); }
.table-pivot .cell-kosong { color: var(--ink-500); font-style: italic; font-size: .8rem; }
.shift-info-chip {
    background: var(--warm-50);
    border: 1px solid var(--warm-200);
    border-radius: 10px;
    padding: .5rem .8rem;
    font-size: .82rem;
}
.shift-info-chip .label { font-weight: 800; color: var(--warm-700); }

/* ---------- Mobile responsive ---------- */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0; top: 62px; bottom: 0;
        z-index: 1025;
        margin-left: -260px;
        overflow-y: auto;
        box-shadow: 6px 0 18px rgba(0,0,0,.08);
    }
    .sidebar.open { margin-left: 0; }
    .main-content { padding: 1rem .8rem 2.5rem; }
    .page-header h1 { font-size: 1.2rem; }
    .sidebar-backdrop {
        display: none;
        position: fixed; inset: 62px 0 0 0;
        background: rgba(30,20,5,.35);
        z-index: 1020;
    }
    .sidebar-backdrop.show { display: block; }
}

@media (max-width: 575.98px) {
    .stat-card .stat-value { font-size: 1.55rem; }
    .topbar .brand small { display:none; }
    .login-card { padding: 1.6rem 1.3rem; }
}

/* ---------- Print ---------- */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .print-area { padding: 0; }
}
