/* ============ Wartel V2 — Design System "Tech Dark" ============
   Tema: teknologi modern. Latar gelap kebiruan + glow cyan/indigo,
   kartu kaca (glass), font display Space Grotesk. */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #160708;
  --bg-2: #2a0e12;
  --panel: rgba(255, 255, 255, .045);
  --panel-2: rgba(255, 255, 255, .08);
  --line: rgba(196, 169, 131, .16);
  --text: #f5ead7;
  --muted: #c4a983;
  --accent: #e9cd7d;     /* emas */
  --accent-2: #c9972f;   /* emas tua */
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --r: 18px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --glow: 0 0 24px rgba(233, 205, 125, .25);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font: 15px/1.55 'Inter', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(201, 151, 47, .18), transparent 60%),
    radial-gradient(700px 420px at -10% 20%, rgba(233, 205, 125, .12), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
/* grid halus ala blueprint */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(196, 169, 131, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 169, 131, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 30%, transparent 75%);
}
h1, h2, h3, .brand, .btn, .stat-num { font-family: 'Space Grotesk', 'Inter', sans-serif; }
a { color: var(--accent); text-decoration: none; }
.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 20px; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: .4px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: transparent;
}
.brand .logo svg, .brand .logo img { width: 100%; height: 100%; }
.brand small { display: block; font-weight: 500; color: var(--muted); letter-spacing: 2.5px; font-size: 10px; text-transform: uppercase; }

/* ---------- Komponen dasar ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  padding: 12px 20px; font-size: 15px; font-weight: 600; letter-spacing: .3px;
  transition: transform .12s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, .12); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; color: #2b1407;
}
.btn-primary:hover { box-shadow: var(--glow); background: linear-gradient(135deg, #f3dfa0, #d9a84e); }
.btn-danger { background: linear-gradient(135deg, #f87171, #dc2626); border: none; color: #fff; }
.btn-ghost { background: transparent; }
.btn-lg { padding: 16px 26px; font-size: 17px; border-radius: 16px; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.input, select.input {
  width: 100%; padding: 13px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(26, 8, 10, .55); color: var(--text);
  font: inherit; outline: none; transition: border .2s, box-shadow .2s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233, 205, 125, .15); }
.label { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 6px; letter-spacing: .6px; text-transform: uppercase; font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.badge.ok { color: var(--ok); background: rgba(52, 211, 153, .1); }
.badge.warn { color: var(--warn); background: rgba(251, 191, 36, .1); }
.badge.bad { color: var(--bad); background: rgba(248, 113, 113, .1); }
.badge.info { color: var(--accent); background: rgba(233, 205, 125, .1); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid rgba(196, 169, 131, .08); vertical-align: middle; }
.table tr:hover td { background: rgba(255, 255, 255, .025); }

.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; }
.grow { flex: 1; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #2a0e12; border: 1px solid var(--line); color: var(--text);
  padding: 12px 22px; border-radius: 14px; opacity: 0; pointer-events: none;
  transition: .25s; z-index: 99; box-shadow: var(--shadow); max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(248, 113, 113, .5); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 3, 4, .75); backdrop-filter: blur(6px); display: none; place-items: center; z-index: 50; padding: 18px; }
.modal-bg.open { display: grid; }
.modal { width: 100%; max-width: 470px; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

/* ---------- Avatar inisial ---------- */
.ava {
  width: 52px; height: 52px; border-radius: 16px; flex: none;
  display: grid; place-items: center; font-family: 'Space Grotesk'; font-weight: 700; font-size: 20px;
  background: linear-gradient(135deg, rgba(233, 205, 125, .25), rgba(201, 151, 47, .3));
  border: 1px solid var(--line); color: var(--accent);
}

/* ---------- Layar panggilan ---------- */
.call-screen { position: fixed; inset: 0; background: #120506; z-index: 40; display: none; flex-direction: column; }
.call-screen.open { display: flex; }
.call-stage { flex: 1; position: relative; overflow: hidden; }
.call-stage video.remote { width: 100%; height: 100%; object-fit: contain; background: #120506; }
.call-stage video.local {
  position: absolute; right: 16px; top: 16px; width: min(28vw, 200px); aspect-ratio: 3/4;
  object-fit: cover; border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow);
  background: #2a0e12;
}
/* Tukar layar ala WhatsApp (tap jendela kecil): .swapped membalik peran kedua video */
.call-stage.swapped video.remote {
  position: absolute; right: 16px; top: 16px; left: auto; width: min(28vw, 200px); height: auto;
  aspect-ratio: 3/4; object-fit: cover; border-radius: 16px; border: 1px solid var(--line);
  box-shadow: var(--shadow); z-index: 2;
}
.call-stage.swapped video.local {
  position: absolute; inset: 0; right: auto; top: auto; width: 100%; height: 100%;
  aspect-ratio: auto; object-fit: contain; border: none; border-radius: 0; box-shadow: none; z-index: 0;
}
.call-stage video { touch-action: none; } /* supaya geser jendela kecil tidak men-scroll halaman */
.call-topbar {
  position: absolute; top: 0; left: 0; right: 0; padding: 14px 18px;
  display: flex; align-items: center; gap: 10px; z-index: 2;
  background: linear-gradient(rgba(18, 5, 6, .8), transparent);
}
.rec-pill { display: inline-flex; align-items: center; gap: 7px; background: rgba(26, 8, 10, .65); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 12.5px; }
.rec-dot { width: 9px; height: 9px; border-radius: 99px; background: var(--bad); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.call-controls {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px; z-index: 2;
  display: flex; justify-content: center; align-items: center; gap: 14px;
  background: linear-gradient(transparent, rgba(18, 5, 6, .85));
}
.call-timer { font-family: 'Space Grotesk'; font-size: 17px; font-weight: 600; letter-spacing: 1px; background: rgba(26, 8, 10, .65); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; }

/* layar "memanggil..." */
.calling-box { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; z-index: 3; background: radial-gradient(600px 400px at 50% 35%, rgba(233, 205, 125, .08), transparent 70%), #120506; }
.pulse { position: relative; width: 110px; height: 110px; display: grid; place-items: center; }
.pulse .ava { width: 86px; height: 86px; font-size: 32px; border-radius: 26px; }
.pulse::before, .pulse::after {
  content: ''; position: absolute; inset: 0; border-radius: 32px;
  border: 2px solid rgba(233, 205, 125, .4); animation: ring 1.8s infinite;
}
.pulse::after { animation-delay: .9s; }
@keyframes ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.45); opacity: 0; } }

/* ---------- Kios khusus: tombol & kartu besar utk layar sentuh ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.contact-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); transition: border .2s, transform .12s; }
.contact-card:hover { border-color: rgba(233, 205, 125, .4); transform: translateY(-2px); }

.tabs { display: flex; gap: 8px; margin: 18px 0; flex-wrap: wrap; }
.tab { padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 600 14px 'Space Grotesk'; cursor: pointer; letter-spacing: .3px; }
.tab.active { background: linear-gradient(135deg, rgba(233, 205, 125, .18), rgba(201, 151, 47, .18)); color: var(--text); border-color: rgba(233, 205, 125, .45); }

/* ---------- Admin layout ---------- */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; position: relative; z-index: 1; }
.sidebar { border-right: 1px solid var(--line); padding: 22px 14px; background: rgba(20, 7, 8, .6); backdrop-filter: blur(10px); display: flex; flex-direction: column; gap: 6px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid transparent; }
.side-link:hover { background: var(--panel); color: var(--text); }
.side-link.active { background: linear-gradient(135deg, rgba(233, 205, 125, .14), rgba(201, 151, 47, .14)); color: var(--text); border-color: rgba(233, 205, 125, .35); }
.main { padding: 26px; max-width: 1100px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-num { font-size: 34px; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
}

/* ---------- Branding Rindu Rumah ---------- */
.brand { font-family: 'Playfair Display', serif; letter-spacing: .2px; }
.brand small { font-family: 'Inter', sans-serif; }
.brand h1 { font-family: 'Playfair Display', serif; }
.brand p { font-family: 'Inter', sans-serif; }
