/* =====================================================================
   Monitoring Gedung — Stylesheet
   Bootstrap 5 + custom modern admin dashboard, dark mode, responsive.
   ===================================================================== */

:root {
    --brand: #2563eb;
    --brand-dark: #1e40af;
    --brand-soft: #e0ecff;
    --grad-1: #2563eb;
    --grad-2: #4f46e5;
    --radius: 16px;
    --shadow-soft: 0 6px 24px rgba(15, 23, 42, .08);
    --bg-body: #f1f5f9;
    --card-bg: #ffffff;
}

[data-bs-theme="dark"] {
    --bg-body: #0b1120;
    --card-bg: #131c31;
    --brand-soft: #1e2a4a;
    --shadow-soft: 0 6px 24px rgba(0, 0, 0, .35);
}

body {
    background: var(--bg-body);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
    transition: background-color .25s ease;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
}

/* ----------------------- Navbar ----------------------- */
.app-navbar {
    background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
}
.app-navbar .navbar-brand,
.app-navbar .nav-link {
    color: rgba(255, 255, 255, .92) !important;
}
.app-navbar .nav-link.active,
.app-navbar .nav-link:hover {
    color: #fff !important;
}
.app-navbar .nav-link.active {
    font-weight: 600;
    border-bottom: 2px solid #fff;
}
.brand-logo {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .2);
    border-radius: 10px;
    font-size: 1.15rem;
}
.btn-light-soft {
    background: rgba(255, 255, 255, .18);
    color: #fff;
    border: none;
}
.btn-light-soft:hover { background: rgba(255, 255, 255, .3); color: #fff; }
.navbar-toggler { color: #fff; }

/* ----------------------- Cards & layout ----------------------- */
.card {
    border-radius: var(--radius);
    background: var(--card-bg);
}
.filter-card { border-radius: var(--radius); }
.form-label-sm {
    font-size: .78rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: .2rem;
}
[data-bs-theme="dark"] .form-label-sm { color: #94a3b8; }

.badge.bg-primary-soft {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
    padding: .5rem .75rem;
    border-radius: 999px;
}
.btn-primary-soft {
    background: var(--brand-soft);
    color: var(--brand);
    border: none;
    font-weight: 600;
}
.btn-primary-soft:hover { background: var(--brand); color: #fff; }
.btn-danger-soft {
    background: #fee2e2; color: #dc2626; border: none;
}
.btn-danger-soft:hover { background: #dc2626; color: #fff; }
[data-bs-theme="dark"] .btn-danger-soft { background: #3b1d1d; }

/* ----------------------- Status badges ----------------------- */
.status-badge {
    display: inline-block;
    padding: .35rem .7rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-terisi { background: #dcfce7; color: #16a34a; }
.status-kosong { background: #fee2e2; color: #dc2626; }
.status-ruang  { background: #fef3c7; color: #d97706; }
[data-bs-theme="dark"] .status-terisi { background: #14331f; color: #4ade80; }
[data-bs-theme="dark"] .status-kosong { background: #3b1d1d; color: #f87171; }
[data-bs-theme="dark"] .status-ruang  { background: #3a2e10; color: #fbbf24; }

/* ----------------------- DataTables tweaks ----------------------- */
table#dataTable thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #64748b;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #fff !important;
    border-radius: 8px;
}
.btn-edit {
    border-radius: 10px;
}

/* ----------------------- Mobile card layout ----------------------- */
.gedung-card {
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
    margin-bottom: .85rem;
    border: 1px solid rgba(148, 163, 184, .15);
}
.gedung-card .gc-title { font-weight: 700; font-size: 1rem; }
.gedung-card .gc-sub { font-size: .8rem; color: #64748b; }
.gedung-card .gc-meta { font-size: .8rem; }
.gedung-card .btn-edit { width: 100%; margin-top: .65rem; padding: .6rem; font-weight: 600; }
.gc-row { display: flex; justify-content: space-between; gap: .5rem; margin-top: .35rem; }

/* ----------------------- Modal / edit form ----------------------- */
.gradient-header {
    background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
}
.info-card {
    background: var(--brand-soft);
    border-radius: 12px;
    padding: 1rem;
}
[data-bs-theme="dark"] .info-card { background: #182238; }
.info-card-title { font-weight: 700; margin-bottom: .75rem; color: var(--brand); }
.form-control-readonly {
    background: rgba(255, 255, 255, .65);
    font-weight: 500;
}
[data-bs-theme="dark"] .form-control-readonly { background: rgba(255, 255, 255, .05); }

/* Baris tenant memakai Bootstrap grid (.row); jangan override display/flex. */
.tenant-row {
    background: rgba(148, 163, 184, .08);
    border-radius: 12px;
    padding: .5rem .6rem;
    margin-left: 0;
    margin-right: 0;
}

.sticky-footer {
    position: sticky;
    bottom: 0;
    background: var(--card-bg);
    z-index: 5;
}
.btn-save { min-width: 120px; }

/* ----------------------- KPI cards ----------------------- */
.kpi-card {
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-soft);
    height: 100%;
}
.kpi-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, .2);
    flex-shrink: 0;
}
.kpi-label { font-size: .8rem; opacity: .9; }
.kpi-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.kpi-blue   { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.kpi-orange { background: linear-gradient(135deg, #ea580c, #f97316); }
.kpi-green  { background: linear-gradient(135deg, #16a34a, #22c55e); }
.kpi-purple { background: linear-gradient(135deg, #7c3aed, #a855f7); }

/* ----------------------- Charts & pivot ----------------------- */
.chart-card { border-radius: var(--radius); }
.chart-title { font-weight: 700; color: #334155; }
[data-bs-theme="dark"] .chart-title { color: #e2e8f0; }
.pivot-table tfoot td { font-weight: 700; border-top: 2px solid rgba(148,163,184,.3); }
.progress-thin { height: 8px; border-radius: 999px; }

/* ----------------------- Skeleton loading ----------------------- */
.skeleton-row {
    height: 54px;
    border-radius: 12px;
    margin-bottom: .6rem;
    background: linear-gradient(90deg,
        rgba(148,163,184,.12) 25%,
        rgba(148,163,184,.25) 37%,
        rgba(148,163,184,.12) 63%);
    background-size: 400% 100%;
    animation: skeleton 1.3s ease infinite;
}
@keyframes skeleton {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ----------------------- Misc ----------------------- */
.app-footer {
    background: var(--card-bg);
    border-top: 1px solid rgba(148, 163, 184, .15);
}
.sticky-filter-toggle { text-align: left; }

/* Responsive font scaling */
@media (max-width: 575.98px) {
    .page-title { font-size: 1.15rem; }
    .kpi-value { font-size: 1.35rem; }
    .kpi-card { padding: .85rem; gap: .7rem; }
    .kpi-icon { width: 42px; height: 42px; font-size: 1.2rem; }
}

/* Landscape phones: keep KPI in a row, compress vertical space */
@media (max-height: 480px) and (orientation: landscape) {
    .kpi-card { padding: .6rem .8rem; }
    .kpi-value { font-size: 1.2rem; }
    .navbar { padding-top: .25rem; padding-bottom: .25rem; }
}

/* ----------------------- Modal edit: scroll & sticky footer ----------------------- */
#editModal .modal-content {
    max-height: 95vh;
    border-radius: 18px;
    overflow: hidden;
}
#editModal .modal-body {
    overflow-y: auto;
    max-height: calc(95vh - 140px);
    padding-bottom: 120px;
}
#editModal .modal-header {
    position: sticky;
    top: 0;
    z-index: 20;
    /* Background sengaja tidak di-set agar gradient (.gradient-header) tetap tampil. */
}
#editModal .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: var(--card-bg);
    border-top: 1px solid rgba(148, 163, 184, .25);
}

@media (max-width: 768px) {
    #editModal .modal-dialog {
        margin: 0;
    }
    #editModal .modal-content {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    #editModal .modal-body {
        max-height: calc(100vh - 130px);
    }
}
