/* FRAI-PWA-V1 · layout.css — shell navigasi 4 sisi: topbar, sidebar kiri, rail kanan, bottom bar */

/* ================= TOPBAR ================= */
.topbar{
  position:fixed; top:0; left:0; right:0; height:var(--topbar-h); z-index:var(--z-topbar);
  display:flex; align-items:center; gap:10px; padding:0 12px;
  background:var(--glass); backdrop-filter:blur(18px) saturate(160%);
  border-bottom:1px solid var(--glass-line);
  padding-top:env(safe-area-inset-top);
  height:calc(var(--topbar-h) + env(safe-area-inset-top));
}
.brand-lockup{ display:flex; align-items:center; gap:9px; font-weight:800; letter-spacing:-.02em; }
.brand-mark{
  width:32px; height:32px; border-radius:10px; background:var(--grad-ai);
  display:grid; place-items:center; color:#fff; box-shadow:0 4px 12px rgba(16,185,129,.35);
  flex:0 0 auto;
}
.brand-mark svg{ width:19px; height:19px; }
.brand-name{ font-size:15.5px; }
.brand-name span{ color:var(--primary); }

.topbar-search{
  display:none; flex:1; max-width:520px; margin:0 auto;
}
@media (min-width:900px){ .topbar-search{ display:block; } }
.search-box{
  display:flex; align-items:center; gap:9px; height:42px; padding:0 14px;
  background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-pill);
  color:var(--muted); cursor:text; width:100%;
  transition:border-color var(--dur), background var(--dur);
}
.search-box:hover{ border-color:var(--line-strong); background:var(--surface); }
.search-box svg{ width:18px; height:18px; flex:0 0 auto; }
.search-box input{
  border:0; background:none; outline:none; width:100%; font-size:14px; color:var(--text);
}
.search-box kbd{
  font-family:var(--font-num); font-size:11px; padding:2px 6px; border-radius:6px;
  background:var(--surface-3); color:var(--muted); border:1px solid var(--line);
}

.topbar-actions{ display:flex; align-items:center; gap:2px; margin-left:auto; }

/* ================= SIDEBAR KIRI ================= */
.sidebar{
  position:fixed; top:0; bottom:0; left:0; width:var(--sidebar-w); z-index:var(--z-sidebar);
  background:var(--surface); border-right:1px solid var(--line);
  display:none; flex-direction:column; padding:0 12px;
  transition:width var(--dur-2) var(--ease);
}
@media (min-width:1024px){ .sidebar{ display:flex; } }
.sidebar-head{
  height:var(--topbar-h); display:flex; align-items:center; gap:9px; padding:0 6px;
  padding-top:env(safe-area-inset-top); flex:0 0 auto;
}
.sidebar-scroll{ flex:1; overflow-y:auto; padding:8px 0 16px; }
.nav-group-label{
  font-size:11px; font-weight:800; letter-spacing:.08em; text-transform:uppercase;
  color:var(--muted); padding:14px 12px 6px;
}
.nav-item{
  display:flex; align-items:center; gap:11px; height:44px; padding:0 12px;
  border-radius:var(--r-md); color:var(--text-2); font-weight:650; font-size:14px;
  transition:background var(--dur), color var(--dur);
  position:relative; width:100%;
}
.nav-item svg{ width:20px; height:20px; flex:0 0 auto; }
.nav-item:hover{ background:var(--surface-2); color:var(--text); }
.nav-item.is-active{ background:var(--primary-soft); color:var(--primary-600); font-weight:750; }
[data-theme="dark"] .nav-item.is-active{ color:#6EE7B7; background:#07271C; }
.nav-item.is-active::before{
  content:''; position:absolute; left:-12px; top:50%; transform:translateY(-50%);
  width:3px; height:20px; border-radius:0 3px 3px 0; background:var(--primary);
}
.nav-badge{
  margin-left:auto; font-size:10.5px; font-weight:800; padding:2px 7px; border-radius:999px;
  background:var(--grad-ai); color:#fff;
}
.sidebar-foot{ padding:10px 0 16px; border-top:1px solid var(--line); flex:0 0 auto; }

/* event switcher di sidebar */
.event-switch{
  display:flex; align-items:center; gap:10px; width:100%; padding:9px 11px; margin:6px 0 2px;
  border-radius:var(--r-md); background:var(--surface-2); border:1px solid var(--line);
  text-align:left; transition:border-color var(--dur), background var(--dur);
}
.event-switch:hover{ border-color:var(--primary); }
.event-switch .dot{ width:9px; height:9px; border-radius:50%; flex:0 0 auto; }
.event-switch .t{ font-size:13.5px; font-weight:750; }
.event-switch .s{ font-size:11.5px; color:var(--muted); }

/* ================= RAIL KANAN ================= */
.rail{
  position:fixed; top:calc(var(--topbar-h) + env(safe-area-inset-top)); bottom:0; right:0;
  width:var(--rail-w); z-index:var(--z-rail);
  display:none; flex-direction:column; align-items:center; gap:4px;
  padding:14px 0; border-left:1px solid var(--line); background:var(--surface);
}
@media (min-width:1024px){ .rail{ display:flex; } }
.rail-btn{
  width:44px; height:44px; border-radius:var(--r-md); display:grid; place-items:center;
  color:var(--text-2); position:relative; transition:background var(--dur), color var(--dur);
}
.rail-btn:hover{ background:var(--surface-2); color:var(--text); }
.rail-btn.is-active{ background:var(--primary-soft); color:var(--primary-600); }
[data-theme="dark"] .rail-btn.is-active{ color:#6EE7B7; background:#07271C; }
.rail-btn svg{ width:21px; height:21px; }
.rail-sep{ width:26px; height:1px; background:var(--line); margin:8px 0; }
.rail-ai{ background:var(--grad-ai); color:#fff; box-shadow:0 6px 18px rgba(99,102,241,.35); }
.rail-ai:hover{ color:#fff; transform:translateY(-1px); }

/* ================= BOTTOM BAR (mobile) ================= */
.bottombar{
  position:fixed; left:0; right:0; bottom:0; z-index:var(--z-bottombar);
  height:calc(var(--bottombar-h) + env(safe-area-inset-bottom));
  padding-bottom:env(safe-area-inset-bottom);
  display:flex; align-items:stretch; justify-content:space-around;
  background:var(--glass); backdrop-filter:blur(18px) saturate(160%);
  border-top:1px solid var(--glass-line);
}
@media (min-width:1024px){ .bottombar{ display:none; } }
.bb-item{
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  color:var(--muted); font-size:10.5px; font-weight:700; position:relative;
  transition:color var(--dur);
}
.bb-item svg{ width:22px; height:22px; }
.bb-item.is-active{ color:var(--primary); }
.bb-item.is-active::after{
  content:''; position:absolute; top:0; left:50%; transform:translateX(-50%);
  width:26px; height:3px; border-radius:0 0 3px 3px; background:var(--primary);
}
.bb-ai{
  flex:0 0 auto; width:auto; display:flex; align-items:center; justify-content:center;
}
.bb-ai-inner{
  height:46px; padding:0 15px 0 13px; border-radius:17px; background:var(--grad-ai);
  display:inline-flex; align-items:center; justify-content:center; gap:7px; color:#fff; margin-top:-16px;
  box-shadow:0 8px 22px rgba(99,102,241,.42); border:3px solid var(--bg);
  transition:transform var(--dur) var(--ease);
  font-size:12.5px; font-weight:800; letter-spacing:.1px; white-space:nowrap;
}
.bb-ai-inner:active{ transform:scale(.94); }
.bb-ai-inner svg{ width:20px; height:20px; flex:0 0 auto; }
.bb-ai-txt{ font:inherit; color:inherit; }
/* Layar sangat sempit (≤360px): teks disembunyikan, kembali jadi tombol bulat. */
@media (max-width:360px){
  .bb-ai-txt{ display:none; }
  .bb-ai-inner{ width:50px; height:50px; padding:0; border-radius:17px; }
}

/* ================= MAIN ================= */
.main{
  min-height:100vh;
  padding-top:calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-bottom:calc(var(--bottombar-h) + env(safe-area-inset-bottom) + 12px);
}
@media (min-width:1024px){
  .main{ padding-left:var(--sidebar-w); padding-right:var(--rail-w); padding-bottom:24px; }
}
.page{ max-width:1180px; margin:0 auto; padding:18px 16px 20px; }
@media (min-width:768px){ .page{ padding:24px 26px 12px; } }
.page-wide{ max-width:1400px; }

.page-head{ display:flex; align-items:flex-start; gap:14px; margin-bottom:16px; }
.page-head h1{ font-size:clamp(22px,3.6vw,30px); }
.page-head .sub{ color:var(--muted); font-size:13.5px; margin-top:4px; }

/* bagian */
.section{ margin:22px 0; }
.section-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.section-head h2{ font-size:17px; }
.section-head .more{ font-size:13px; font-weight:700; color:var(--primary-600); display:inline-flex; align-items:center; gap:3px; }
[data-theme="dark"] .section-head .more{ color:#6EE7B7; }

/* grid kartu */
.grid-cards{
  display:grid; gap:14px;
  grid-template-columns:repeat(auto-fill, minmax(220px, 1fr));
}
@media (max-width:520px){ .grid-cards{ grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; } }

/* horizontal scroller */
.hscroll{
  display:flex; gap:12px; overflow-x:auto; padding-bottom:8px; margin:0 -16px; padding-left:16px; padding-right:16px;
  scroll-snap-type:x proximity; scrollbar-width:none;
  /* snap awal menggeser scrollLeft ke padding-left, sehingga kartu pertama
     menempel ke tepi layar; scroll-padding mengembalikan posisi 16px. */
  scroll-padding-left:16px; scroll-padding-right:16px;
  overscroll-behavior-x:contain;
}
.hscroll::-webkit-scrollbar{ display:none; }
.hscroll > *{ scroll-snap-align:start; scroll-margin-left:16px; flex:0 0 auto; }
@media (min-width:1024px){ .hscroll{ margin:0; padding-left:0; padding-right:0; scroll-padding-left:0; scroll-padding-right:0; } .hscroll > *{ scroll-margin-left:0; } }

/* overlay drawer (mobile sidebar) */
.drawer{
  position:fixed; inset:0; z-index:calc(var(--z-sheet) + 2);
  background:var(--overlay); opacity:0; pointer-events:none; transition:opacity var(--dur-2);
}
.drawer.open{ opacity:1; pointer-events:auto; }
.drawer-panel{
  position:absolute; top:0; bottom:0; left:0; width:min(300px,84vw);
  background:var(--surface); border-right:1px solid var(--line);
  transform:translateX(-102%); transition:transform var(--dur-2) var(--ease);
  display:flex; flex-direction:column; padding:0 12px;
}
.drawer.open .drawer-panel{ transform:none; }

/* banner demo */
.demo-banner{
  display:flex; align-items:center; gap:9px; padding:9px 13px; margin-bottom:14px;
  border-radius:var(--r-md); background:var(--grad-ai-soft); border:1px solid rgba(99,102,241,.24);
  font-size:12.5px; color:var(--text-2); line-height:1.45;
}
.demo-banner svg{ width:17px; height:17px; flex:0 0 auto; color:var(--ai); }
.demo-banner b{ color:var(--text); }

/* offline pill */
.offline-pill{
  position:fixed; left:50%; transform:translateX(-50%);
  top:calc(var(--topbar-h) + env(safe-area-inset-top) + 10px);
  z-index:var(--z-toast); display:none; align-items:center; gap:7px;
  background:#0B1220; color:#fff; padding:7px 14px; border-radius:999px; font-size:12.5px; font-weight:650;
  box-shadow:var(--shadow-lg);
}
.offline-pill.show{ display:flex; }
.offline-pill svg{ width:15px; height:15px; }

/* ---------- jejak navigasi (breadcrumb) ----------
   Alur Event → Katalog → Brand dulu buntu: setelah masuk detail brand tidak ada
   jalan pulang selain tombol Back browser. Bar ini menaruh satu tombol kembali
   (satu tingkat di atas) plus jejak yang bisa diklik. */
.crumb-bar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  margin:0 0 14px;
}
.crumb-back{
  display:inline-flex; align-items:center; gap:5px; flex:0 0 auto;
  height:32px; padding:0 12px 0 9px; border-radius:999px;
  background:var(--surface); border:1px solid var(--line);
  color:var(--text-2); font-size:12.5px; font-weight:700;
  transition:background .15s, border-color .15s, color .15s;
}
.crumb-back:hover{ background:var(--surface-2); border-color:var(--line-2); color:var(--text); }
.crumb-back svg{ width:15px; height:15px; }
.crumb{
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
  font-size:12.5px; color:var(--muted); min-width:0;
}
.crumb-link{ color:var(--muted); font-weight:650; text-decoration:none; }
.crumb-link:hover{ color:var(--primary); text-decoration:underline; }
.crumb-sep{ color:var(--line-2); font-size:12px; }
.crumb-now{ color:var(--text-2); font-weight:750; }
/* Di layar sempit jejak tengah dipotong, tombol kembali tetap utuh. */
@media (max-width:520px){
  .crumb{ font-size:12px; }
  .crumb-link, .crumb-now{ max-width:42vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}
