/* ===== WGN Apps — Galeri Akses Cepat ===== */

:root {
  --bg-1: #eef1f6;
  --bg-2: #dfe4ec;
  --bg-3: #cfd6e2;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-brd: rgba(255, 255, 255, 0.9);
  --card: rgba(255, 255, 255, 0.78);
  --card-brd: rgba(255, 255, 255, 0.95);
  --ink: #1f2733;
  --ink-soft: #5b6676;
  --ink-faint: #8a94a3;
  --field: rgba(255, 255, 255, 0.6);
  --field-brd: rgba(160, 170, 190, 0.35);
  --shadow-lg: 0 30px 60px -20px rgba(31, 42, 70, 0.35);
  --shadow-card: 0 10px 28px -12px rgba(31, 42, 70, 0.28);
  --shadow-tile: 0 14px 30px -8px rgba(0, 0, 0, 0.35);
  --radius: 26px;
}

/* Dark mode */
:root:not([data-theme="light"]) {
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-1: #10151e;
    --bg-2: #161d29;
    --bg-3: #1e2838;
    --panel: rgba(28, 36, 50, 0.72);
    --panel-brd: rgba(255, 255, 255, 0.08);
    --card: rgba(38, 48, 65, 0.6);
    --card-brd: rgba(255, 255, 255, 0.08);
    --ink: #eef2f8;
    --ink-soft: #b3bdcc;
    --ink-faint: #7f8b9c;
    --field: rgba(255, 255, 255, 0.06);
    --field-brd: rgba(255, 255, 255, 0.12);
    --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, 0.7);
    --shadow-card: 0 12px 30px -14px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-1: #10151e;
  --bg-2: #161d29;
  --bg-3: #1e2838;
  --panel: rgba(28, 36, 50, 0.72);
  --panel-brd: rgba(255, 255, 255, 0.08);
  --card: rgba(38, 48, 65, 0.6);
  --card-brd: rgba(255, 255, 255, 0.08);
  --ink: #eef2f8;
  --ink-soft: #b3bdcc;
  --ink-faint: #7f8b9c;
  --field: rgba(255, 255, 255, 0.06);
  --field-brd: rgba(255, 255, 255, 0.12);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, 0.7);
  --shadow-card: 0 12px 30px -14px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 78% -8%, var(--bg-1), transparent 60%),
    radial-gradient(1000px 800px at -10% 110%, var(--bg-3), transparent 55%),
    linear-gradient(145deg, var(--bg-2), var(--bg-1));
  background-attachment: fixed;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(14px, 4vw, 56px) clamp(12px, 3.5vw, 16px);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* Sinar diagonal seperti pada referensi */
.beam {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.35) 46%, rgba(255, 255, 255, 0.08) 56%, transparent 66%);
  mix-blend-mode: screen;
  opacity: 0.8;
  z-index: 0;
}
@media (prefers-color-scheme: dark) { .beam { opacity: 0.22; } }
:root[data-theme="dark"] .beam { opacity: 0.22; }
:root[data-theme="light"] .beam { opacity: 0.8; }

/* ===== Panel utama ===== */
.panel {
  position: relative;
  z-index: 1;
  width: min(880px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-brd);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  padding: clamp(18px, 3.2vw, 30px);
}

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--field-brd);
}
.brand { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 48px; height: 48px; flex: none;
  border-radius: 14px;
  object-fit: contain;
  padding: 5px;
  background: #fff;
  border: 1px solid rgba(160, 170, 190, 0.3);
  box-shadow: 0 8px 18px -8px rgba(31, 42, 70, 0.45);
}
.brand-text h1 { margin: 0; font-size: clamp(20px, 3.4vw, 26px); font-weight: 800; letter-spacing: -0.3px; }
.brand-text p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-soft); }

.tools { display: flex; align-items: center; gap: 10px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--field);
  border: 1px solid var(--field-brd);
  border-radius: 999px;
  padding: 9px 14px;
  min-width: 190px;
}
.search-ic { width: 17px; height: 17px; color: var(--ink-faint); flex: none; }
.search input {
  border: 0; background: transparent; outline: none;
  color: var(--ink); font-size: 14px; width: 100%;
}
.search input::placeholder { color: var(--ink-faint); }
.icon-btn {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px; cursor: pointer;
  background: var(--field);
  border: 1px solid var(--field-brd);
  color: var(--ink-soft);
  transition: transform .15s ease, color .15s ease;
}
.icon-btn:hover { transform: translateY(-1px); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ===== Kartu aplikasi utama ===== */
.featured {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  padding: 24px 0 6px;
}
.app-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--card-brd);
  border-radius: 22px;
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-card);
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
  overflow: hidden;
}
.app-card:focus-visible { outline: 3px solid #6366f1; outline-offset: 2px; }
.app-card:active { transform: scale(0.98); }
@media (hover: hover) {
  .app-card:hover { transform: translateY(-4px); box-shadow: 0 22px 44px -16px rgba(31, 42, 70, 0.4); }
}
.app-card .card-name { font-weight: 700; font-size: 16px; letter-spacing: -0.2px; }
.app-card .card-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; min-height: 30px; }
.tile {
  margin-top: 14px;
  height: 108px;
  border-radius: 18px;
  display: grid; place-items: center;
  font-size: 46px; line-height: 1;
  color: #fff;
  box-shadow: var(--shadow-tile);
  position: relative;
}
.tile .badge {
  position: absolute; top: -9px; left: -9px;
  min-width: 27px; height: 27px; padding: 0 7px;
  border-radius: 999px;
  background: #ef4444; color: #fff;
  font-size: 13px; font-weight: 800; line-height: 27px;
  text-align: center;
  box-shadow: 0 4px 10px -3px rgba(0,0,0,.4);
  border: 2px solid #fff;
}
.tile .go {
  position: absolute; right: 12px; bottom: 10px;
  font-size: 13px; font-weight: 700; opacity: .85;
  display: inline-flex; align-items: center; gap: 3px;
}

/* Tema warna tile */
.t-green  { background: linear-gradient(145deg, #3ee08a, #10b981); }
.t-indigo { background: linear-gradient(145deg, #8b93ff, #5b63f5); }
.t-orange { background: linear-gradient(145deg, #ffb24d, #f97316); }
.t-blue   { background: linear-gradient(145deg, #58b6ff, #2f7cf6); }
.t-purple { background: linear-gradient(145deg, #c084fc, #8b5cf6); }
.t-pink   { background: linear-gradient(145deg, #fb7bb5, #ec4899); }
.t-teal   { background: linear-gradient(145deg, #4fd6c7, #0ea5a5); }
.t-red    { background: linear-gradient(145deg, #ff8080, #ef4444); }
.t-slate  { background: linear-gradient(145deg, #94a3b8, #475569); }

/* ===== Daftar semua aplikasi ===== */
.list-panel {
  margin-top: 22px;
  background: var(--card);
  border: 1px solid var(--card-brd);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.list-head h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.2px; }
.count-pill {
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  background: var(--field); border: 1px solid var(--field-brd);
  padding: 4px 11px; border-radius: 999px;
}
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 4px 24px;
}
.row {
  display: flex; align-items: center; gap: 13px;
  text-decoration: none; color: inherit;
  padding: 12px 8px;
  border-radius: 14px;
  border-bottom: 1px solid var(--field-brd);
  transition: background .14s ease, transform .14s ease;
}
.row:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
.row:active { background: var(--field); }
@media (hover: hover) {
  .row:hover { background: var(--field); transform: translateX(2px); }
}
.row-ic {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px; display: grid; place-items: center;
  font-size: 19px; color: #fff;
  box-shadow: 0 6px 14px -6px rgba(0,0,0,.4);
}
.row-txt { flex: 1; min-width: 0; }
.row-name { font-weight: 650; font-size: 14.5px; }
.row-desc { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-arrow { color: var(--ink-faint); flex: none; }
.row-arrow svg { width: 18px; height: 18px; display: block; }

.empty { text-align: center; color: var(--ink-soft); padding: 18px 0 4px; font-size: 14px; }

/* ===== Footer ===== */
.foot {
  margin-top: 18px; text-align: center;
  font-size: 12px; color: var(--ink-faint);
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.foot .dot { opacity: .5; }

/* ===== FAB & popover ===== */
.fab {
  position: fixed;
  right: max(clamp(16px, 4vw, 40px), env(safe-area-inset-right));
  bottom: max(clamp(16px, 4vw, 40px), env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  border: 0; cursor: pointer; z-index: 5;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 16px 30px -10px rgba(99, 102, 241, 0.8);
  display: grid; place-items: center;
  transition: transform .18s ease;
}
.fab:hover { transform: translateY(-3px) rotate(90deg); }
.fab svg { width: 24px; height: 24px; }

.modal-wrap {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(10, 15, 25, 0.5);
  display: grid; place-items: center; padding: 16px;
  backdrop-filter: blur(4px);
  overflow-y: auto;
}
.modal-wrap[hidden] { display: none; }
.modal {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--panel-brd);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px) saturate(140%);
}
.modal h3 { margin: 0 0 6px; font-size: 19px; font-weight: 800; letter-spacing: -0.2px; }
.modal .muted { margin: 0 0 16px; font-size: 13px; color: var(--ink-faint); }
.modal-x {
  position: absolute; top: 12px; right: 14px;
  width: 34px; height: 34px; border-radius: 10px;
  border: 0; cursor: pointer; font-size: 22px; line-height: 1;
  background: var(--field); color: var(--ink-soft);
}
.modal-x:hover { color: var(--ink); }

.fld { display: block; margin-bottom: 13px; }
.fld > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.fld input, .fld select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--field-brd);
  background: var(--field);
  color: var(--ink);
  font-size: 14px;
  outline: none;
}
.fld input:focus, .fld select:focus { border-color: #6366f1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.btn-primary {
  margin-top: 6px; width: 100%;
  padding: 12px; border: 0; border-radius: 12px; cursor: pointer;
  font-weight: 700; font-size: 14.5px; color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost {
  border: 1px solid var(--field-brd); background: var(--field);
  color: var(--ink-soft); font-weight: 600; font-size: 13px;
  padding: 7px 14px; border-radius: 10px; cursor: pointer;
}
.btn-ghost:hover { color: var(--ink); }

.err { margin: 0 0 10px; font-size: 13px; color: #ef4444; font-weight: 600; }

.manage-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.manage-head h3 { margin: 0; }
.add-form { padding-bottom: 6px; border-bottom: 1px solid var(--field-brd); }
.manage-list-head { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 16px 0 8px; }
.manage-list { display: flex; flex-direction: column; gap: 6px; }
.m-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 12px;
  background: var(--field); border: 1px solid var(--field-brd);
}
.m-ic {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: grid; place-items: center; font-size: 16px; color: #fff;
}
.m-txt { flex: 1; min-width: 0; }
.m-name { font-weight: 650; font-size: 14px; }
.m-url { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-del {
  flex: none; width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  border: 0; background: rgba(239, 68, 68, 0.12); color: #ef4444;
  display: grid; place-items: center;
}
.m-del:hover { background: rgba(239, 68, 68, 0.2); }
.m-del svg { width: 17px; height: 17px; }
.m-empty { font-size: 13px; color: var(--ink-faint); padding: 6px 2px; }

@media (max-width: 420px) {
  .grid2 { grid-template-columns: 1fr; }
}

/* ===== Skeleton ===== */
.skeleton-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; }
.sk-card { height: 190px; border-radius: 22px; background: var(--card); border: 1px solid var(--card-brd); animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: .9; } }

/* ===== Tablet ===== */
@media (max-width: 900px) {
  .panel { border-radius: 22px; }
  .list-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

/* ===== Mobile (full-bleed, terasa seperti app) ===== */
@media (max-width: 600px) {
  body {
    padding: 0;
    align-items: stretch;
  }
  .panel {
    width: 100%;
    min-height: 100dvh;
    border-radius: 0;
    border-left: 0; border-right: 0; border-top: 0;
    box-shadow: none;
    padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
             calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .topbar {
    padding-bottom: 16px;
    gap: 12px;
  }
  .brand { gap: 12px; }
  .avatar { width: 44px; height: 44px; }
  .brand-text h1 { font-size: 22px; }
  .tools { width: 100%; }
  .search { flex: 1; min-width: 0; }

  .featured {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 18px 0 4px;
  }
  .app-card { padding: 14px 14px 16px; border-radius: 18px; }
  .app-card .card-name { font-size: 15px; }
  .app-card .card-sub { font-size: 11.5px; min-height: 32px; }
  .tile { height: 96px; font-size: 40px; border-radius: 15px; }
  .tile .go { font-size: 12px; }

  .list-panel { padding: 16px; border-radius: 18px; margin-top: 16px; }
  .list-grid { grid-template-columns: 1fr; gap: 2px; }
  .row { padding: 13px 6px; }

  .skeleton-row { grid-template-columns: 1fr 1fr; }
  .sk-card { height: 150px; }
}

/* ===== HP kecil ===== */
@media (max-width: 380px) {
  .featured { grid-template-columns: 1fr; }
  .tile { height: 110px; font-size: 46px; }
  .brand-text p { font-size: 12px; }
}
