/* ==========================================================================
   KumpulTugas — tema kampus (navy + emas), tampilan aplikasi di mobile
   ========================================================================== */
:root {
    --navy-900: #0b1220;
    --navy-800: #11193a;
    --navy-700: #1e2a78;
    --indigo:   #4f46e5;
    --indigo-2: #6366f1;
    --gold:     #fbbf24;
    --gold-dk:  #d9950c;

    --bg: #eef1f7;
    --surface: #ffffff;
    --surface-2: #f7f8fb;
    --border: #e4e7ee;
    --text: #1c2430;
    --muted: #6b7480;

    --primary: var(--indigo);
    --primary-dark: #4338ca;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --warning: #b45309;
    --warning-bg: #fef3c7;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 6px 20px -8px rgba(16, 24, 40, .12);
    --shadow-lg: 0 20px 45px -18px rgba(15, 23, 42, .35);
    --bottomnav-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; max-width: 100%; }
img, svg, video, canvas { max-width: 100%; height: auto; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    line-height: 1.55;
    font-size: 15px;
    background: var(--bg);
    min-height: 100vh;
}

/* latar aurora kampus — di belakang area konten aplikasi */
body.app::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(680px 380px at 8% -8%, rgba(99, 102, 241, .18), transparent 60%),
        radial-gradient(560px 360px at 96% 4%, rgba(251, 191, 36, .12), transparent 58%);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Topbar (desktop) + header aplikasi (mobile)
   -------------------------------------------------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    background: rgba(11, 18, 32, .72);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.topbar-inner {
    max-width: 1080px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; gap: 22px; height: 60px;
}
.brand {
    display: flex; align-items: center; gap: 9px;
    font-weight: 700; font-size: 16px; color: #fff; white-space: nowrap; letter-spacing: .2px;
}
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }

.nav { display: flex; gap: 3px; flex: 1; flex-wrap: wrap; }
.nav a {
    padding: 7px 13px; border-radius: 999px; color: rgba(255, 255, 255, .66); font-weight: 500; font-size: 14px;
}
.nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; color: #fff; }
.nav a.active { background: var(--gold); color: var(--navy-900); font-weight: 600; }

.userbox { display: flex; align-items: center; gap: 12px; white-space: nowrap; color: #fff; }
.userbox .name { font-weight: 600; font-size: 13px; }
.userbox .role {
    font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--gold); display: block;
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
    background: linear-gradient(140deg, var(--gold), var(--gold-dk)); color: var(--navy-900);
}

/* --------------------------------------------------------------------------
   Kontainer + hero
   -------------------------------------------------------------------------- */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 26px 20px calc(60px + env(safe-area-inset-bottom));
}

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* hero gradien untuk dashboard */
.hero {
    position: relative; overflow: hidden;
    border-radius: 20px;
    padding: 24px 22px 26px;
    margin-bottom: 20px;
    color: #fff;
    background:
        radial-gradient(520px 220px at 88% -30%, rgba(251, 191, 36, .5), transparent 60%),
        linear-gradient(135deg, var(--navy-700), var(--indigo) 55%, #7c3aed);
    box-shadow: var(--shadow-lg);
}
.hero::after {
    content: "🎓";
    position: absolute; right: 14px; bottom: -14px;
    font-size: 108px; opacity: .16; line-height: 1; pointer-events: none;
}
.hero .eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; color: var(--gold); font-weight: 700; }
.hero h1 { font-size: 24px; margin: 6px 0 4px; }
.hero p { margin: 0; color: rgba(255, 255, 255, .82); font-size: 14px; }

/* --------------------------------------------------------------------------
   Kartu
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 15px; margin: 0 0 14px; letter-spacing: -.01em; }
.card h3 { font-size: 13px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.grid { display: grid; gap: 14px; min-width: 0; }
.grid > * { min-width: 0; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }

.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.stat::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: linear-gradient(var(--indigo-2), var(--indigo));
}
.stat.alert::before { background: linear-gradient(var(--gold), var(--gold-dk)); }
.stat .num { font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.stat .label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.alert .num { color: var(--warning); }

/* kartu di atas hero (menjorok) */
.hero + .grid { margin-top: -34px; position: relative; z-index: 2; margin-bottom: 20px; }

/* --------------------------------------------------------------------------
   Tabel
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }

/* --------------------------------------------------------------------------
   Badge
   -------------------------------------------------------------------------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; line-height: 1.5; white-space: nowrap;
}
.badge.green { background: var(--success-bg); color: #14532d; }
.badge.red { background: var(--danger-bg); color: #7f1d1d; }
.badge.amber { background: var(--warning-bg); color: var(--warning); }
.badge.gray { background: #eef0f3; color: var(--muted); }
.badge.blue { background: #e0e7ff; color: var(--primary-dark); }

/* --------------------------------------------------------------------------
   Tombol
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
    padding: 10px 18px; border-radius: 11px; font-size: 14px; font-weight: 700;
    border: 1px solid transparent; background: var(--primary); color: #fff;
    transition: transform .08s ease, background .12s ease, box-shadow .12s ease;
    box-shadow: 0 8px 18px -10px rgba(79, 70, 229, .8);
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.gold { background: var(--gold); color: var(--navy-900); box-shadow: 0 8px 18px -10px rgba(251, 191, 36, .9); }
.btn.gold:hover { background: #f0a91b; }
.btn.secondary { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: none; }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); box-shadow: none; }
.btn.danger:hover { background: #b91c1c; }
.btn.success { background: var(--success); box-shadow: none; }
.btn.success:hover { background: #15803d; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=tel], .field input[type=datetime-local],
.field input[type=file], .field select, .field textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; background: #fff; color: var(--text); appearance: none;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--indigo-2); box-shadow: 0 0 0 3px rgba(99, 102, 241, .25);
}
.field .err { color: var(--danger); font-size: 13px; margin-top: 4px; }
.field-inline { display: flex; align-items: center; gap: 9px; }
.field-inline input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--indigo); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }

/* --------------------------------------------------------------------------
   Alert
   -------------------------------------------------------------------------- */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.alert.success { background: var(--success-bg); color: #14532d; }
.alert.error { background: var(--danger-bg); color: #7f1d1d; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* --------------------------------------------------------------------------
   Auth (login / daftar) — layar penuh bernuansa kampus
   -------------------------------------------------------------------------- */
.auth-wrap {
    position: relative;
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
    overflow: hidden;
    background:
        radial-gradient(760px 460px at 6% -6%, rgba(129, 140, 248, .85), transparent 58%),
        radial-gradient(680px 460px at 98% 2%, rgba(251, 191, 36, .55), transparent 56%),
        radial-gradient(900px 620px at 78% 108%, rgba(124, 58, 237, .70), transparent 60%),
        linear-gradient(160deg, #17205a 0%, #0c1230 45%, #0b1220 100%);
}
/* grid halus + cahaya melintang di latar auth */
.auth-wrap::before {
    content: "";
    position: absolute; inset: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at 50% 30%, #000, transparent 75%);
}
.auth-wrap::after {
    content: "";
    position: absolute; width: 420px; height: 420px; border-radius: 50%;
    left: -120px; bottom: -160px; pointer-events: none;
    background: radial-gradient(circle, rgba(251, 191, 36, .22), transparent 70%);
}
.auth-wrap > * { position: relative; z-index: 1; }
.auth-card {
    width: 100%; max-width: 410px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    padding: 30px 26px;
    backdrop-filter: blur(8px);
}
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 20px; }
.auth-brand img { width: 62px; height: 62px; border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.auth-brand .app { font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.auth-brand .tag { color: var(--muted); font-size: 13px; }
.auth-card h1 { font-size: 18px; margin: 0 0 3px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.auth-card .foot { margin-top: 16px; font-size: 14px; text-align: center; color: var(--muted); }

.cred-box {
    background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: 12.5px; margin-top: 14px; color: var(--muted);
}
.cred-box code { background: #fff; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); color: var(--text); }

/* --------------------------------------------------------------------------
   Bottom navigation (mobile)
   -------------------------------------------------------------------------- */
.bottom-nav { display: none; }

/* --------------------------------------------------------------------------
   Utilitas
   -------------------------------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: none; }

.row-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 13px 0; border-bottom: 1px solid var(--border);
}
.row-item:last-child { border-bottom: none; }

/* banner ajakan pasang aplikasi */
.install-banner {
    display: none;
    align-items: center; gap: 12px;
    background: linear-gradient(135deg, var(--navy-700), var(--indigo));
    color: #fff; border-radius: var(--radius); padding: 13px 15px; margin-bottom: 16px;
    box-shadow: var(--shadow-lg);
}
.install-banner img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.install-banner .txt { flex: 1; font-size: 13px; line-height: 1.4; }
.install-banner strong { display: block; font-size: 14px; }
.install-banner button {
    flex: none; border: 0; cursor: pointer; font-weight: 700; font-size: 13px;
    padding: 8px 14px; border-radius: 9px; background: var(--gold); color: var(--navy-900);
}
.install-banner .close { background: transparent; color: rgba(255,255,255,.7); padding: 6px; }

/* --------------------------------------------------------------------------
   Responsif — tampilan aplikasi di layar kecil
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
    body { background: var(--bg); }

    .topbar-inner { height: 54px; gap: 10px; padding: 0 14px; }
    .nav { display: none; }                   /* diganti bottom-nav */
    .userbox { flex: 1; justify-content: flex-end; }
    .userbox .text-right { display: none; }
    .userbox form { display: none; }          /* logout ada di bottom-nav */
    .brand img { width: 24px; height: 24px; }

    .container {
        padding: 16px 14px calc(var(--bottomnav-h) + 22px + env(safe-area-inset-bottom));
    }

    .page-head h1 { font-size: 19px; }
    .hero { border-radius: 18px; padding: 20px 18px 22px; }
    .hero h1 { font-size: 21px; }
    .hero + .grid { margin-top: -28px; }

    .card { padding: 16px; border-radius: var(--radius); }
    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat .num { font-size: 22px; }
    .stat .label { font-size: 12px; }

    table.data { font-size: 13.5px; }
    table.data th, table.data td { padding: 9px 10px; }

    .install-banner.show { display: flex; }

    /* bottom navigation */
    .bottom-nav {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: rgba(11, 18, 32, .9);
        backdrop-filter: saturate(160%) blur(16px);
        -webkit-backdrop-filter: saturate(160%) blur(16px);
        border-top: 1px solid rgba(255, 255, 255, .08);
    }
    .bottom-nav a {
        flex: 1 1 0; min-width: 0; padding: 0 2px;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        color: rgba(255, 255, 255, .58); font-size: 10px; font-weight: 600; text-decoration: none;
        overflow: hidden; white-space: nowrap;
    }
    .bottom-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .bottom-nav a svg { width: 21px; height: 21px; flex: none; }
    .bottom-nav a.active { color: var(--gold); }
    .bottom-nav a.active svg { filter: drop-shadow(0 0 8px rgba(251, 191, 36, .5)); }
}

@media (max-width: 400px) {
    .brand span { display: none; }
    .hero::after { font-size: 84px; }
}
@media (max-width: 340px) {
    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

/* aman untuk perangkat yang mengurangi animasi */
@media (prefers-reduced-motion: no-preference) {
    .card, .stat { transition: box-shadow .2s ease; }
}
