/* ==========================================================================
   VISHWAM & JAI CONCLAVE 2026 — VOLUNTEER SCANNER DESIGN SYSTEM
   Palette: Deep Royal Navy (#0b192c), Obsidian Midnight (#070f1e), Lotus Orange (#ea580c), Saffron Gold (#f59e0b)
   Fonts: Outfit, Plus Jakarta Sans, Inter
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800;900&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  /* Master VISHWAM Institutional Palette */
  --color-navy:        #0b192c;
  --color-navy-dark:   #070f1e;
  --color-navy-card:   #0e1e36;
  --color-navy-surface:#162a4a;
  
  --color-orange:      #ea580c;
  --color-orange-glow: #f97316;
  --color-orange-dark: #c2410c;
  --color-gold:        #f59e0b;
  --color-gold-light:  #fef3c7;
  
  --color-emerald:     #10b981;
  --color-crimson:     #ef4444;
  --color-blue:        #3b82f6;

  /* Surfaces & Borders */
  --bg:                #070f1e;
  --surface:           rgba(14, 30, 54, 0.88);
  --surface-hover:     rgba(22, 42, 74, 0.95);
  --border:            rgba(245, 158, 11, 0.22);
  --border-subtle:     rgba(255, 255, 255, 0.09);

  /* Typography */
  --text:              #ffffff;
  --text-dim:          #94a3b8;
  --text-muted:        #64748b;
  --font-display:      'Outfit', -apple-system, sans-serif;
  --font-editorial:    'Plus Jakarta Sans', sans-serif;
  --font-body:         'Inter', sans-serif;

  /* Geometry & Radii */
  --radius-sm:         8px;
  --radius:            16px;
  --radius-pill:       9999px;

  /* Shadows */
  --shadow-card:       0 16px 36px rgba(7, 15, 30, 0.65);
  --shadow-orange:     0 8px 24px rgba(234, 88, 12, 0.35);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, #102647 0%, #070f1e 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

button, input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ---------------- Top Status Bar ---------------- */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(7, 15, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}

.status-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.status-top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-site-link {
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  transition: all 0.2s ease;
}

.status-site-link:hover {
  background: rgba(234, 88, 12, 0.2);
  border-color: var(--color-orange);
}

.status-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.status-site-text {
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.05em;
  font-family: var(--font-display);
}

.volunteer-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-editorial);
}

.status-cp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkpoint-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-orange-glow);
}

.chip-btn {
  background: rgba(234, 88, 12, 0.15);
  border: 1px solid rgba(234, 88, 12, 0.35);
  color: var(--color-orange-glow);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chip-btn:hover {
  background: rgba(234, 88, 12, 0.3);
}

.status-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scan-counter-badge {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: var(--color-emerald);
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.pending-badge {
  background: var(--color-gold);
  color: #070f1e;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.conn-dot.offline {
  background: var(--color-gold);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.link-btn:hover {
  color: #ffffff;
}

/* ---------------- Main Layout ---------------- */
#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------------- Login View ---------------- */
#view-login {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 32px 26px;
}

.login-brand-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.login-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(234, 88, 12, 0.3));
}

.brand-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--color-orange-glow);
  background: rgba(234, 88, 12, 0.14);
  border: 1px solid rgba(234, 88, 12, 0.35);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.15;
}

.brand-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 3px;
}

.field-group {
  margin-bottom: 18px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 7px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  background: rgba(7, 15, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 15px;
  outline: none;
  transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.25);
  background: rgba(11, 25, 44, 0.95);
}

#pin {
  letter-spacing: 0.35em;
  font-weight: 800;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--color-orange) 0%, var(--color-orange-glow) 100%);
  color: #ffffff;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15.5px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: var(--shadow-orange);
  transition: all 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.return-site-link {
  color: var(--text-dim);
  font-size: 12.5px;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.return-site-link:hover {
  color: var(--color-orange-glow);
}

.error-box {
  margin-top: 16px;
  padding: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
}

.error-text {
  font-size: 12.5px;
  color: #fca5a5;
  margin-bottom: 8px;
  line-height: 1.4;
}

.btn-reset {
  width: 100%;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ffffff;
  border-radius: 6px;
  padding: 7px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------------- Checkpoint Select View ---------------- */
#view-checkpoint {
  padding: 20px 16px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.view-header {
  margin-bottom: 14px;
}

.view-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
}

.checkpoint-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkpoint-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--color-orange);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.checkpoint-btn:active {
  background: var(--surface-hover);
  transform: translateY(1px);
}

.checkpoint-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-left-color: var(--text-muted);
}

.cp-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cp-icon {
  font-size: 24px;
}

.cp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cp-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  font-family: var(--font-editorial);
}

.cp-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  width: fit-content;
}

.cp-single {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-gold);
}

.cp-multi {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-emerald);
}

.cp-arrow {
  font-size: 20px;
  color: var(--text-dim);
}

/* ---------------- Scanner View ---------------- */
#view-scanner {
  position: relative;
  background: #000000;
}

#qr-reader {
  width: 100%;
  height: 100%;
  flex: 1;
  background: #000000;
}

#qr-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.scanner-top-bar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
}

.btn-torch {
  background: rgba(7, 15, 30, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-torch.active {
  background: var(--color-gold);
  color: #070f1e;
  border-color: var(--color-gold);
}

.scanner-bottom-bar {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
  padding: 0 20px;
}

.scan-hint {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(7, 15, 30, 0.8);
  backdrop-filter: blur(10px);
  padding: 5px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-manual {
  background: rgba(7, 15, 30, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #ffffff;
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------------- Result Overlay ---------------- */
.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.result-card {
  width: 100%;
  max-width: 380px;
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* State Palettes */
.result-overlay.success {
  background: rgba(6, 78, 59, 0.85);
}
.result-overlay.success .result-card {
  background: #064e3b;
  border-top: 4px solid var(--color-emerald);
}

.result-overlay.duplicate {
  background: rgba(120, 53, 15, 0.88);
}
.result-overlay.duplicate .result-card {
  background: #78350f;
  border-top: 4px solid var(--color-gold);
}

.result-overlay.error {
  background: rgba(127, 29, 29, 0.88);
}
.result-overlay.error .result-card {
  background: #7f1d1d;
  border-top: 4px solid var(--color-crimson);
}

.result-overlay.pending {
  background: rgba(30, 58, 138, 0.88);
}
.result-overlay.pending .result-card {
  background: #1e3a8a;
  border-top: 4px solid var(--color-blue);
}

.result-icon {
  font-size: 42px;
  margin-bottom: 8px;
}

.result-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #ffffff;
}

.result-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.result-id {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 16px;
  font-family: monospace;
}

.result-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 18px;
  text-align: left;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 700;
}

.meta-value {
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
}

.result-next-btn {
  background: #ffffff;
  color: #070f1e;
  border: none;
  font-weight: 800;
}

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 14px;
}

.modal-input {
  width: 100%;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  gap: 8px;
}
