/* =========================================================
   SIMSARPRAS - Sistem Informasi Inventaris Sarana & Prasarana
   ========================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --sidebar-bg: #0f172a;
    --sidebar-bg-soft: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-text-active: #ffffff;
    --accent-staf: #0ea5e9;
    --accent-kepsek: #8b5cf6;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

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

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .25s ease;
}

.page-content {
    padding: 28px 32px;
    flex: 1;
}

.page-footer {
    text-align: center;
    padding: 16px;
    font-size: 12.5px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}

/* ============================= SIDEBAR ============================= */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon {
    width: 38px;
    height: 38px;
    object-fit: contain;
    background: #fff;
    border-radius: 9px;
    padding: 4px;
    flex-shrink: 0;
}
.brand-text strong { display: block; color: #fff; font-size: 16px; letter-spacing: .5px; }
.brand-text small { color: var(--sidebar-text); font-size: 11px; }

.sidebar-role-tag {
    margin: 14px 20px 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    width: fit-content;
}
.tag-staf { background: rgba(14,165,233,0.18); color: #38bdf8; border: 1px solid rgba(14,165,233,0.35); }
.tag-kepsek { background: rgba(139,92,246,0.18); color: #a78bfa; border: 1px solid rgba(139,92,246,0.35); }
.tag-superadmin { background: rgba(239,68,68,0.18); color: #fca5a5; border: 1px solid rgba(239,68,68,0.35); }
.tag-waka { background: rgba(20,184,166,0.18); color: #5eead4; border: 1px solid rgba(20,184,166,0.35); }

.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 14.5px;
    color: var(--sidebar-text);
    margin-bottom: 4px;
    transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; display: inline-flex; align-items: center; justify-content: center; }

.sidebar-footer { padding: 14px 12px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.nav-item.logout:hover { background: rgba(220,38,38,0.18); color: #fca5a5; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 90;
}

/* ============================= TOPBAR ============================= */
.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.btn-toggle-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text);
}
.page-title { font-size: 20px; font-weight: 700; flex: 1; }

.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-info { text-align: right; }
.user-name { display: block; font-weight: 600; font-size: 14px; }
.user-role-badge {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
}
.role-staf { background: var(--primary-light); color: var(--primary-dark); }
.role-kepala_sekolah { background: #ede9fe; color: #6d28d9; }
.role-superadmin { background: #fee2e2; color: #b91c1c; }
.role-waka_sarpras { background: #ccfbf1; color: #0f766e; }
.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

/* ============================= CARDS / STATS ============================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 26px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid var(--primary);
}
.stat-card .stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    background: var(--primary-light);
    color: var(--primary-dark);
}
.stat-card .stat-value { font-size: 24px; font-weight: 800; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); }

.stat-card.c-green { border-left-color: var(--success); }
.stat-card.c-green .stat-icon { background: var(--success-light); color: #15803d; }
.stat-card.c-orange { border-left-color: var(--warning); }
.stat-card.c-orange .stat-icon { background: var(--warning-light); color: #b45309; }
.stat-card.c-purple { border-left-color: var(--accent-kepsek); }
.stat-card.c-purple .stat-icon { background: #ede9fe; color: #6d28d9; }
.stat-card.c-red { border-left-color: var(--danger); }
.stat-card.c-red .stat-icon { background: var(--danger-light); color: #b91c1c; }

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 24px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}
.card-header h2 { font-size: 17px; font-weight: 700; }

/* ============================= BUTTONS ============================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform .1s ease, box-shadow .15s ease, opacity .15s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.action-icons { display: flex; gap: 6px; }
.icon-btn {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}
.icon-btn.edit { background: var(--primary-light); color: var(--primary-dark); }
.icon-btn.delete { background: var(--danger-light); color: var(--danger); }
.icon-btn.view { background: #f1f5f9; color: var(--text); }

/* ============================= TABLE ============================= */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    text-align: left;
    padding: 12px 14px;
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
}
.badge-success { background: var(--success-light); color: #15803d; }
.badge-danger { background: var(--danger-light); color: #b91c1c; }
.badge-warning { background: var(--warning-light); color: #b45309; }
.badge-info { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .emoji { font-size: 46px; display: block; margin-bottom: 10px; }

/* ============================= FORMS ============================= */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 13.5px; font-weight: 600; color: var(--text); }
input[type=text], input[type=number], input[type=date],
input[type=password], input[type=search], select, textarea {
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}
textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.helper-text { font-size: 12px; color: var(--text-muted); }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filter-bar input, .filter-bar select { width: auto; min-width: 180px; }

/* ============================= ALERTS ============================= */
.alert {
    padding: 13px 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: var(--success-light); color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger { background: var(--danger-light); color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #b45309; border: 1px solid #fde68a; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #bfdbfe; }

/* ============================= MODAL ============================= */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.55);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalPop .18s ease;
}
@keyframes modalPop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16.5px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px 22px; }

/* ============================= LOGIN PAGE ============================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;

    /* Foto sekolah sebagai background, dengan lapisan gradient gelap
       di atasnya (overlay) supaya kartu login tetap kontras & mudah dibaca.
       Urutan penting: overlay ditulis PERTAMA, baru gambar */
    background-image:
        linear-gradient(135deg, rgba(15,23,42,0.55) 0%, rgba(30,58,138,0.50) 55%, rgba(37,99,235,0.42) 100%),
        url('../img/sekolah-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 430px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.login-header {
    padding: 38px 34px 4px;
    text-align: center;
}
.login-logo {
    width: 88px;
    height: 88px;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}
.login-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    margin-top: 10px;
    letter-spacing: .3px;
}
.login-header p {
    color: var(--text-muted);
    font-size: 13.5px;
    margin-top: 8px;
    line-height: 1.6;
}

/* Garis pemisah dengan aksen kecil biru di tengah */
.login-divider {
    position: relative;
    height: 1px;
    background: var(--border);
    margin: 22px 34px 0;
}
.login-divider span {
    position: absolute;
    top: -1.5px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 4px;
    border-radius: 4px;
    background: var(--primary);
}

.login-body { padding: 26px 34px 30px; }

/* Input dengan ikon di dalamnya */
.input-icon-group {
    position: relative;
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
    background: #fff;
    transition: border-color .15s ease;
}
.input-icon-group:focus-within {
    border-color: var(--primary);
}
.input-icon-group .input-icon {
    position: absolute;
    left: 15px;
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}
.input-icon-group input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 13px 44px 13px 42px;
    font-size: 14.5px;
    color: var(--text);
    border-radius: 12px;
}
.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    padding: 4px;
    display: flex;
    align-items: center;
}
.toggle-password:hover { color: var(--text); }

.btn-login {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    transition: background .15s ease, transform .1s ease;
}
.btn-login:hover { background: var(--primary-dark); }
.btn-login:active { transform: translateY(1px); }

.login-card-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ============================= IKON (Bootstrap Icons) ============================= */
.btn i, .card-header h2 i, .alert i, .empty-state i.emoji,
.sidebar-role-tag i, .login-header .logo-emoji i {
    vertical-align: -0.1em;
}
.btn i { margin-right: 2px; }
.icon-btn i { font-size: 14px; }
.empty-state i.emoji { font-size: 42px; display: block; margin-bottom: 10px; color: #cbd5e1; }
.sidebar-role-tag i { margin-right: 4px; }

/* ============================= UTILITIES ============================= */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.mt-0 { margin-top: 0; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }

/* ============================= RESPONSIVE ============================= */
@media (max-width: 992px) {
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main-content { margin-left: 0; }
    .btn-toggle-sidebar { display: block; }
    .sidebar-overlay.show { display: block; }
    .user-info { display: none; }
    .page-content { padding: 20px 16px; }
    .topbar { padding: 14px 16px; }
}
/* =========================================================
   TAMBAHAN CSS — Superadmin, Waka Sarpras, Notifikasi
   Tempelkan di bagian BAWAH file public/css/style.css yang sudah ada
   ========================================================= */

/* ---- Role tag baru di sidebar ---- */
.tag-superadmin { background: rgba(239,68,68,0.18); color: #fca5a5; border: 1px solid rgba(239,68,68,0.35); }
.tag-waka { background: rgba(20,184,166,0.18); color: #5eead4; border: 1px solid rgba(20,184,166,0.35); }

/* ---- Label pemisah section di sidebar (Sarana / Prasarana / Laporan) ---- */
.nav-section-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #64748b;
    padding: 14px 14px 4px;
}

/* ---- Lonceng Notifikasi ---- */
.notif-wrap { position: relative; }

.notif-bell {
    position: relative;
    background: none;
    border: none;
    font-size: 19px;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
}
.notif-bell:hover { background: #f1f5f9; }

.notif-bell-pulse { animation: notifPulse .6s ease; }
@keyframes notifPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.notif-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 300;
}
.notif-dropdown.show { display: block; }

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #fff;
}
.notif-mark-all {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    cursor: pointer;
}

.notif-list { padding: 6px; }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

.notif-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 2px;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.notif-unread { background: var(--primary-light); }
.notif-item.notif-unread:hover { background: #bfdbfe; }

.notif-item-judul { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.notif-item-pesan { font-size: 12px; color: var(--text-muted); }

@media (max-width: 480px) {
    .notif-dropdown { width: 280px; right: -60px; }
}