/* =====================================================================
   SMALA-DIGI | E-JURNAL MENGAJAR
   Tema: Neon Cyber — mendukung Dark Mode & Light Mode
   ===================================================================== */

/* ---------- 1. DESIGN TOKENS (CSS VARIABLES) ---------- */
:root {
    --font-display: 'Orbitron', 'Segoe UI', sans-serif;
    --font-body: 'Rajdhani', 'Segoe UI', Tahoma, sans-serif;

    /* Dark theme (default) */
    --bg-body: #060911;
    --bg-body-2: #0a0e1a;
    --bg-card: #0d1220;
    --bg-card-2: #111830;
    --bg-input: #0a0f1c;
    --bg-sidebar: #05070d;
    --bg-hover: rgba(0, 240, 255, 0.07);

    --text-main: #e8f4ff;
    --text-muted: #7f93b8;
    --text-dim: #536080;

    --neon-cyan: #00f0ff;
    --neon-pink: #ff2ec8;
    --neon-purple: #a259ff;
    --neon-green: #39ff8f;
    --neon-yellow: #ffe14d;
    --neon-red: #ff4d6a;

    --border-soft: rgba(0, 240, 255, 0.16);
    --border-strong: rgba(0, 240, 255, 0.4);

    --glow-cyan: 0 0 6px rgba(0, 240, 255, .55), 0 0 18px rgba(0, 240, 255, .2);
    --glow-pink: 0 0 6px rgba(255, 46, 200, .55), 0 0 18px rgba(255, 46, 200, .2);
    --glow-purple: 0 0 6px rgba(162, 89, 255, .55), 0 0 18px rgba(162, 89, 255, .2);
    --glow-green: 0 0 6px rgba(57, 255, 143, .5), 0 0 16px rgba(57, 255, 143, .18);
    --glow-red: 0 0 6px rgba(255, 77, 106, .5), 0 0 16px rgba(255, 77, 106, .18);

    --shadow-card: 0 4px 24px rgba(0, 0, 0, .45);
    --radius: 14px;
    --radius-sm: 8px;
    --sidebar-w: 268px;
    --topbar-h: 68px;
}

[data-theme="light"] {
    --bg-body: #eef2f9;
    --bg-body-2: #e4e9f4;
    --bg-card: #ffffff;
    --bg-card-2: #f5f7fc;
    --bg-input: #ffffff;
    --bg-sidebar: #0b0f1d;
    --bg-hover: rgba(0, 140, 170, 0.08);

    --text-main: #101828;
    --text-muted: #55617a;
    --text-dim: #8792a6;

    --neon-cyan: #0090ab;
    --neon-pink: #c40f95;
    --neon-purple: #6a2fd0;
    --neon-green: #0f9d58;
    --neon-yellow: #b8860b;
    --neon-red: #d6304a;

    --border-soft: rgba(0, 140, 170, 0.22);
    --border-strong: rgba(0, 140, 170, 0.45);

    --glow-cyan: 0 0 0 rgba(0,0,0,0);
    --glow-pink: 0 0 0 rgba(0,0,0,0);
    --glow-purple: 0 0 0 rgba(0,0,0,0);
    --glow-green: 0 0 0 rgba(0,0,0,0);
    --glow-red: 0 0 0 rgba(0,0,0,0);

    --shadow-card: 0 2px 16px rgba(20, 30, 60, .09);
}

/* ---------- 2. RESET & BASE ---------- */
* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    scroll-behavior: smooth;
}
body {
    background-image:
        linear-gradient(var(--border-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
    background-size: 42px 42px;
    background-attachment: fixed;
    min-height: 100vh;
    transition: background-color .25s ease, color .25s ease;
}
[data-theme="light"] body { background-image: none; }

h1, h2, h3, h4, h5, h6, .font-display {
    font-family: var(--font-display);
    letter-spacing: .03em;
}
a { color: var(--neon-cyan); text-decoration: none; }
a:hover { color: var(--neon-pink); }
::selection { background: var(--neon-cyan); color: #000; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-body-2); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

.text-neon-cyan { color: var(--neon-cyan); }
.text-neon-pink { color: var(--neon-pink); }
.text-neon-purple { color: var(--neon-purple); }
.text-muted-neon { color: var(--text-muted) !important; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- 3. LOADER / SPLASH SCREEN ---------- */
#appLoader {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% 40%, #0b1330 0%, #05070d 70%);
    transition: opacity .5s ease, visibility .5s ease;
}
#appLoader.loader-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-logo-wrap {
    position: relative; width: 110px; height: 110px; margin-bottom: 22px;
    display: flex; align-items: center; justify-content: center;
}
.loader-logo-wrap svg { width: 100%; height: 100%; }
.loader-ring {
    position: absolute; inset: -14px;
    border: 2px solid transparent;
    border-top-color: var(--neon-cyan);
    border-right-color: var(--neon-pink);
    border-radius: 50%;
    animation: spinRing 1.1s linear infinite;
    filter: drop-shadow(0 0 6px rgba(0,240,255,.6));
}
@keyframes spinRing { to { transform: rotate(360deg); } }
.loader-brand {
    font-family: var(--font-display);
    font-size: 1.6rem; font-weight: 700; letter-spacing: .12em;
    color: #eaffff;
    text-shadow: var(--glow-cyan);
    margin: 0;
}
.loader-sub {
    font-size: .85rem; color: #7f93b8; letter-spacing: .08em; margin-top: 4px;
    text-transform: uppercase;
}
.loader-bar-track {
    width: 220px; height: 4px; background: rgba(255,255,255,.08);
    border-radius: 4px; margin-top: 22px; overflow: hidden;
}
.loader-bar-fill {
    height: 100%; width: 30%; border-radius: 4px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
    animation: loaderSlide 1.1s ease-in-out infinite;
    box-shadow: var(--glow-cyan);
}
@keyframes loaderSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(420%); }
}

/* ---------- 4. LOGIN PAGE ---------- */
.login-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px; position: relative; overflow: hidden;
}
.login-shell::before, .login-shell::after {
    content: ''; position: absolute; width: 480px; height: 480px; border-radius: 50%;
    filter: blur(110px); opacity: .35; z-index: 0;
}
.login-shell::before { background: var(--neon-cyan); top: -180px; left: -140px; }
.login-shell::after { background: var(--neon-pink); bottom: -200px; right: -140px; }
[data-theme="light"] .login-shell::before, [data-theme="light"] .login-shell::after { opacity: .18; }

.login-card {
    position: relative; z-index: 1;
    width: 100%; max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card), var(--glow-cyan);
    padding: 38px 32px 28px;
    animation: cardRise .6s ease;
}
@keyframes cardRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.login-logo { width: 68px; height: 68px; margin: 0 auto 14px; display: block; }
.login-title {
    text-align: center; font-family: var(--font-display); font-size: 1.35rem;
    color: var(--text-main); text-shadow: var(--glow-cyan); margin: 0 0 2px;
}
.login-subtitle { text-align: center; color: var(--text-muted); font-size: .92rem; margin-bottom: 26px; letter-spacing: .03em; }

.theme-toggle-fixed { position: fixed; top: 18px; right: 18px; z-index: 20; }

/* ---------- 5. FORM ELEMENTS ---------- */
.form-label-neon {
    font-size: .82rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); margin-bottom: 6px; display: block; font-weight: 600;
}
.form-control, .form-select {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-soft) !important;
    color: var(--text-main) !important;
    border-radius: var(--radius-sm) !important;
    padding: .62rem .9rem !important;
    font-family: var(--font-body);
    font-size: 1rem;
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:focus, .form-select:focus {
    border-color: var(--neon-cyan) !important;
    box-shadow: 0 0 0 .2rem rgba(0, 240, 255, .15) !important;
}
.form-text { color: var(--text-dim); }
textarea.form-control { min-height: 90px; }
.input-group-text {
    background: var(--bg-card-2) !important; border: 1px solid var(--border-soft) !important;
    color: var(--neon-cyan) !important;
}
.form-check-input { background-color: var(--bg-input); border: 1px solid var(--border-soft); }
.form-check-input:checked { background-color: var(--neon-cyan); border-color: var(--neon-cyan); }

/* ---------- 6. BUTTONS ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; letter-spacing: .02em; padding: .55rem 1.15rem; }
.btn-neon {
    background: linear-gradient(135deg, var(--neon-cyan), #0072ff);
    border: none; color: #001018;
    box-shadow: var(--glow-cyan);
}
.btn-neon:hover { color: #001018; filter: brightness(1.12); box-shadow: 0 0 10px rgba(0,240,255,.8), 0 0 26px rgba(0,240,255,.35); }
.btn-neon-pink {
    background: linear-gradient(135deg, var(--neon-pink), #b5008f);
    border: none; color: #1a0012;
    box-shadow: var(--glow-pink);
}
.btn-neon-pink:hover { color: #1a0012; filter: brightness(1.12); }
.btn-outline-neon {
    background: transparent; border: 1px solid var(--border-strong); color: var(--neon-cyan);
}
.btn-outline-neon:hover { background: var(--bg-hover); color: var(--neon-cyan); border-color: var(--neon-cyan); }
.btn-ghost-neon { background: transparent; border: 1px solid var(--border-soft); color: var(--text-muted); }
.btn-ghost-neon:hover { color: var(--text-main); border-color: var(--border-strong); }
.btn-sm { padding: .3rem .7rem; font-size: .82rem; }
.btn-danger-neon { background: linear-gradient(135deg, var(--neon-red), #9c0022); border: none; color: #fff; box-shadow: var(--glow-red); }
.btn-danger-neon:hover { color: #fff; filter: brightness(1.1); }
.btn-block-w { width: 100%; }

/* ---------- 7. APP SHELL LAYOUT ---------- */
.app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 40;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-soft);
    display: flex; flex-direction: column;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand img { width: 36px; height: 36px; }
.sidebar-brand .brand-text { font-family: var(--font-display); font-size: 1rem; color: #eaffff; text-shadow: var(--glow-cyan); line-height: 1.1; }
.sidebar-brand .brand-sub { font-size: .65rem; color: #6c7ba0; letter-spacing: .08em; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-section-label {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #4d5b7d;
    margin: 16px 10px 6px; font-weight: 700;
}
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: #b7c4e0; font-size: .93rem; font-weight: 600; margin-bottom: 2px;
    cursor: pointer; border: 1px solid transparent;
}
.sidebar-link i { width: 18px; text-align: center; font-size: 1rem; color: #6c7ba0; }
.sidebar-link:hover { background: rgba(0,240,255,.06); color: #eaffff; text-decoration: none; }
.sidebar-link.active { background: rgba(0,240,255,.1); color: #eaffff; border-color: var(--border-soft); box-shadow: inset 0 0 0 1px rgba(0,240,255,.08); }
.sidebar-link.active i { color: var(--neon-cyan); }
.sidebar-link .chevron { margin-left: auto; font-size: .75rem; transition: transform .2s ease; color: #4d5b7d; }
.sidebar-link.open .chevron { transform: rotate(90deg); }

.sidebar-submenu { padding-left: 30px; max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.sidebar-submenu.open { max-height: 900px; }
.sidebar-submenu .sidebar-link { font-size: .86rem; padding: 7px 12px; color: #93a2c2; }
.sidebar-submenu .sidebar-link.active { color: var(--neon-cyan); }

.sidebar-footer-credit {
    padding: 12px 18px 16px; border-top: 1px solid rgba(255,255,255,.06);
    font-size: .68rem; color: #4d5b7d; text-align: center; line-height: 1.5;
}
.sidebar-footer-credit b { color: #7f93b8; }

.app-topbar {
    position: fixed; top: 0; right: 0; left: var(--sidebar-w); height: var(--topbar-h); z-index: 30;
    background: var(--bg-card); border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 22px; transition: left .25s ease;
}
.topbar-title { font-family: var(--font-display); font-size: 1.05rem; color: var(--text-main); }
.topbar-title small { display: block; font-family: var(--font-body); font-size: .75rem; color: var(--text-muted); font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.sidebar-burger { display: none; background: none; border: none; color: var(--text-main); font-size: 1.3rem; }

.app-main {
    margin-left: var(--sidebar-w); margin-top: var(--topbar-h);
    padding: 26px; min-height: calc(100vh - var(--topbar-h));
    transition: margin-left .25s ease;
}

.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    color: #05070d; font-weight: 700; font-family: var(--font-display);
    display: flex; align-items: center; justify-content: center; font-size: .82rem;
    box-shadow: var(--glow-cyan);
}
.user-chip-name { font-size: .88rem; font-weight: 700; color: var(--text-main); line-height: 1.1; }
.user-chip-role { font-size: .72rem; color: var(--text-muted); }

/* Theme toggle switch */
.theme-switch { display: flex; align-items: center; gap: 8px; background: var(--bg-card-2); border: 1px solid var(--border-soft); border-radius: 30px; padding: 4px; cursor: pointer; }
.theme-switch i { font-size: .85rem; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--text-dim); }
.theme-switch i.active-icon { color: #05070d; background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple)); box-shadow: var(--glow-cyan); }

/* ---------- 8. CARDS ---------- */
.card-neon {
    background: var(--bg-card); border: 1px solid var(--border-soft);
    border-radius: var(--radius); box-shadow: var(--shadow-card);
    padding: 22px; margin-bottom: 22px;
}
.card-neon-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.card-neon-title { font-family: var(--font-display); font-size: 1.02rem; color: var(--text-main); margin: 0; display: flex; align-items: center; gap: 8px; }
.card-neon-title i { color: var(--neon-cyan); }

.stat-card {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius);
    padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-card);
    height: 100%;
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.stat-value { font-family: var(--font-display); font-size: 1.5rem; color: var(--text-main); line-height: 1; }
.stat-label { color: var(--text-muted); font-size: .82rem; margin-top: 4px; }

/* ---------- 9. TABLES ---------- */
.table-neon-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); }
table.table-neon { width: 100%; border-collapse: collapse; background: var(--bg-card); margin: 0; font-size: .92rem; }
table.table-neon thead th {
    background: var(--bg-card-2); color: var(--neon-cyan); text-transform: uppercase; font-size: .74rem;
    letter-spacing: .06em; padding: 12px 14px; text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--border-soft); font-family: var(--font-body); font-weight: 700;
}
table.table-neon tbody td { padding: 11px 14px; border-bottom: 1px solid rgba(127,147,184,.12); color: var(--text-main); vertical-align: middle; }
table.table-neon tbody tr:hover { background: var(--bg-hover); }
table.table-neon tbody tr:last-child td { border-bottom: none; }

/* ---------- 10. BADGES ---------- */
.badge-neon { padding: 4px 11px; border-radius: 30px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; display: inline-flex; align-items: center; gap: 5px; }
.badge-hadir { background: rgba(57,255,143,.12); color: var(--neon-green); border: 1px solid rgba(57,255,143,.3); }
.badge-tidak-hadir { background: rgba(255,77,106,.12); color: var(--neon-red); border: 1px solid rgba(255,77,106,.3); }
.badge-admin { background: rgba(162,89,255,.12); color: var(--neon-purple); border: 1px solid rgba(162,89,255,.3); }
.badge-sekretaris { background: rgba(0,240,255,.12); color: var(--neon-cyan); border: 1px solid rgba(0,240,255,.3); }
.badge-aktif { background: rgba(57,255,143,.12); color: var(--neon-green); border: 1px solid rgba(57,255,143,.3); }
.badge-nonaktif { background: rgba(127,147,184,.12); color: var(--text-muted); border: 1px solid var(--border-soft); }
.badge-izin { background: rgba(255,225,77,.12); color: var(--neon-yellow); border: 1px solid rgba(255,225,77,.3); }

/* ---------- 11. ALERTS / FLASH ---------- */
.alert-neon { border-radius: var(--radius-sm); border: 1px solid; padding: 13px 16px; font-size: .92rem; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.alert-success-neon { background: rgba(57,255,143,.08); border-color: rgba(57,255,143,.35); color: var(--neon-green); }
.alert-danger-neon { background: rgba(255,77,106,.08); border-color: rgba(255,77,106,.35); color: var(--neon-red); }
.alert-warning-neon { background: rgba(255,225,77,.08); border-color: rgba(255,225,77,.35); color: var(--neon-yellow); }
.alert-info-neon { background: rgba(0,240,255,.08); border-color: rgba(0,240,255,.35); color: var(--neon-cyan); }

/* ---------- 12. MODAL OVERRIDES ---------- */
.modal-content { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius); color: var(--text-main); }
.modal-header, .modal-footer { border-color: var(--border-soft); }
.modal-title { font-family: var(--font-display); font-size: 1rem; }
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-theme="light"] .btn-close { filter: none; }

/* ---------- 13. JOURNAL SLOT CARD ---------- */
.slot-card { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; background: var(--bg-card-2); }
.slot-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.slot-jam-badge { background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple)); color: #05070d; font-family: var(--font-display); font-size: .78rem; padding: 5px 12px; border-radius: 20px; box-shadow: var(--glow-cyan); }
.slot-meta { font-size: .85rem; color: var(--text-muted); }
.slot-meta b { color: var(--text-main); }
.slot-audit { font-size: .76rem; color: var(--text-dim); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-soft); }
.slot-audit b { color: var(--text-muted); }

/* ---------- 14. LOGIN CREDIT / FOOTER CREDIT ---------- */
.credit-tag {
    text-align: center; font-size: .74rem; color: var(--text-dim); margin-top: 22px; letter-spacing: .02em;
}
.credit-tag b { color: var(--text-muted); }

/* ---------- 15. MISC ---------- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i { font-size: 2.4rem; color: var(--border-strong); margin-bottom: 12px; display: block; }
.divider-neon { border: none; border-top: 1px solid var(--border-soft); margin: 20px 0; }
.pill-tab { display: inline-flex; gap: 6px; background: var(--bg-card-2); padding: 5px; border-radius: 30px; border: 1px solid var(--border-soft); flex-wrap: wrap; }
.pill-tab a { padding: 7px 16px; border-radius: 30px; font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.pill-tab a.active { background: linear-gradient(135deg, var(--neon-cyan), #0072ff); color: #001018; box-shadow: var(--glow-cyan); }
.pill-tab a:hover:not(.active) { color: var(--text-main); text-decoration: none; }
.kelas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kelas-tile {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
    padding: 16px; text-align: center; font-family: var(--font-display); color: var(--text-main);
    transition: all .2s ease; cursor: pointer;
}
.kelas-tile:hover, .kelas-tile.active { border-color: var(--neon-cyan); box-shadow: var(--glow-cyan); color: var(--neon-cyan); text-decoration: none; }
.kelas-tile .kelas-tile-sub { display: block; font-family: var(--font-body); font-size: .72rem; color: var(--text-muted); margin-top: 4px; }

.avatar-sm { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple)); color: #05070d; display: inline-flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700; font-family: var(--font-display); }

/* ---------- 16. RESPONSIVE ---------- */
@media (max-width: 991px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.sidebar-open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.6); }
    .app-topbar { left: 0; }
    .app-main { margin-left: 0; }
    .sidebar-burger { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 39; display: none; }
    .sidebar-backdrop.show { display: block; }
}
@media (max-width: 575px) {
    .app-main { padding: 16px; }
    .login-card { padding: 28px 20px 22px; }
    .card-neon { padding: 16px; }
}
