/* =========================================================
   WA BOT DASHBOARD 2026 — cyan futuristic, dark/light aware
   Token system:
   dark  : bg #06111a | surface #0c1b26 | cyan #22e8ff | cyan2 #24f2c0 | text #d8f6ff
   light : bg #f0fbfd  | surface #ffffff | cyan #0891b2 | cyan2 #0d9488 | text #0b2530
   Signature element: scanning "radar ring" around the bot avatar
   ========================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #06111a;
  --surface: #0c1b26;
  --surface-2: #10222f;
  --cyan: #22e8ff;
  --cyan-2: #24f2c0;
  --text: #d8f6ff;
  --muted: #7fa3b0;
  --border: rgba(34, 232, 255, 0.16);
  --danger: #ff5f7a;
  --success: #24f2c0;
  --radius: 14px;
  --shadow-glow: 0 0 24px rgba(34, 232, 255, 0.18);
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body.theme-light {
  --bg: #eef9fb;
  --surface: #ffffff;
  --surface-2: #f3fbfc;
  --cyan: #0891b2;
  --cyan-2: #0d9488;
  --text: #0b2530;
  --muted: #4c7078;
  --border: rgba(8, 145, 178, 0.18);
  --shadow-glow: 0 0 24px rgba(8, 145, 178, 0.10);
}

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .4s ease, color .4s ease;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 42px 42px;
  background-attachment: fixed;
}

/* ---------- Burger ---------- */
.burger-btn {
  position: fixed; top: 20px; left: 20px; z-index: 40;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer; box-shadow: var(--shadow-glow);
  transition: transform .25s ease;
}
.burger-btn:hover { transform: scale(1.06); }
.burger-btn span { width: 20px; height: 2px; background: var(--cyan); border-radius: 2px; transition: all .3s ease; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: 0; left: -300px; width: 280px; height: 100%;
  background: var(--surface); border-right: 1px solid var(--border);
  z-index: 50; transition: left .35s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; padding: 28px 20px;
}
.sidebar.open { left: 0; box-shadow: 40px 0 80px rgba(0,0,0,.35); }
.sidebar-head { display: flex; align-items: center; gap: 10px; margin-bottom: 40px; }
.logo-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 12px var(--cyan);
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot { 0%,100%{opacity:1;} 50%{opacity:.4;} }
.sidebar-head h2 { font-size: 18px; letter-spacing: .5px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-item {
  text-align: left; background: transparent; border: none; color: var(--muted);
  font-family: var(--font-display); font-size: 15px; padding: 12px 14px; border-radius: 10px;
  cursor: pointer; transition: all .2s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(34,232,255,.14), transparent); color: var(--cyan); border-left: 2px solid var(--cyan); }
.nav-item.nav-link { text-decoration: none; display: block; }
.theme-toggle {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-family: var(--font-display);
}
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
  z-index: 45; opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }

/* ---------- Main ---------- */
.main { max-width: 880px; margin: 0 auto; padding: 90px 24px 60px; }
.panel { display: none; animation: fadeUp .5s ease; }
.panel.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px);} to { opacity:1; transform: translateY(0);} }

/* ---------- Hero / avatar signature ---------- */
.hero { text-align: center; margin-bottom: 40px; }
.avatar-wrap { position: relative; width: 132px; height: 132px; margin: 0 auto 18px; }
.avatar-wrap::before {
  content: ''; position: absolute; inset: -10px; border-radius: 50%;
  border: 1px solid var(--border);
}
.avatar-wrap::after {
  content: ''; position: absolute; inset: -10px; border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--cyan); border-right-color: var(--cyan-2);
  animation: spin 3.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.avatar-wrap img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--surface); box-shadow: var(--shadow-glow);
}
.status-dot {
  position: absolute; bottom: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--surface);
}
.status-dot.online { background: var(--success); box-shadow: 0 0 10px var(--success); }
.status-dot.offline { background: var(--danger); }
.status-dot.connecting { background: #ffb020; animation: pulseDot 1.2s ease-in-out infinite; }

.hero h1 { font-size: 26px; margin-top: 6px; letter-spacing: .3px; }
.status-text { color: var(--muted); font-family: var(--font-mono); font-size: 13px; margin-top: 4px; }

.pairing-box {
  margin: 22px auto 0; max-width: 320px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-glow);
}
.pairing-box.hidden { display: none; }
.pairing-code {
  font-family: var(--font-mono); font-size: 28px; letter-spacing: 4px; color: var(--cyan);
  margin: 8px 0; text-shadow: 0 0 16px rgba(34,232,255,.5);
}
.pairing-box .hint { font-size: 12px; color: var(--muted); }

/* ---------- Stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 30px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 8px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-glow); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-family: var(--font-mono); font-size: 22px; color: var(--cyan); }
.stat-value.mono { letter-spacing: 1px; }

/* ---------- Info panel ---------- */
.info-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.info-panel h3 { margin-bottom: 12px; font-size: 15px; color: var(--cyan); }
.info-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.info-list li { display: flex; justify-content: space-between; font-size: 13px; border-bottom: 1px dashed var(--border); padding-bottom: 8px; }
.info-list span { color: var(--muted); }
.info-list b { font-family: var(--font-mono); font-weight: 500; }

/* ---------- Forms / cards ---------- */
h1 { font-size: 24px; margin-bottom: 8px; }
.muted { color: var(--muted); margin-bottom: 18px; font-size: 14px; }
.card-form, .admin-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; max-width: 420px;
}
.admin-panel { max-width: 100%; }
input, textarea, select {
  width: 100%; padding: 12px 14px; margin-bottom: 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-family: var(--font-mono); font-size: 13px; outline: none; transition: border .2s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--cyan); }
textarea { resize: vertical; }
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }

.btn-primary {
  width: 100%; padding: 13px; border-radius: 10px; border: none; cursor: pointer;
  background: linear-gradient(90deg, var(--cyan), var(--cyan-2)); color: #04141a; font-weight: 600;
  font-family: var(--font-display); transition: filter .2s ease, transform .2s ease;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-secondary {
  width: 100%; padding: 12px; margin-top: 10px; border-radius: 10px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--muted); font-family: var(--font-display);
}
.error-text { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 16px; }
.success-text { color: var(--success); font-size: 13px; margin-top: 10px; min-height: 16px; }
.hidden { display: none !important; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.tab {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  padding: 9px 16px; border-radius: 30px; cursor: pointer; font-size: 13px; font-family: var(--font-display);
  transition: all .2s ease;
}
.tab.active, .tab:hover { color: var(--cyan); border-color: var(--cyan); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeUp .35s ease; }

.switch-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 10px; margin-bottom: 16px; font-size: 13px; }
.switch-row label { display: flex; align-items: center; gap: 8px; color: var(--text); }

.plugin-list { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.plugin-list li {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px;
  font-family: var(--font-mono); font-size: 13px;
}
.plugin-list button { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; }

#userTableWrap table { width: 100%; border-collapse: collapse; font-size: 13px; font-family: var(--font-mono); }
#userTableWrap th, #userTableWrap td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); }
#userTableWrap th { color: var(--cyan); }

@media (max-width: 560px) {
  .main { padding: 84px 16px 40px; }
  .card-form, .admin-panel { padding: 18px; }
}

/* =========================================================
   LOGIN PAGE (halaman terpisah)
   ========================================================= */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative;
}
.back-link {
  position: absolute; top: 24px; left: 24px; color: var(--muted);
  text-decoration: none; font-size: 13px; font-family: var(--font-mono);
}
.back-link:hover { color: var(--cyan); }
.login-box {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px 28px; box-shadow: var(--shadow-glow);
  animation: fadeUp .5s ease;
}

/* =========================================================
   SETTINGS PAGE (sidebar pengaturan permanen, bukan overlay)
   ========================================================= */
.settings-layout { display: flex; min-height: 100vh; }
.settings-sidebar {
  width: 260px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  padding: 24px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.settings-sidebar .sidebar-head { margin-bottom: 30px; }
.settings-nav { display: flex; flex-direction: column; gap: 4px; }
.settings-nav button {
  text-align: left; background: transparent; border: none; color: var(--muted);
  font-family: var(--font-display); font-size: 14px; padding: 11px 14px; border-radius: 10px;
  cursor: pointer; transition: all .2s ease; display: flex; align-items: center; gap: 8px;
}
.settings-nav button:hover { background: var(--surface-2); color: var(--text); }
.settings-nav button.active {
  background: linear-gradient(90deg, rgba(34,232,255,.14), transparent);
  color: var(--cyan); border-left: 2px solid var(--cyan);
}
.settings-nav .nav-divider { margin: 14px 4px 6px; font-size: 11px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.settings-main { flex: 1; padding: 32px 36px; max-width: 760px; }
.settings-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.settings-section { display: none; animation: fadeUp .35s ease; }
.settings-section.active { display: block; }

.upload-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.upload-row input[type="file"] {
  flex: 1; min-width: 200px; padding: 10px; margin: 0; background: var(--surface-2);
  border: 1px dashed var(--border); border-radius: 10px; font-family: var(--font-display); font-size: 13px;
}
.media-preview {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.media-preview img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.media-preview .remove-btn { margin-left: auto; background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; }

@media (max-width: 860px) {
  .settings-layout { flex-direction: column; }
  .settings-sidebar { width: 100%; height: auto; position: relative; }
  .settings-main { padding: 24px 18px; }
}
