*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0c0f1a;
  --bg2: #141829;
  --bg3: #1a1f36;
  --accent: #1D93D2;
  --accent-hover: #1578B0;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f97316;
  --radius: 12px;
}

html, body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

body { max-width: 480px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom, 20px); }

/* Status bar */
.status-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--bg2);
  border-bottom: 1px solid var(--bg3); position: sticky; top: 0; z-index: 100;
}
.status-bar .user { font-size: 14px; font-weight: 600; }
.status-bar .sync-badge {
  font-size: 12px; padding: 2px 8px; border-radius: 20px;
  background: var(--bg3); color: var(--text2);
}
.status-bar .sync-badge.pending { background: var(--orange); color: #000; }
.online-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  display: inline-block; margin-right: 6px;
}
.online-dot.offline { background: var(--red); }

/* Screens */
.screen { display: none; padding: 16px; }
.screen.active { display: block; }

/* Login */
.login-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 80vh; padding: 32px;
}
.login-screen h1 { font-size: 28px; margin-bottom: 4px; }
.login-screen .subtitle { color: var(--text2); margin-bottom: 32px; font-size: 14px; }
.login-screen .logo { font-size: 48px; margin-bottom: 16px; color: var(--accent); font-weight: 800; }

/* Forms */
input, select, textarea {
  width: 100%; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--bg3); background: var(--bg2); color: var(--text);
  font-size: 16px; font-family: inherit; outline: none; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
.form-group { margin-bottom: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: var(--radius); border: none;
  font-size: 16px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: all .2s; width: 100%; touch-action: manipulation;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { background: var(--bg3); color: var(--text); }
.btn-secondary:hover { background: #252b47; }
.btn-danger { background: var(--red); color: #fff; }
.btn-small { padding: 8px 16px; font-size: 14px; width: auto; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards */
.card {
  background: var(--bg2); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; border: 1px solid var(--bg3);
}

/* Stats */
.stats-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.stat-card {
  background: var(--bg2); border-radius: var(--radius); padding: 12px; text-align: center;
  border: 1px solid var(--bg3);
}
.stat-card .value { font-size: 24px; font-weight: 700; color: var(--accent); }
.stat-card .label { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* Toggle */
.toggle-group {
  display: flex; background: var(--bg2); border-radius: var(--radius);
  padding: 4px; margin-bottom: 16px; border: 1px solid var(--bg3);
}
.toggle-btn {
  flex: 1; padding: 10px; text-align: center; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
  border: none; background: transparent; color: var(--text2); font-family: inherit;
}
.toggle-btn.active { background: var(--accent); color: #fff; }

/* Scan button */
.scan-btn {
  width: 100%; padding: 24px; border-radius: 16px; border: 2px dashed var(--accent);
  background: rgba(245, 158, 11, 0.08); color: var(--accent);
  font-size: 20px; font-weight: 700; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-family: inherit; margin-bottom: 20px;
}
.scan-btn:active { transform: scale(0.98); background: rgba(245, 158, 11, 0.15); }

/* Camera */
.camera-screen { padding: 0; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 200; background: #000; }
.camera-screen video { width: 100%; height: 100%; object-fit: cover; }
.camera-controls {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 24px; display: flex; justify-content: center; gap: 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}
.shutter-btn {
  width: 72px; height: 72px; border-radius: 50%;
  border: 4px solid #fff; background: rgba(255,255,255,0.2);
  cursor: pointer; transition: all .15s;
}
.shutter-btn:active { background: rgba(255,255,255,0.5); transform: scale(0.9); }
.camera-close {
  position: absolute; top: 16px; right: 16px; width: 44px; height: 44px;
  border-radius: 50%; background: rgba(0,0,0,0.5); border: none;
  color: #fff; font-size: 24px; cursor: pointer; z-index: 201;
}
.camera-overlay {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 80%; max-width: 340px; aspect-ratio: 4/3;
  border: 2px solid rgba(245,158,11,0.5); border-radius: 12px;
  pointer-events: none;
}

/* Review */
.review-photo { width: 100%; border-radius: var(--radius); margin-bottom: 16px; }
.confidence-badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
}
.confidence-high { background: rgba(34,197,94,0.15); color: var(--green); }
.confidence-medium { background: rgba(249,115,22,0.15); color: var(--orange); }
.confidence-low { background: rgba(239,68,68,0.15); color: var(--red); }

/* Reading list */
.reading-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px; background: var(--bg2); border-radius: var(--radius);
  margin-bottom: 8px; border: 1px solid var(--bg3);
}
.reading-item .info { flex: 1; }
.reading-item .bar-name { font-weight: 600; font-size: 15px; }
.reading-item .meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.reading-item .value { font-size: 18px; font-weight: 700; color: var(--accent); text-align: right; }
.reading-item .type-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 4px; margin-top: 2px; display: inline-block;
}
.type-begin { background: rgba(59,130,246,0.15); color: #60a5fa; }
.type-eind { background: rgba(168,85,247,0.15); color: #c084fc; }

/* Tabs */
.nav-tabs {
  display: flex; border-bottom: 1px solid var(--bg3);
  margin-bottom: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.nav-tab {
  padding: 12px 16px; font-size: 14px; font-weight: 500;
  color: var(--text2); cursor: pointer; border: none; background: none;
  white-space: nowrap; font-family: inherit; border-bottom: 2px solid transparent;
  transition: all .2s;
}
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Filters */
.filter-row { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.filter-chip {
  padding: 6px 14px; border-radius: 20px; font-size: 13px;
  background: var(--bg3); color: var(--text2); border: none;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.filter-chip.active { background: var(--accent); color: #fff; }

/* Search */
.search-input {
  padding: 10px 16px 10px 40px; background: var(--bg2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.598.854a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E") 14px center no-repeat;
  margin-bottom: 12px;
}

/* Loading spinner */
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--bg3);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 300; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg2); border-radius: 16px; padding: 24px;
  max-width: 440px; width: 100%; max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }

/* No festival screen */
.no-festival {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 60px 24px; min-height: 60vh;
}
.no-festival h2 { margin: 16px 0 8px; }
.no-festival p { max-width: 280px; line-height: 1.5; }

/* Bar list */
.bar-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; background: var(--bg2); border-radius: var(--radius);
  margin-bottom: 8px; border: 1px solid var(--bg3); cursor: pointer;
  transition: all .15s;
}
.bar-item:active { transform: scale(0.98); }
.bar-item.bar-begin { border-left: 3px solid var(--accent); }
.bar-item.bar-eind { border-left: 3px solid var(--orange); }
.bar-item.bar-complete {
  border-left: 3px solid var(--green); opacity: 0.5;
  cursor: not-allowed;
}
.bar-item .bar-info { flex: 1; }
.bar-item .bar-name { font-weight: 600; font-size: 15px; }
.bar-item .bar-action {
  font-size: 13px; font-weight: 600; padding: 4px 12px;
  border-radius: 20px;
}
.bar-action-begin { background: rgba(29,147,210,0.15); color: var(--accent); }
.bar-action-eind { background: rgba(249,115,22,0.15); color: var(--orange); }
.bar-action-complete { background: rgba(34,197,94,0.15); color: var(--green); }

/* Section title */
.section-title { font-size: 13px; color: var(--text2); margin-bottom: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Utility */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text2); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&display=swap');
