/* ============================================================
 * KOPASUS IT HUB - css/app.css
 * Fondasi tampilan: token warna, kerangka aplikasi (sidebar,
 * topbar, konten), navigasi, dan animasi ringan.
 * Tema terang bergaya konsol modern.
 * ============================================================ */

:root {
  color-scheme: light;

  /* Permukaan */
  --bg: #f5f6fb;
  --bg-soft: #eef0f7;
  --bg-elev: #ffffff;
  --bg-elev-2: #f7f8fc;
  --line: #ecedf4;
  --line-strong: #dcdfeb;
  --topbar-bg: rgba(255, 255, 255, .88);

  /* Teks */
  --text: #1e2338;
  --text-dim: #6b7280;
  --text-faint: #9aa1b1;

  /* Aksen (dioverride per divisi) */
  --accent: #5b53e0;
  --accent-2: #7c5cf0;
  --accent-soft: #eef0ff;
  --accent-ink: #ffffff;

  /* Status */
  --ok: #16a34a;        --ok-soft: #e8f7ee;
  --warn: #d97706;      --warn-soft: #fff4e3;
  --danger: #e5484d;    --danger-soft: #fdecec;
  --info: #3b82f6;      --info-soft: #eaf1ff;

  /* Bentuk & gerak */
  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 20px;
  --shadow-soft: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 10px 28px -18px rgba(21, 27, 58, .35), 0 1px 2px rgba(16, 24, 40, .05);
  --ease: cubic-bezier(.22, .8, .3, 1);
  --tap: 44px;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;

  --topbar-h: 64px;
  --bottomnav-h: 64px;
  --sidebar-w: 262px;
}

/* Tema per divisi */
[data-division="RPL"] { --accent: #5b53e0; --accent-2: #7c5cf0; --accent-soft: #eef0ff; }
[data-division="TKJ"] { --accent: #0e7490; --accent-2: #22a6c3; --accent-soft: #e4f6fb; }
[data-division="MM"]  { --accent: #be2a72; --accent-2: #e0559a; --accent-soft: #fdeaf3; }

/* ===== Tema Gelap (Dark Mode) ===== */
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0f1117;
  --bg-soft: #161923;
  --bg-elev: #1a1d29;
  --bg-elev-2: #212533;
  --line: #262a38;
  --line-strong: #333849;
  --topbar-bg: rgba(20, 23, 32, .90);

  --text: #e7e9f2;
  --text-dim: #a2a8bd;
  --text-faint: #6f7689;

  --accent-soft: #23233f;
  --accent-ink: #ffffff;

  --ok: #34d399;        --ok-soft: #10291f;
  --warn: #fbbf24;      --warn-soft: #2c2410;
  --danger: #f87171;    --danger-soft: #2f1618;
  --info: #60a5fa;      --info-soft: #14213b;

  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 12px 30px -18px rgba(0, 0, 0, .7), 0 1px 2px rgba(0, 0, 0, .5);
}
/* Aksen soft per divisi saat gelap (agar kontras tetap enak) */
[data-theme="dark"][data-division="RPL"] { --accent-soft: #23233f; }
[data-theme="dark"][data-division="TKJ"] { --accent-soft: #0e2a31; }
[data-theme="dark"][data-division="MM"]  { --accent-soft: #331328; }

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0; color: var(--text); background: var(--bg);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}

h1 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 4px; font-weight: 800; }
h2 { font-size: 18px; margin: 0 0 8px; font-weight: 750; }
h3 { font-size: 15.5px; margin: 0 0 8px; font-weight: 700; }
p  { margin: 0 0 10px; }
a  { color: var(--accent); }

.mono  { font-family: var(--font-mono); }
.dim   { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.grow  { flex: 1; min-width: 0; }
.sub   { font-size: 12.5px; color: var(--text-dim); }
.hint  { font-size: 12.5px; color: var(--text-faint); margin: 6px 0 0; }
.title { font-weight: 650; font-size: 14.5px; }
.tight { margin: 0; }

.section-title {
  font-size: 11.5px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); margin: 22px 0 10px;
}

/* ---------------- KERANGKA ---------------- */

.layout { display: flex; min-height: 100vh; }

.main-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ---------------- SIDEBAR ---------------- */

.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--bg-elev);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 16px; border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff; font: 800 15px var(--font-mono); letter-spacing: .5px;
  box-shadow: 0 8px 18px -10px var(--accent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; }
.division-tag { font-style: normal; font-size: 12px; color: var(--text-faint); }

.nav-desktop {
  flex: 1; overflow-y: auto; padding: 12px 12px 18px; display: flex; flex-direction: column; gap: 3px;
}
.nav-group-label {
  font-size: 10.5px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); padding: 16px 10px 7px;
}
.nav-group-label:first-child { padding-top: 4px; }

.nav-desktop button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 11px; min-height: var(--tap); border: 0; background: transparent;
  color: var(--text-dim); border-radius: var(--radius-sm); cursor: pointer;
  font: 600 14px var(--font-sans); text-align: left; position: relative;
}
.nav-desktop button .ic {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 9px; background: var(--bg-elev-2); font-size: 15px;
  transition: background-color .16s var(--ease), transform .16s var(--ease);
}
.nav-desktop button:hover { background: var(--bg-elev-2); color: var(--text); }
.nav-desktop button[aria-current="page"] {
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.nav-desktop button[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-desktop button[aria-current="page"] .ic { background: #fff; transform: scale(1.03); }

.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }

/* ---------------- TOPBAR ---------------- */

.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 18px; background: var(--topbar-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
}
.topbar .brand { display: none; align-items: center; gap: 10px; }
.topbar .brand .brand-mark { width: 34px; height: 34px; border-radius: 11px; font-size: 12px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.wib-clock {
  display: inline-flex; align-items: center; gap: 7px;
  font: 600 12.5px var(--font-mono); color: var(--text-dim);
  background: var(--bg-elev); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px; box-shadow: var(--shadow-soft);
}
.wib-clock::before { content: "🕘"; font-size: 12px; }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text-dim); font-size: 16px; position: relative; box-shadow: var(--shadow-soft);
  transition: border-color .16s var(--ease), transform .16s var(--ease), color .16s var(--ease);
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); transform: translateY(-1px); }
.icon-btn.notif .badge-count {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font: 700 10.5px var(--font-sans); display: grid; place-items: center;
  border: 2px solid var(--bg-elev);
}
#profile-btn { border: 0; background: transparent; box-shadow: none; padding: 0; width: auto; height: auto; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); font: 700 13px var(--font-sans); text-transform: uppercase;
  letter-spacing: .3px; flex: none;
}
.avatar.sm { width: 36px; height: 36px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

/* ---------------- KONTEN ---------------- */

.view {
  flex: 1; padding: 22px 26px 30px; max-width: 1320px; width: 100%; margin: 0 auto; outline: none;
}
.app-foot {
  padding: 16px 26px 22px; font-size: 12px; color: var(--text-faint);
  display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line);
  background: var(--bg-elev);
}

/* ---------------- BOTTOM NAV (mobile) ---------------- */

.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--topbar-bg); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.bottom-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--text-faint); font: 600 10.5px var(--font-sans);
  cursor: pointer; min-height: var(--tap);
}
.bottom-nav button .ic { font-size: 19px; transition: transform .18s var(--ease); }
.bottom-nav button[aria-current="page"] { color: var(--accent); font-weight: 700; }
.bottom-nav button[aria-current="page"] .ic { transform: translateY(-2px) scale(1.08); }

/* ---------------- ANIMASI ---------------- */

@keyframes viewIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade   { from { opacity: 0; } to { opacity: 1; } }
.view-enter { animation: viewIn .28s var(--ease) both; }
.fade-in    { animation: viewIn .22s var(--ease) both; }
.card-anim  { animation: cardIn .32s var(--ease) both; }

.btn, .row-item, .tile, .card, .nav-desktop button, .icon-btn, .chip, .tabs button, .stat {
  transition: transform .16s var(--ease), background-color .16s var(--ease),
              border-color .16s var(--ease), box-shadow .16s var(--ease), color .16s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
