/* =====================================================================
   SISFO KOS - Custom theme (Bootstrap 5)
   Layout: sidebar collapsible + topbar, dukungan dark/light mode
   ===================================================================== */

:root {
    --sidebar-w: 250px;
    --sidebar-w-collapsed: 74px;
    --brand: #4f46e5;
    --brand-2: #6366f1;
    --bg-app: #f1f4f9;
    --card-radius: 14px;
}

* { box-sizing: border-box; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    background: var(--bg-app);
    margin: 0;
}

/* ---------- LOGIN ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #2563eb 100%);
}
.login-wrapper { width: 100%; max-width: 430px; padding: 20px; }
.login-card { border: none; border-radius: 18px; }
.login-logo-badge {
    width: 64px; height: 64px; border-radius: 16px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
}

/* ---------- LAYOUT ---------- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #111827;
    color: #cbd5e1;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    transition: width .2s ease, transform .2s ease;
    z-index: 1040;
    overflow-x: hidden;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px; font-weight: 700; color: #fff;
    font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
}
.sidebar-brand i { color: var(--brand-2); font-size: 1.4rem; }
.sidebar-nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.sidebar-nav .nav-section {
    text-transform: uppercase; font-size: .68rem; letter-spacing: .06em;
    color: #64748b; padding: 14px 12px 6px; white-space: nowrap;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 12px;
    color: #cbd5e1; padding: 10px 12px; border-radius: 10px;
    margin-bottom: 2px; white-space: nowrap; font-size: .92rem;
}
.sidebar-nav .nav-link i { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.4);
}

.main-wrap {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    min-width: 0;
    transition: margin-left .2s ease;
}

/* Collapsed state (desktop) */
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .nav-link span,
body.sidebar-collapsed .sidebar .nav-section { display: none; }
body.sidebar-collapsed .sidebar .nav-link { justify-content: center; }
body.sidebar-collapsed .main-wrap { margin-left: var(--sidebar-w-collapsed); }

/* ---------- TOPBAR ---------- */
.topbar {
    background: #fff;
    display: flex; align-items: center; gap: 14px;
    padding: 12px 22px;
    position: sticky; top: 0; z-index: 1030;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.topbar-title { font-weight: 600; color: #1f2937; }
.btn-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none; color: #475569; font-size: 1.2rem;
}
.btn-icon:hover { background: #eef2ff; color: var(--brand); }
.btn-user { display: flex; align-items: center; gap: 8px; border: none; background: transparent; color: #334155; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.notif-dropdown { width: 340px; max-width: 92vw; max-height: 400px; overflow-y: auto; overflow-x: hidden; }
/* Pesan notifikasi membungkus (word-wrap), tidak meluber ke samping */
.notif-dropdown .dropdown-item,
.notif-dropdown .dropdown-item-text {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

/* ---------- CONTENT ---------- */
.content { padding: 24px; flex: 1; }
.app-footer { border-top: 1px solid #e5e7eb; }

/* ---------- CARDS ---------- */
.card { border: none; border-radius: var(--card-radius); box-shadow: 0 2px 10px rgba(16,24,40,.05); }
.card-title { font-weight: 600; }

.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-icon {
    width: 52px; height: 52px; border-radius: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #fff;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: #64748b; font-size: .85rem; }
.bg-grad-primary { background: linear-gradient(135deg,#4f46e5,#6366f1); }
.bg-grad-success { background: linear-gradient(135deg,#059669,#10b981); }
.bg-grad-danger  { background: linear-gradient(135deg,#dc2626,#ef4444); }
.bg-grad-warning { background: linear-gradient(135deg,#d97706,#f59e0b); }
.bg-grad-info    { background: linear-gradient(135deg,#0891b2,#06b6d4); }
.bg-grad-dark    { background: linear-gradient(135deg,#334155,#475569); }

/* ---------- TABLES ---------- */
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #64748b; }
.table td { vertical-align: middle; }

/* Sticky header: tabel scroll di dalam kotak, header menempel di atas */
.table-sticky {
    max-height: calc(100vh - 250px);
    overflow: auto;
}
.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    box-shadow: inset 0 -1px 0 #e5e7eb; /* garis bawah tetap terlihat saat sticky */
}
[data-bs-theme="dark"] .table-sticky thead th {
    background: #1e293b;
    box-shadow: inset 0 -1px 0 #334155;
}

/* ---------- MOBILE ---------- */
.sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 1035;
}
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .main-wrap { margin-left: 0 !important; }
}

/* ---------- DARK MODE ---------- */
[data-bs-theme="dark"] { --bg-app: #0f172a; }
[data-bs-theme="dark"] body { background: var(--bg-app); }
[data-bs-theme="dark"] .topbar { background: #1e293b; }
[data-bs-theme="dark"] .topbar-title { color: #e2e8f0; }
[data-bs-theme="dark"] .card { background: #1e293b; }
[data-bs-theme="dark"] .btn-icon { color: #cbd5e1; }
[data-bs-theme="dark"] .app-footer { border-color: #334155; }

/* ---------- KALENDER (FullCalendar) ---------- */
.kal-dot {
    display: inline-block; width: 10px; height: 10px;
    border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
#kalender { --fc-border-color: #e5e7eb; --fc-today-bg-color: rgba(79,70,229,.07); }
#kalender .fc-toolbar-title { font-size: 1.05rem; font-weight: 600; }
#kalender .fc-button { font-size: .8rem; padding: .3rem .6rem; }
#kalender .fc-event { cursor: pointer; font-size: .76rem; }
#kalender .fc-daygrid-day-number { font-size: .8rem; }
@media (max-width: 575.98px) {
    #kalender .fc-toolbar { flex-direction: column; gap: .5rem; }
}
[data-bs-theme="dark"] #kalender {
    --fc-border-color: #334155;
    --fc-page-bg-color: #1e293b;
    --fc-neutral-bg-color: #0f172a;
    --fc-today-bg-color: rgba(99,102,241,.16);
    --fc-list-event-hover-bg-color: #334155;
    color: #e2e8f0;
}
[data-bs-theme="dark"] #kalender .fc-col-header-cell-cushion,
[data-bs-theme="dark"] #kalender .fc-daygrid-day-number,
[data-bs-theme="dark"] #kalender .fc-list-day-text,
[data-bs-theme="dark"] #kalender .fc-list-day-side-text { color: #e2e8f0; }
