:root{
  --bg: #17181c;
  --bg-2: #1f2025;
  --card: #202127;
  --line: #2c2d33;
  --text: #f2f2f4;
  --muted: #9a9ba3;
  --accent: #e8746f;      /* coral - default theme */
  --accent-soft: #e8746f22;
  --font-display: 'Archivo Black', 'Arial Black', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}
*{ box-sizing:border-box; }
html, body{ margin:0; padding:0; width:100%; height:100%; }
body{
  background:var(--bg); color:var(--text); font-family:var(--font-body);
  width:100vw; min-height:100dvh; overflow-x:hidden;
  display:flex;
}

/* ===== Sidebar ===== */
#sidebar{
  width:280px; min-width:280px; background:var(--bg-2); height:100dvh;
  display:flex; flex-direction:column; padding:22px 18px;
  position:fixed; top:0; left:0; z-index:40; transform:translateX(0);
  transition:transform .25s ease; border-right:1px solid var(--line);
}
.sb-title{ font-family:var(--font-display); font-size:15px; letter-spacing:.5px; margin-bottom:20px; }
.search-box{
  background:var(--card); border:1px solid var(--line); border-radius:12px;
  padding:11px 14px; display:flex; align-items:center; gap:10px; margin-bottom:18px;
}
.search-box input{ background:none; border:none; outline:none; color:var(--text); font-size:13.5px; width:100%; }
.search-box input::placeholder{ color:var(--muted); }
.nav-item{
  display:flex; align-items:center; gap:14px; padding:13px 16px; border-radius:12px;
  color:var(--muted); font-weight:700; font-size:13.5px; letter-spacing:.3px; cursor:pointer;
  margin-bottom:4px; transition:.15s; text-transform:uppercase;
}
.nav-item .ic{ width:20px; height:20px; flex-shrink:0; display:flex; align-items:center; justify-content:center; }
.nav-item .ic svg{ width:18px; height:18px; }
.nav-item:hover{ background:var(--card); color:var(--text); }
.nav-item.active{ background:var(--accent); color:#1a0e0d; }
.sb-spacer{ flex:1; }
.sb-foot{ font-size:10.5px; color:var(--muted); padding:8px 4px; line-height:1.5; }

/* ===== Overlay for mobile sidebar ===== */
#sbOverlay{ display:none; position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:35; }

/* ===== Main ===== */
#main{
  flex:1; margin-left:280px; width:calc(100vw - 280px); min-height:100dvh;
  display:flex; flex-direction:column;
}
header{
  height:64px; flex-shrink:0; border-bottom:1px solid var(--line);
  display:flex; align-items:center; gap:14px; padding:0 22px; background:var(--bg);
  position:sticky; top:0; z-index:20;
}
#menuBtn{ display:flex; align-items:center; justify-content:center; background:none; border:none; color:var(--text); font-size:20px; cursor:pointer; width:32px; height:32px; flex-shrink:0; }
.hd-title{ font-family:var(--font-display); font-size:15px; letter-spacing:.4px; }
.hd-spacer{ flex:1; }
.hd-icon{
  width:38px; height:38px; border-radius:10px; background:var(--card); border:1px solid var(--line);
  display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--muted); font-size:15px;
  position:relative;
}
.hd-icon:hover{ color:var(--text); }
.hd-icon svg{ width:18px; height:18px; }
.hd-search-wrap{ display:flex; align-items:center; }
.hd-search-input{
  width:0; opacity:0; padding:0; margin-left:0; height:38px; font-size:13px;
  background:var(--card); color:var(--text); border:1px solid transparent; border-radius:10px;
  outline:none; transition:width .25s ease, opacity .2s ease, margin-left .25s ease, padding .25s ease;
}
.hd-search-input.open{ width:200px; opacity:1; padding:0 12px; margin-left:8px; border-color:var(--line); }
.hd-search-input::placeholder{ color:var(--muted); }
@media (max-width:640px){ .hd-search-input.open{ width:120px; } }

.notif-badge{
  display:none; position:absolute; top:6px; right:6px; width:8px; height:8px;
  border-radius:50%; background:#ff4d4f; border:2px solid var(--bg);
}
.notif-badge.on{ display:block; }
#notifPanel{
  display:none; position:absolute; top:48px; right:0; width:300px; max-height:360px; overflow-y:auto;
  background:var(--card); border:1px solid var(--line); border-radius:14px; z-index:30;
  box-shadow:0 10px 30px rgba(0,0,0,.4); text-align:left;
}
#notifPanel.open{ display:block; }
.notif-head{
  padding:14px 16px 10px; font-family:var(--font-display); font-size:13px; letter-spacing:.4px;
  border-bottom:1px solid var(--line); color:var(--text);
}
.notif-item{
  padding:12px 16px; border-bottom:1px solid var(--line); cursor:default;
}
.notif-item:last-child{ border-bottom:none; }
.notif-item .n-title{ font-size:12.5px; font-weight:700; color:var(--text); margin-bottom:3px; }
.notif-item .n-desc{ font-size:11.5px; color:var(--muted); line-height:1.5; }
.notif-item .n-time{ font-size:10px; color:var(--muted); margin-top:5px; opacity:.7; }
.notif-item.unread{ background:var(--accent-soft); }
.notif-empty{ padding:26px 16px; text-align:center; color:var(--muted); font-size:12px; }
.cat-icon svg{ width:24px; height:24px; }
.avatar{
  width:36px; height:36px; border-radius:50%; background:linear-gradient(135deg,var(--accent),#7986cb);
  display:flex; align-items:center; justify-content:center; color:#fff; flex-shrink:0;
}
.avatar svg{ width:19px; height:19px; }

.content{ padding:20px; width:100%; }

/* Hero carousel - FIXED */
.hero-wrap{ 
  position:relative; 
  width:100%; 
  margin-bottom:14px; 
  border-radius:20px; 
  overflow:hidden; 
}
.hero-track{
  display:flex; 
  width:100%; 
  height:clamp(160px, 28vw, 300px); 
  touch-action:pan-y; 
  cursor:grab;
}
.hero-track.dragging{ cursor:grabbing; }
.hero-slide{
  flex:0 0 100%; width:100%; border:1px solid var(--line);
  display:flex; align-items:center; justify-content:center; text-align:center;
  padding:20px; position:relative; overflow:hidden; user-select:none; cursor:pointer;
}
.hero-slide h2{ font-family:var(--font-display); font-size:clamp(18px,4vw,28px); position:relative; z-index:1; line-height:1.3; pointer-events:none; margin:6px 0; }

.poster-demo{ flex-direction:column; gap:8px; }
.poster-ic{ width:44px; height:44px; color:rgba(255,255,255,.9); position:relative; z-index:1; margin-bottom:2px; }
.poster-eyebrow{
  font-size:11px; letter-spacing:1.5px; text-transform:uppercase; color:rgba(255,255,255,.85);
  position:relative; z-index:1;
}
.poster-sub{ font-size:12px; color:rgba(255,255,255,.75); position:relative; z-index:1; }
.hero-nav{
  position:absolute; top:50%; transform:translateY(-50%); width:36px; height:36px; border-radius:50%;
  background:rgba(0,0,0,.45); border:1px solid rgba(255,255,255,.15); color:#fff; display:flex;
  align-items:center; justify-content:center; cursor:pointer; z-index:2; font-size:16px;
}
.hero-nav.prev{ left:10px; } .hero-nav.next{ right:10px; }
.hero-nav:hover{ background:rgba(0,0,0,.7); }
.dots{ display:flex; justify-content:center; gap:6px; margin-bottom:22px; }
.dots span{ width:7px; height:7px; border-radius:50%; background:var(--line); cursor:pointer; transition:.2s; }
.dots span.on{ background:var(--accent); width:20px; border-radius:4px; }

/* Category row */
.cat-row{ display:flex; gap:16px; justify-content:flex-start; flex-wrap:wrap; margin-bottom:26px; }
.cat-item{ display:flex; flex-direction:column; align-items:center; gap:8px; cursor:pointer; }
.cat-icon{
  width:60px; height:60px; border-radius:16px; background:var(--card); border:1px solid var(--line);
  display:flex; align-items:center; justify-content:center; font-size:24px; transition:.15s;
}
.cat-item:hover .cat-icon{ border-color:var(--accent); }
.cat-item span{ font-size:12px; color:var(--muted); font-weight:600; }

.section-head{
  background:var(--card); border:1px solid var(--line); border-radius:14px;
  padding:12px 18px; font-family:var(--font-display); font-size:14px; letter-spacing:.5px;
  margin-bottom:14px;
}

/* Source grid (clickable cards) */
.source-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(140px,1fr)); gap:14px; margin-top:16px; }
.source-card{
  background:var(--card); border:1px solid var(--line); border-radius:16px; padding:20px 12px;
  display:flex; flex-direction:column; align-items:center; gap:10px; transition:.15s; opacity:.9;
}
.source-card:hover { border-color:var(--accent); opacity:1; transform:translateY(-2px); }
.source-badge{
  width:48px; height:48px; border-radius:14px; display:flex; align-items:center; justify-content:center;
}
.source-badge svg{ width:22px; height:22px; color:#fff; }
.source-name{ font-size:12.5px; font-weight:700; text-align:center; }
.source-tag{ font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; }

/* ===== Theme picker ===== */
#themePanel{
  display:none; position:absolute; top:56px; right:22px; background:var(--card);
  border:1px solid var(--line); border-radius:14px; padding:14px; z-index:30;
  box-shadow:0 10px 30px rgba(0,0,0,.4);
}
#themePanel.open{ display:block; }
.theme-label{ font-size:11px; color:var(--muted); margin-bottom:10px; text-transform:uppercase; letter-spacing:.5px; }
.swatch-row{ display:grid; grid-template-columns:repeat(5,1fr); gap:8px; }
.swatch{ width:30px; height:30px; border-radius:50%; cursor:pointer; border:2px solid transparent; }
.swatch.active{ border-color:var(--text); }

/* ===== Auth popup (login/logout) ===== */
#authPanel{
  display:none; position:absolute; top:48px; right:0; width:280px; background:var(--card);
  border:1px solid var(--line); border-radius:18px; padding:18px; z-index:30; text-align:left;
  box-shadow:0 10px 30px rgba(0,0,0,.4); cursor:default;
}
#authPanel.open{ display:block; }
.auth-head{ font-family:var(--font-display); font-size:14px; margin-bottom:4px; }
.auth-sub{ font-size:11.5px; color:var(--muted); line-height:1.5; margin-bottom:14px; }
.auth-input{
  width:100%; background:var(--bg-2); border:1px solid var(--line); color:var(--text);
  padding:10px 13px; border-radius:12px; font-size:12.5px; outline:none; margin-bottom:9px;
}
.auth-input:focus{ border-color:var(--accent); }
.auth-btn{
  width:100%; border:none; border-radius:12px; padding:11px; font-weight:700; font-size:12.5px;
  cursor:pointer; margin-bottom:10px;
}
.auth-btn.primary{ background:var(--accent); color:#1a0e0d; }
.auth-btn.danger{ background:transparent; border:1px solid var(--line); color:#ff8a8a; }
.auth-links{ display:flex; justify-content:space-between; font-size:11px; color:var(--muted); }
.auth-links span{ cursor:pointer; text-decoration:underline; text-underline-offset:2px; }
.auth-links span:hover{ color:var(--text); }

/* ===== Pages ===== */
.page{ display:none; }
.page.active{ display:block; }
.page-title{
  font-family:var(--font-display); font-size:18px; display:flex; align-items:center; gap:10px;
  margin-bottom:20px;
}
.pt-icon{ width:22px; height:22px; color:var(--accent); }

/* AI chat */
.ai-provider-row{ display:flex; gap:8px; margin-bottom:16px; }
.ai-provider-btn{
  background:var(--card); border:1px solid var(--line); color:var(--muted); padding:8px 16px;
  border-radius:20px; font-size:12.5px; font-weight:700; cursor:pointer;
}
.ai-provider-btn.active{ background:var(--accent); color:#1a0e0d; border-color:var(--accent); }
.ai-shell{
  background:var(--card); border:1px solid var(--line); border-radius:18px; padding:18px;
  min-height:340px; max-height:52vh; overflow-y:auto; display:flex; flex-direction:column; gap:12px;
  margin-bottom:14px;
}
.ai-msg{ max-width:80%; padding:11px 15px; border-radius:16px; font-size:13px; line-height:1.55; white-space:pre-wrap; }
.ai-msg.bot{ align-self:flex-start; background:var(--bg-2); border:1px solid var(--line); border-bottom-left-radius:4px; }
.ai-msg.user{ align-self:flex-end; background:var(--accent); color:#1a0e0d; border-bottom-right-radius:4px; }
.ai-msg.err{ align-self:flex-start; background:#3a1f1f; border:1px solid #5a2a2a; color:#ffb3b3; border-bottom-left-radius:4px; }
.ai-msg.thinking{ color:var(--muted); font-style:italic; }
.ai-input-row{ display:flex; gap:10px; }
.ai-input-row input{
  flex:1; background:var(--card); border:1px solid var(--line); color:var(--text);
  padding:13px 16px; border-radius:16px; font-size:13.5px; outline:none;
}
.ai-input-row input:focus{ border-color:var(--accent); }
.ai-send{
  width:48px; height:48px; border-radius:14px; background:var(--accent); border:none;
  color:#1a0e0d; font-size:16px; cursor:pointer; flex-shrink:0;
}

/* Settings page blocks */
.settings-block{
  background:var(--card); border:1px solid var(--line); border-radius:18px; padding:18px;
  margin-bottom:16px; max-width:420px;
}
.settings-label{ font-family:var(--font-display); font-size:12.5px; letter-spacing:.4px; margin-bottom:12px; }
.settings-row{ font-size:12.5px; color:var(--muted); line-height:1.6; }

/* Player Modal (Full Screen Iframe) */
#playerModal { display: none; position: fixed; inset: 0; z-index: 99999; background: #000; }
#playerModal.open { display: block; }
#playerCloseBtn { position: absolute; top: 20px; right: 20px; z-index: 100000; background: rgba(0,0,0,0.5); color: #fff; border: 1px solid rgba(255,255,255,0.3); border-radius: 8px; padding: 10px 15px; cursor: pointer; font-family:var(--font-body); font-weight:700; transition:0.2s;}
#playerCloseBtn:hover { background: var(--accent); color: #1a0e0d; border-color:var(--accent); }
#playerFrame { width: 100%; height: 100%; border: none; }

/* ===== Mobile ===== */
@media (max-width: 900px){
  #sidebar{ transform:translateX(-100%); width:78vw; max-width:300px; }
  #sidebar.open{ transform:translateX(0); }
  #sbOverlay.open{ display:block; }
  #main{ margin-left:0; width:100vw; }
  .content{ padding:14px; }
  .hero{ aspect-ratio:4/3; border-radius:16px; }
  .cat-icon{ width:52px; height:52px; font-size:20px; }
  header{ padding:0 14px; }
}

/* --- SCROLLBAR TRANSPARAN & AUTO-HIDE ALA GEMINI --- */
#aiHistorySidebar,
#aiShell {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.2s ease;
}

#aiHistorySidebar:hover,
#aiShell:hover {
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

#aiHistorySidebar::-webkit-scrollbar,
#aiShell::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

#aiHistorySidebar::-webkit-scrollbar-track,
#aiShell::-webkit-scrollbar-track {
  background: transparent;
}

#aiHistorySidebar::-webkit-scrollbar-thumb,
#aiShell::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 10px;
}

#aiHistorySidebar:hover::-webkit-scrollbar-thumb,
#aiShell:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

#aiHistorySidebar::-webkit-scrollbar-thumb:hover,
#aiShell::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* --- CSS KHUSUS HALAMAN AI SAAT AKTIF --- */
.page.active#page-ai {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 130px);
  max-height: calc(100vh - 130px);
  overflow: hidden;
}