/* ============================================================
   Panel Monitoring Tim Sosmed — Custom CSS
   ============================================================ */

/* ── Root Variables ──────────────────────────────────────── */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: #1a1d23;
    --sidebar-border: rgba(255,255,255,.08);
    --sidebar-link-hover: rgba(255,255,255,.07);
    --sidebar-link-active-bg: rgba(13,110,253,.25);
    --sidebar-link-active-color: #5b9cff;
    --topbar-height: 60px;
    --transition: .22s ease;
}

/* ── Base ─────────────────────────────────────────────────── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .9rem;
    background: #f4f6f9;
    color: #333;
}

/* ── Login Page ───────────────────────────────────────────── */
body.login-page {
    background: url(https://i.imgur.com/jehPthr.jpeg) center center / cover no-repeat fixed;
    min-height: 100vh;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(to bottom, #470000 0%, #ff0000 50%, #470000 100%);
    color: white;
    padding: 2rem 1.5rem 1.5rem;
}

.login-header h4, .login-header p { color: white; }

/* ── Layout Wrapper ──────────────────────────────────────── */
#wrapper {
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    transition: width var(--transition), min-width var(--transition);
    overflow: hidden;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}

#sidebar.collapsed .brand-text,
#sidebar.collapsed .sidebar-section-title,
#sidebar.collapsed .sidebar-link span {
    display: none;
}

#sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: .65rem .5rem;
}

#sidebar.collapsed .sidebar-link i {
    font-size: 1.25rem;
    margin: 0;
}

.sidebar-brand {
    height: 70px;
}

.sidebar-brand .brand-icon {
    flex-shrink: 0;
}

.sidebar-section-title {
    font-size: .68rem;
    letter-spacing: .07em;
    color: rgba(255,255,255,.35) !important;
    margin-top: .25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem 1rem;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .85rem;
    transition: background var(--transition), color var(--transition);
    border-radius: 0;
    white-space: nowrap;
}

.sidebar-link:hover {
    background: var(--sidebar-link-hover);
    color: rgba(255,255,255,.9);
}

.sidebar-link.active {
    background: var(--sidebar-link-active-bg);
    color: var(--sidebar-link-active-color);
    border-left: 3px solid var(--sidebar-link-active-color);
}

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

/* ── Page Content ────────────────────────────────────────── */
#page-content-wrapper {
    min-width: 0;
    transition: all var(--transition);
}

/* ── Avatar ──────────────────────────────────────────────── */
.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .75rem;
    background: #0d6efd;
    color: white;
    flex-shrink: 0;
}

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card .card-body {
    padding: 1.1rem 1.25rem;
}

.stat-label {
    font-size: .75rem;
    color: #6c757d;
    margin-bottom: .25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: #212529;
}

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

/* ── Cards ───────────────────────────────────────────────── */
.card {
    border-radius: 12px;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
}

/* ── Tables ──────────────────────────────────────────────── */
.table > :not(caption) > * > * {
    padding: .65rem .85rem;
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(13,110,253,.04);
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    letter-spacing: .02em;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #dee2e6;
    font-size: .875rem;
}

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .2rem rgba(13,110,253,.15);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn-sm {
    border-radius: 6px;
    font-size: .8rem;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    border-radius: 10px;
    border: none;
}

.alert-success { background: #d1f2eb; color: #0f5132; }
.alert-danger  { background: #ffe0e3; color: #842029; }
.alert-warning { background: #fff3cd; color: #664d03; }
.alert-info    { background: #cff4fc; color: #055160; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
    height: var(--topbar-height);
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
    font-size: .8rem;
}

/* ── Pagination ──────────────────────────────────────────── */
.page-link {
    border-radius: 6px !important;
    margin: 0 2px;
    color: #0d6efd;
    border-color: #dee2e6;
    font-size: .8rem;
}

.page-item.active .page-link {
    background: #0d6efd;
    border-color: #0d6efd;
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-content {
    border-radius: 14px;
    border: none;
}

/* ── Scrollbar ───────────────────────────────────────────── */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* ── Utilities ───────────────────────────────────────────── */
.text-purple { color: #7c3aed !important; }
.bg-purple-subtle { background: #f3e8ff !important; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
    }
    #sidebar.mobile-open {
        transform: translateX(0);
    }
    #page-content-wrapper {
        width: 100%;
    }
    .stat-value { font-size: 1.4rem; }
}

/* ── Dark Mode (Mode Malam) ──────────────────────────────── */
/*
 * Palette: Tailwind CSS Slate
 *   slate-950 → #020617   (sidebar, paling gelap)
 *   slate-900 → #0f172a   (page body)
 *   slate-800 → #1e293b   (card, navbar surface)
 *   slate-700 → #334155   (card-header, input, secondary surface)
 *   slate-600 → #475569   (border, muted bg)
 *   slate-400 → #94a3b8   (muted text, placeholders)
 *   slate-200 → #e2e8f0   (body text)
 *   slate-100 → #f1f5f9   (heading text)
 *
 * Strategi: override CSS variable Bootstrap DAN tulis selector eksplisit
 * agar tidak ada Bootstrap default yang bocor ke tampilan.
 */

/* 1 ── Override Bootstrap CSS variables (efek ke semua komponen otomatis) */
[data-bs-theme="dark"] {
    --bs-body-bg:                  #1e293b;
    --bs-body-bg-rgb:              30,41,59;
    --bs-body-color:               #e2e8f0;
    --bs-body-color-rgb:           226,232,240;
    --bs-secondary-bg:             #334155;
    --bs-tertiary-bg:              #475569;
    --bs-secondary-color:          #94a3b8;
    --bs-border-color:             #334155;
    --bs-border-color-translucent: rgba(255,255,255,.08);
    --bs-link-color:               #93c5fd;
    --bs-link-hover-color:         #bfdbfe;
    --bs-emphasis-color:           #f1f5f9;
    --bs-heading-color:            #f1f5f9;
}

/* 2 ── Page body background — lebih gelap dari card agar ada kedalaman */
[data-bs-theme="dark"] body {
    background: #0f172a !important;
    color: #e2e8f0;
}

/* 3 ── Navbar */
[data-bs-theme="dark"] nav.navbar {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}
[data-bs-theme="dark"] nav.navbar .text-secondary,
[data-bs-theme="dark"] nav.navbar .text-muted {
    color: #94a3b8 !important;
}
[data-bs-theme="dark"] nav.navbar .navbar-brand {
    color: #e2e8f0 !important;
}

/* 4 ── Cards */
[data-bs-theme="dark"] .card {
    background-color: #1e293b;
    border-color: #334155;
}
[data-bs-theme="dark"] .card-header {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}
[data-bs-theme="dark"] .card-footer {
    background-color: #334155 !important;
    border-color: #475569 !important;
}

/* 5 ── Utility overrides (Bootstrap kelas bg-white / bg-light banyak dipakai) */
[data-bs-theme="dark"] .bg-white {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}
[data-bs-theme="dark"] .bg-light {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
}
[data-bs-theme="dark"] .text-dark {
    color: #e2e8f0 !important;
}
[data-bs-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}
[data-bs-theme="dark"] .text-secondary {
    color: #94a3b8 !important;
}
[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-top {
    border-color: #334155 !important;
}

/* 6 ── Tables */
[data-bs-theme="dark"] .table {
    --bs-table-bg:          #1e293b;
    --bs-table-color:       #e2e8f0;
    --bs-table-border-color:#334155;
    --bs-table-striped-bg:  #253347;
    --bs-table-hover-bg:    rgba(148,163,184,.08);
}
[data-bs-theme="dark"] .table-light {
    --bs-table-bg:          #334155;
    --bs-table-color:       #f1f5f9;
    --bs-table-border-color:#475569;
    --bs-table-striped-bg:  #3d4f65;
}
[data-bs-theme="dark"] .table > :not(caption) > * > * {
    border-color: #334155;
}

/* 7 ── Alerts */
[data-bs-theme="dark"] .alert-success {
    background: #052e16;
    color:      #86efac;
    border:     1px solid rgba(134,239,172,.2);
}
[data-bs-theme="dark"] .alert-danger {
    background: #450a0a;
    color:      #fca5a5;
    border:     1px solid rgba(252,165,165,.2);
}
[data-bs-theme="dark"] .alert-warning {
    background: #3f2005;
    color:      #fcd34d;
    border:     1px solid rgba(252,211,77,.2);
}
[data-bs-theme="dark"] .alert-info {
    background: #082f49;
    color:      #7dd3fc;
    border:     1px solid rgba(125,211,252,.2);
}

/* 8 ── Forms & inputs */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #0f172a;
    border-color:     #475569;
    color:            #e2e8f0;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #0f172a;
    border-color:     #93c5fd;
    color:            #f1f5f9;
    box-shadow:       0 0 0 .2rem rgba(147,197,253,.2);
}
[data-bs-theme="dark"] .form-control::placeholder {
    color: #64748b;
}
[data-bs-theme="dark"] .input-group-text {
    background-color: #334155;
    border-color:     #475569;
    color:            #94a3b8;
}
[data-bs-theme="dark"] .form-check-input {
    background-color: #334155;
    border-color:     #475569;
}

/* 9 ── Buttons */
[data-bs-theme="dark"] .btn-light {
    background-color: #334155;
    border-color:     #475569;
    color:            #e2e8f0;
}
[data-bs-theme="dark"] .btn-light:hover {
    background-color: #475569;
    border-color:     #64748b;
    color:            #f1f5f9;
}
[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: #475569;
    color:        #94a3b8;
}
[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #334155;
    border-color:     #64748b;
    color:            #e2e8f0;
}

/* 10 ── Dropdowns */
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e293b;
    border-color:     #334155;
}
[data-bs-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}
[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: #334155;
    color:            #f1f5f9;
}
[data-bs-theme="dark"] .dropdown-divider {
    border-color: #334155;
}
[data-bs-theme="dark"] .dropdown-item-text {
    color: #94a3b8;
}
[data-bs-theme="dark"] .dropdown-item.text-danger {
    color: #fca5a5 !important;
}
[data-bs-theme="dark"] .dropdown-item.text-danger:hover {
    background-color: #450a0a;
}

/* 11 ── Sidebar */
[data-bs-theme="dark"] #sidebar {
    background: #020617;
    border-right: 1px solid #1e293b;
}

/* 12 ── Modal */
[data-bs-theme="dark"] .modal-content {
    background-color: #1e293b;
    border-color:     #334155;
}
[data-bs-theme="dark"] .modal-header {
    border-color: #334155;
}
[data-bs-theme="dark"] .modal-footer {
    border-color: #334155;
}

/* 13 ── Pagination */
[data-bs-theme="dark"] .page-link {
    background-color: #1e293b;
    border-color:     #334155;
    color:            #93c5fd;
}
[data-bs-theme="dark"] .page-link:hover {
    background-color: #334155;
    color:            #bfdbfe;
}
[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: #3b82f6;
    border-color:     #3b82f6;
    color:            #fff;
}
[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: #1e293b;
    border-color:     #334155;
    color:            #475569;
}

/* 14 ── Shadows */
[data-bs-theme="dark"] .shadow-sm {
    box-shadow: 0 .125rem .5rem rgba(0,0,0,.6) !important;
}
[data-bs-theme="dark"] .shadow {
    box-shadow: 0 .25rem 1rem rgba(0,0,0,.7) !important;
}

/* 15 ── Stat cards (dashboard) */
[data-bs-theme="dark"] .stat-value {
    color: #f1f5f9;
}
[data-bs-theme="dark"] .stat-label {
    color: #94a3b8;
}

/* 16 ── Badge subtle backgrounds */
[data-bs-theme="dark"] .bg-primary-subtle { background-color: rgba(59,130,246,.15) !important; }
[data-bs-theme="dark"] .bg-success-subtle { background-color: rgba(34,197,94,.12)  !important; }
[data-bs-theme="dark"] .bg-danger-subtle  { background-color: rgba(239,68,68,.12)  !important; }
[data-bs-theme="dark"] .bg-warning-subtle { background-color: rgba(234,179,8,.12)  !important; }
[data-bs-theme="dark"] .bg-info-subtle    { background-color: rgba(14,165,233,.12) !important; }
[data-bs-theme="dark"] .bg-purple-subtle  { background-color: rgba(124,58,237,.15) !important; }

/* 17 ── Rounded corners / list groups */
[data-bs-theme="dark"] .list-group-item {
    background-color: #1e293b;
    border-color:     #334155;
    color:            #e2e8f0;
}
[data-bs-theme="dark"] .list-group-item:hover {
    background-color: #334155;
}

/* 18 ── Scrollbar (sidebar) */
[data-bs-theme="dark"] .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.12);
}
