/* ─── CallBill Client — Mobile-First Survey Page ─────────────────────────── */

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

:root {
  --bg: #12161C;
  --bg-card: #1A2029;
  --surface: #1A2029;
  --ink: #E8EDF3;
  --muted: #93A0B0;
  --line: #2B3440;
  --signal: #E0A100;
  
  --accent: #E8EDF3;
  --accent-glow: transparent;
  --green: #E8EDF3;
  --red: #C0392B;
  --text: var(--ink);
  --text-muted: var(--muted);
  --border: var(--line);
  --radius: 8px;
  --r-btn: 4px;
  --font: 'Instrument Sans', sans-serif;
  --font-head: 'Bricolage Grotesque', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ─── Screens ─────────────────────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.screen::before,
.screen::after {
  content: '';
  margin: auto;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ─── Loading Screen ──────────────────────────────────────────────────────── */
.logo-wrap {
  text-align: center;
  margin-bottom: 40px;
}

.logo-img {
  width: 300px;
  max-width: 85vw;
  height: auto;
  display: block;
  margin: 0 auto;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.5));
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: var(--r-btn);
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

.loading-msg {
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── Error Screen ────────────────────────────────────────────────────────── */
.error-wrap {
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
}

.error-icon { font-size: 48px; margin-bottom: 16px; }

.error-wrap h2 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 8px;
}

.error-wrap p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}


/* ─── Permission Screen New ─────────────────────────────────────────────── */
.perm-wrap-new {
  width: 100%;
  max-width: 440px;
  background: var(--bg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.perm-logo-wrap {
  margin-bottom: 24px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.perm-logo-img {
  width: 320px;
  max-width: 85vw;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.4));
}

.plate-chip-small {
  background: var(--plate);
  color: #FFFFFF;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 16px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1.5px #FFFFFF;
  margin-bottom: 24px;
}

.perm-title {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.2;
}

.perm-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 32px;
}

.perm-list {
  width: 100%;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 32px;
}

.perm-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.perm-item:last-child {
  border-bottom: none;
}

.perm-item-icon {
  color: var(--ink);
  display: flex;
}

.perm-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.perm-item-text strong {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}
.perm-item-text span {
  font-size: 13px;
  color: var(--muted);
}

.perm-item-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--wa);
}

.perm-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(194, 59, 46, 0.1);
  border: 1px solid rgba(194, 59, 46, 0.2);
  border-radius: 4px;
}

.btn-grant-full {
  width: 100%;
  height: 48px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-grant-full:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.perm-footer {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ─── Waiting Screen ──────────────────────────────────────────────────────── */
.wait-wrap {
  text-align: center;
  width: 100%;
  max-width: 400px;
  position: relative;
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  border-radius: var(--r-btn);
  background: var(--accent-glow);
  animation: pulse-expand 2s ease-out infinite;
  z-index: 0;
}

.wait-icon {
  font-size: 40px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.wait-wrap h2 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.wait-wrap > p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.camera-preview-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  background: #000;
  aspect-ratio: 9/16;
  max-height: 45vh;
}

#local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam-label {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 11px;
  padding: 4px 12px;
  border-radius: var(--radius);
}

.session-info {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 10px 16px;

  font-family: 'Barlow Condensed', sans-serif;
  background: #111111;
  color: #FFFFFF;
  border: 3px solid #333333;
  padding: 4px 12px;
  border-radius: var(--r-btn);
  font-weight: 700;
  letter-spacing: 0.05em;

}

/* ─── Active Screen ───────────────────────────────────────────────────────── */




















.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
}

.chat-overlay {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
}

.chat-bubble {
  background: rgba(99, 102, 241, 0.85);
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius) var(--radius) 0 var(--radius);
  font-size: 14px;
  font-weight: 500;
  max-width: 85%;
  align-self: flex-end;
  backdrop-filter: blur(8px);
  animation: slideUp 0.3s ease;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
  opacity: 0.8;
}

/* ─── Instruction Banner (Instruksi Besar dari Admin) ────────────────────── */
.instruction-banner {
  background: #1A2029;
  border: 1px solid #2B3440;
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  pointer-events: none;
}

.instruction-banner.show {
  opacity: 1;
  transform: translateY(0);
}

.instruction-banner.hide {
  opacity: 0;
  transform: translateY(-10px);
}

.instruction-label {
  color: #93A0B0;
  font-size: 13px;
}

.instruction-text {
  color: #E8EDF3;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}
  margin-bottom: 10px;
  animation: iconBounce 0.8s ease-in-out;
}

.instruction-text {
  font-size: 20px;
  font-weight: 700;
  color: white;
  line-height: 1.4;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  letter-spacing: 0.3px;
}

.instruction-pulse {
  position: absolute;
  inset: -4px;
  border-radius: var(--radius);
  border: 3px solid rgba(255,255,255,0.5);
  animation: instructionRipple 1.5s ease-out infinite;
  pointer-events: none;
}

/* ─── Voice Indicator ──────────────────────────────────────────────────── */
.voice-indicator {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16,185,129,0.9);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(16,185,129,0.4);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateX(-50%) translateY(-20px);
}

.voice-indicator.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.voice-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.voice-waves span {
  display: block;
  width: 3px;
  background: white;
  border-radius: 3px;
  animation: voiceWave 0.8s ease-in-out infinite;
}

.voice-waves span:nth-child(1) { animation-delay: 0s; }
.voice-waves span:nth-child(2) { animation-delay: 0.15s; }
.voice-waves span:nth-child(3) { animation-delay: 0.3s; }
.voice-waves span:nth-child(4) { animation-delay: 0.45s; }

.voice-label {
  color: white;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}







/* ─── Done Screen ─────────────────────────────────────────────────────────── */
.done-wrap {
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.done-icon {
  font-size: 72px;
  margin-bottom: 24px;
  animation: pop 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.done-wrap h2 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--green);
}

.done-wrap > p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

.done-sub {
  margin-top: 8px;
  font-size: 13px !important;
}

/* ─── Animations ──────────────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse-expand {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pop {
  0% { transform: scale(0.5); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes instructionAttention {
  0% { transform: translate(-50%, -50%) scale(1); }
  10% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  20% { transform: translate(-50%, -50%) scale(1) rotate(2deg); }
  30% { transform: translate(-50%, -50%) scale(1) rotate(-1deg); }
  40% { transform: translate(-50%, -50%) scale(1) rotate(1deg); }
  50%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0); }
}

@keyframes instructionGlow {
  from { box-shadow: 0 0 0 4px rgba(99,102,241,0.3), 0 20px 40px rgba(0,0,0,0.5), 0 0 60px rgba(99,102,241,0.4); }
  to { box-shadow: 0 0 0 8px rgba(99,102,241,0.15), 0 20px 40px rgba(0,0,0,0.5), 0 0 80px rgba(139,92,246,0.6); }
}

@keyframes instructionRipple {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); }
}

@keyframes iconBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

@keyframes voiceWave {
  0%, 100% { height: 4px; }
  50% { height: 18px; }
}

/* ─── Zoom Slider ─── */











/* ─── Photo Lightbox ─────────────────────────────────────────────────────── */
.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(10px);
}

.photo-lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.lightbox-img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  animation: zoomIn 0.25s ease;
}

@keyframes zoomIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: var(--r-btn);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.25);
}


/* ─── New Active UI ───────────────────────────────────────────────────────── */

.st{display:flex;flex-direction:column;line-height:1.25}
.live{display:flex;align-items:center;gap:7px;font-weight:600;color:#E8EDF3;text-transform:none}
.live i{width:9px;height:9px;border-radius:50%;background:#FF5A4E;animation:p 1.6s ease-in-out infinite}
@keyframes p{50%{opacity:.35}}
.tm{font:600 16px "Barlow Condensed",sans-serif;letter-spacing:.04em;color:#3DD68C;font-variant-numeric:tabular-nums}
.plate{background:#000;color:#fff;font:700 18px/1 "Barlow Condensed",sans-serif;letter-spacing:.06em;padding:6px 10px 5px;border-radius:4px;box-shadow:inset 0 0 0 1.5px #fff;white-space:nowrap}
.btns{display:flex;gap:6px;justify-content:flex-end}
.ib{width:40px;height:40px;border-radius:6px;background:#1A2029;border:1px solid #2B3440;color:#E8EDF3;display:grid;place-items:center;padding:0}
.ib svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.ib[aria-pressed="true"].fl{background:#E0A100;border-color:#E0A100;color:#111}
.ib.mic[aria-pressed="true"]{background:#FF5A4E;border-color:#FF5A4E;color:#111}
.ib .slash{display:none}.ib.mic[aria-pressed="true"] .slash{display:block}

.zoom output{font:600 18px "Barlow Condensed",sans-serif;min-width:38px;text-align:right;color:#E8EDF3}
.zoom input[type=range]{flex:1;-webkit-appearance:none;appearance:none;height:28px;background:none;margin:0}
.zoom input[type=range]::-webkit-slider-runnable-track{height:4px;background:#2B3440;border-radius:2px}
.zoom input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:22px;height:22px;border-radius:50%;background:#fff;border:3px solid #12161C;box-shadow:0 0 0 1px #93A0B0;margin-top:-9px}
.zoom input[type=range]::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#fff;border:3px solid #12161C;box-shadow:0 0 0 1px #93A0B0}

.row{display:flex;align-items:center;gap:8px;font-weight:600;color:#E8EDF3}
.row i{width:8px;height:8px;border-radius:50%;background:#3DD68C}
.bot .m{color:#93A0B0;font-size:13px}
.bot .m.off{color:#FF5A4E}

.cam-page{height:100dvh;display:flex;flex-direction:column;background:#12161C;color:#E8EDF3;overflow:hidden;padding:0;align-items:stretch;justify-content:flex-start}
.top{width:100%;flex:none;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid #2B3440;background:#12161C}
.vid{position:relative;flex:1;min-height:0;overflow:hidden;background:#000}
.vid video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.zoom{position:absolute;left:50%;transform:translateX(-50%);bottom:20px;width:75%;max-width:320px;display:flex;align-items:center;gap:14px;background:#12161C;border:1px solid #2B3440;border-radius:30px;padding:8px 16px;z-index:10;}
.zoom output{font:600 16px "Barlow Condensed",sans-serif;min-width:38px;text-align:right;color:#E8EDF3}
.zoom input[type=range]{flex:1;-webkit-appearance:none;appearance:none;height:28px;background:none;margin:0}
.zoom input[type=range]::-webkit-slider-runnable-track{height:4px;background:#2B3440;border-radius:2px}
.zoom input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:22px;height:22px;border-radius:50%;background:#fff;border:3px solid #12161C;box-shadow:0 0 0 1px #93A0B0;margin-top:-9px}
.zoom input[type=range]::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#fff;border:3px solid #12161C;box-shadow:0 0 0 1px #93A0B0}
.bot{padding:16px;border-top:1px solid #2B3440;background:#12161C;display:flex;flex-direction:column;align-items:center;text-align:center;gap:4px}
.row{display:flex;align-items:center;justify-content:center;gap:8px;font-weight:600;color:#E8EDF3}
.sheet{display:none !important;}
.sheet.open{transform:none}
.sheet-h{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid #2B3440}
.sheet-h h2{margin:0;font:600 16px/1 "Bricolage Grotesque",sans-serif}
.sheet-h .close{margin-left:auto}
.count{background:#E8EDF3;color:#12161C;font-weight:600;font-size:12px;line-height:1;padding:4px 8px;border-radius:10px}
.sheet-b{overflow:auto;padding:16px;display:grid;grid-template-columns:repeat(auto-fill,minmax(112px,1fr));gap:10px}
.thumb{position:relative;aspect-ratio:1;border-radius:6px;overflow:hidden;border:1px solid #2B3440}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.thumb b{position:absolute;right:6px;bottom:6px;background:#12161C;color:#E8EDF3;font-size:12px;line-height:1;padding:3px 6px;border-radius:4px}
@media (prefers-reduced-motion:reduce){.sheet{transition:none}}

/* ─── OSS Logo Images ──────────────────────────────────────────────────────── */
.header-logo-img {
  height: 48px;
  width: auto;
  max-width: 200px;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

.done-logo-img {
  width: 260px;
  max-width: 80vw;
  height: auto;
  display: block;
  margin: 0 auto 28px;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.5));
  animation: float 3s ease-in-out infinite;
}
