/* =====================================================================
   layout-polish.css — v46
   Lapisan perapihan UI yang berlaku ke SEMUA halaman tool.
   Hanya menambah/menyempurnakan komponen yang sudah ada (panel, field,
   slider, tombol, sidebar) tanpa mengubah struktur HTML tiap halaman.
   Dimuat paling akhir, jadi aturan di sini menang atas style dasar.
   ===================================================================== */

/* ---- Top nav --------------------------------------------------------- */
.fp-topnav { max-width: min(1420px, calc(100vw - 32px)); }
.fp-navlinks { flex-wrap: wrap; row-gap: 8px; }

/* ---- Kerangka halaman ----------------------------------------------- */
.app-shell { align-items: start; gap: clamp(16px, 2vw, 24px); }
.main-stage { min-width: 0; }

/* Sidebar kontrol: rapikan scrollbar. Posisi sticky/tinggi tetap diatur
   oleh CSS spesifik tiap halaman (p2w & standings) supaya tidak bentrok
   dengan tinggi topnav masing-masing. */
.sidebar {
  align-self: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar::-webkit-scrollbar { width: 9px; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.16); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(29,212,255,.40); background-clip: padding-box; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

/* ---- Panel ----------------------------------------------------------- */
.panel {
  border: 1px solid rgba(255,255,255,.085);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
  padding: clamp(15px, 1.4vw, 18px);
}
.brand-card, .canvas-stage { border: 1px solid rgba(255,255,255,.085); }

/* Judul panel diberi penanda aksen kecil agar hirarki terbaca. */
.panel-head, .compact-panel-head, .preview-header { gap: 12px; }
.panel-head { margin-bottom: 13px; }
.panel h2 {
  position: relative;
  padding-left: 12px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.panel h2::before {
  content: "";
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 16px; border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #2f8bff);
}

/* Sub judul antar grup dalam satu panel. */
.subsection-title {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 0 10px;
  font-size: 11px; letter-spacing: .08em;
}
.subsection-title::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(29,212,255,.16); flex: 0 0 auto;
}

/* ---- Field & input --------------------------------------------------- */
.field { gap: 7px; margin-bottom: 11px; }
.field span, .range-head span { letter-spacing: .02em; }

.field input, .field select, .field textarea,
input[type="text"], input[type="number"], select, input[type="file"] {
  min-height: 42px;
  border-radius: 11px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input[type="text"]:hover, input[type="number"]:hover, select:hover { border-color: rgba(255,255,255,.22); }
select { cursor: pointer; }

/* ---- Slider (range) konsisten lintas browser ------------------------- */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 26px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: rgba(255,255,255,.14);
}
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 999px; background: rgba(255,255,255,.14);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: #eaf9ff; border: 3px solid var(--accent);
  box-shadow: 0 3px 8px rgba(0,0,0,.32); transition: transform .12s ease;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #eaf9ff; border: 3px solid var(--accent);
  box-shadow: 0 3px 8px rgba(0,0,0,.32);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.08); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(29,212,255,.20); }

/* ---- Mini control (slider + nilai) ----------------------------------- */
.compact-control-list { gap: 9px; }
.mini-control {
  display: grid; gap: 6px;
  padding: 9px 11px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
}
.mini-control-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 4px 6px; flex-wrap: wrap; row-gap: 3px;
}
.mini-control-head span {
  font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .01em;
  flex: 1 1 auto; min-width: 0; line-height: 1.15;
  white-space: nowrap; word-break: keep-all; overflow-wrap: normal;
}
.mini-control-head strong {
  font-size: 12px; font-weight: 800; color: var(--text);
  background: rgba(29,212,255,.12); border: 1px solid rgba(29,212,255,.22);
  padding: 2px 7px; border-radius: 999px; min-width: 30px; text-align: center;
  flex: 0 0 auto; margin-left: auto;
}

/* ---- Toggle switch (checkbox jadi sakelar) --------------------------- */
.checkbox-row { gap: 11px; margin-top: 12px; font-size: 13px; }
.checkbox-row input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  width: 42px; height: 24px; border-radius: 999px; flex: 0 0 auto;
  background: rgba(255,255,255,.16); border: 1px solid var(--line);
  position: relative; cursor: pointer; transition: background .16s ease, border-color .16s ease;
}
.checkbox-row input[type="checkbox"]::after {
  content: ""; position: absolute; top: 50%; left: 3px; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.35); transition: left .16s ease;
}
.checkbox-row input[type="checkbox"]:checked { background: linear-gradient(135deg, var(--accent), #3dbbff); border-color: transparent; }
.checkbox-row input[type="checkbox"]:checked::after { left: 21px; }
.checkbox-row input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(29,212,255,.18); }
.toggle-row { font-weight: 700; }

/* Grup kontrol yang bisa diredupkan ketika fiturnya dimatikan. */
.control-group { transition: opacity .15s ease; }
.control-group.is-disabled { opacity: .42; pointer-events: none; filter: saturate(.7); }

/* Garis pemisah antar sub-bagian dalam satu panel. */
.ptw-divider { height: 1px; margin: 14px 0; background: rgba(255,255,255,.09); border: 0; }

/* ---- Tombol ---------------------------------------------------------- */
.button-row button, .primary-btn, .secondary-btn, .ghost-btn { min-height: 42px; }
button:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(29,212,255,.22); }
.small-btn { min-height: 32px; }

/* ---- Preview / canvas ------------------------------------------------ */
.canvas-stage { padding: clamp(10px, 2vw, 22px); }
.controls-rail { align-content: start; }
.template-card { overflow: hidden; }
.template-thumb img { object-position: center; }
.hint { line-height: 1.5; }

/* =====================================================================
   Settings widget (tidak diubah)
   ===================================================================== */
.fola-settings-widget {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999; width: min(360px, calc(100vw - 36px));
  font-family: Inter, system-ui, sans-serif;
}
.fola-settings-toggle {
  margin-left: auto; display: block; border: 1px solid rgba(255,255,255,.14); border-radius: 999px;
  background: linear-gradient(135deg,#13c8ff,#0875ff); color: #fff; padding: 11px 16px; font-weight: 900;
  box-shadow: 0 16px 40px rgba(0,0,0,.32); cursor: pointer;
}
.fola-settings-panel {
  margin-top: 10px; padding: 14px; border-radius: 18px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(9, 20, 31, .94); backdrop-filter: blur(14px); box-shadow: 0 22px 60px rgba(0,0,0,.38);
}
.fola-settings-title { color:#eff8ff; font-weight: 900; margin-bottom: 10px; letter-spacing: .02em; }
.fola-settings-actions { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:8px; }
.fola-settings-actions button {
  border:1px solid rgba(255,255,255,.11); background:rgba(255,255,255,.06); color:#e8f7ff; border-radius:12px; padding:9px 10px;
  cursor:pointer; font-weight:800; font-size:12px;
}
.fola-settings-actions button:hover { background:rgba(29,212,255,.14); }
[data-fola-settings-status] { margin:10px 0 0; color:#9eb5c7; font-size:12px; line-height:1.4; }
[data-fola-settings-status].error { color:#ffb0b0; }

/* =====================================================================
   Responsif
   ===================================================================== */
@media (max-width: 980px){
  .app-shell, .daily-recap-page .app-shell { grid-template-columns: 1fr !important; }
  .sidebar { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .main-stage { min-width: 0; }
}
@media (max-width: 640px){
  .fp-topnav { margin-top: 10px; }
  .fp-brand small, .fp-topnav-meta { display:none; }
  .fola-settings-widget { right: 12px; bottom: 12px; }
  .grid.two { grid-template-columns: 1fr; }
}


/* =====================================================================
   v47 top navigation polish
   - Header full width lagi (tidak berhenti di 1420px pada layar besar).
   - Spacing logo, menu, dan canvas chip dibuat lebih seimbang.
   ===================================================================== */
.fp-topnav {
  width: 100% !important;
  max-width: none !important;
  min-height: 74px;
  padding: 12px clamp(18px, 2.6vw, 36px);
  gap: clamp(14px, 2vw, 26px);
  border-bottom: 1px solid rgba(29,212,255,.18);
  background:
    linear-gradient(90deg, rgba(5,18,33,.98) 0%, rgba(8,42,72,.96) 50%, rgba(5,18,33,.98) 100%),
    rgba(3, 12, 24, .96);
  box-shadow: 0 10px 30px rgba(0,0,0,.26);
}
.fp-brand {
  flex: 0 0 auto;
  min-width: 248px;
  gap: 12px;
}
.fp-logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 26px;
}
.fp-brand strong { font-size: 21px; }
.fp-brand small { margin-top: 5px; letter-spacing: .13em; }
.fp-navlinks {
  flex: 1 1 auto;
  justify-content: center;
  gap: 6px;
  padding: 4px;
  border-radius: 18px;
  background: rgba(0, 0, 0, .10);
  border: 1px solid rgba(255,255,255,.055);
}
.fp-navlinks a {
  min-height: 36px;
  padding: 9px 13px;
  border-radius: 12px;
  letter-spacing: .01em;
}
.fp-navlinks a.active {
  box-shadow: inset 0 0 0 1px rgba(29,212,255,.12), 0 8px 22px rgba(0,0,0,.18);
}
.fp-topnav-meta {
  flex: 0 0 auto;
  min-width: 118px;
  min-height: 36px;
  padding: 0 16px;
  justify-self: end;
}

.dashboard-page .dash-topbar {
  padding: 14px 16px;
  border-radius: 22px;
  gap: clamp(14px, 2vw, 24px);
  background: linear-gradient(90deg, rgba(3,12,24,.78), rgba(8,42,72,.66), rgba(3,12,24,.78));
}
.dashboard-page .dash-brand { flex: 0 0 auto; min-width: 248px; }
.dashboard-page .dash-logo-mark { width: 48px; height: 48px; }
.dashboard-page .dash-brand-text strong { font-size: 24px; }
.dashboard-page .dash-nav {
  flex: 1 1 auto;
  justify-content: center;
  padding: 4px;
  border-radius: 18px;
  background: rgba(0,0,0,.10);
  border: 1px solid rgba(255,255,255,.055);
}
.dashboard-page .dash-nav a { min-height: 36px; padding: 9px 13px; }

@media (max-width: 1180px) {
  .fp-brand { min-width: 210px; }
  .fp-navlinks { order: 3; width: 100%; justify-content: flex-start; }
  .fp-topnav { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .fp-topnav { padding: 12px; gap: 10px; }
  .fp-brand { min-width: 0; }
  .fp-navlinks { flex-wrap: nowrap; overflow-x: auto; }
  .fp-logo-mark { width: 40px; height: 40px; }
  .fp-brand strong { font-size: 20px; }
}
