/* ============================================================
   ESCAPE ROOMS TRACKER - Main Stylesheet
   Mobile-first, iPhone optimized, Dark/Light theme
   ============================================================ */

/* ---- CSS Variables (Light theme default) ---- */
:root {
  --bg-primary:       #f5f5f7;
  --bg-secondary:     #ffffff;
  --bg-card:          #ffffff;
  --bg-input:         #f0f0f2;
  --bg-nav:           #ffffff;
  --bg-overlay:       rgba(255,255,255,0.95);

  --text-primary:     #1a1a2e;
  --text-secondary:   #5a5a72;
  --text-muted:       #9a9aaa;
  --text-inverse:     #ffffff;

  --accent:           #2d6a6f;
  --accent-light:     #3a8a90;
  --accent-dark:      #1e4a4e;
  --accent-bg:        #e8f4f5;

  --danger:           #c0392b;
  --danger-bg:        #fdecea;
  --success:          #27ae60;
  --success-bg:       #eafaf1;
  --warning:          #e67e22;
  --warning-bg:       #fef9e7;

  --border:           #e0e0ea;
  --border-focus:     #2d6a6f;
  --shadow:           0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:        0 8px 32px rgba(0,0,0,0.14);
  --shadow-card:      0 1px 4px rgba(0,0,0,0.06);

  --radius:           14px;
  --radius-sm:        8px;
  --radius-pill:      50px;

  --nav-height:       64px;
  --safe-bottom:      env(safe-area-inset-bottom, 0px);
  --safe-top:         env(safe-area-inset-top, 0px);

  --star-color:       #f5a623;
  --star-empty:       #d0d0da;

  --font:             -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  --font-mono:        'SF Mono', 'Fira Code', monospace;

  --transition:       0.2s ease;
  --transition-slow:  0.35s ease;
}

/* ---- Dark theme ---- */
[data-theme="dark"] {
  --bg-primary:       #0f0f17;
  --bg-secondary:     #1a1a2a;
  --bg-card:          #1e1e30;
  --bg-input:         #252538;
  --bg-nav:           #16162a;
  --bg-overlay:       rgba(15,15,23,0.97);

  --text-primary:     #e8e8f0;
  --text-secondary:   #9090a8;
  --text-muted:       #5a5a72;
  --text-inverse:     #0f0f17;

  --accent:           #4db8bf;
  --accent-light:     #6dcdd3;
  --accent-dark:      #3a9299;
  --accent-bg:        #0d2a2c;

  --danger:           #e74c3c;
  --danger-bg:        #2c1010;
  --success:          #2ecc71;
  --success-bg:       #0d2c1a;
  --warning:          #f39c12;
  --warning-bg:       #2c1f0a;

  --border:           #2a2a40;
  --border-focus:     #4db8bf;
  --shadow:           0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg:        0 8px 32px rgba(0,0,0,0.6);
  --shadow-card:      0 1px 4px rgba(0,0,0,0.3);

  --star-color:       #f5a623;
  --star-empty:       #3a3a50;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
  padding-top: var(--safe-top);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

/* Login body: no nav padding, no overflow */
body.login-body {
  padding-bottom: 0;
  padding-top: 0;
  overflow: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

button, input, textarea, select {
  font-family: var(--font);
  font-size: 1rem;
  border: none;
  outline: none;
  background: none;
}

/* ---- Typography ---- */
h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.3rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { font-size: 0.925rem; line-height: 1.6; color: var(--text-secondary); }

/* ---- Layout ---- */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

.page {
  padding: 20px 16px;
  max-width: 480px;
  margin: 0 auto;
  min-height: calc(100dvh - var(--nav-height) - var(--safe-bottom));
}

/* ---- Bottom Nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-nav);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -1px 0 var(--border);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 4px;
  border: none;
  background: none;
  text-decoration: none;
}

.nav-item svg { width: 24px; height: 24px; stroke-width: 1.5; }
.nav-item.active { color: var(--accent); }
.nav-item:hover { color: var(--accent); text-decoration: none; }

/* Old + button (kept for backwards compat) */
.nav-item-add {
  position: relative;
  top: -12px;
}

.nav-item-add .nav-add-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(45,106,111,0.5);
  transition: transform var(--transition), box-shadow var(--transition);
}

.nav-item-add .nav-add-btn:active {
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(45,106,111,0.4);
}

[data-theme="dark"] .nav-item-add .nav-add-btn {
  box-shadow: 0 4px 16px rgba(77,184,191,0.4);
}

/* ---- New escape pill button ---- */
.nav-item-new {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  top: -10px;
}

.nav-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(45,106,111,0.45);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.nav-new-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

.nav-new-btn:hover {
  background: var(--accent-light);
  text-decoration: none;
  color: #fff;
}

.nav-new-btn:active {
  transform: scale(0.94);
  box-shadow: 0 2px 8px rgba(45,106,111,0.4);
}

[data-theme="dark"] .nav-new-btn {
  box-shadow: 0 4px 16px rgba(77,184,191,0.35);
}

/* ---- Top Header ---- */
.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.top-header .page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header-actions { display: flex; gap: 8px; align-items: center; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card:active { box-shadow: var(--shadow); }

.card-body { padding: 16px; }
.card-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg-primary); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-light); border-color: var(--accent-light); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--accent); background: var(--accent-bg); }

.btn-icon {
  width: 40px; height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-icon-round { border-radius: 50%; }

.btn-full { width: 100%; }

.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: var(--radius); }

/* ---- Form Elements ---- */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(45,106,111,0.15);
  background: var(--bg-secondary);
}

[data-theme="dark"] .form-control:focus {
  box-shadow: 0 0 0 3px rgba(77,184,191,0.2);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239a9aaa' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Star Rating ---- */
.star-rating {
  display: flex;
  gap: 4px;
  align-items: center;
}

.star-rating input[type="radio"] { display: none; }

.star-rating label {
  cursor: pointer;
  font-size: 1.6rem;
  color: var(--star-empty);
  transition: color var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

.star-rating label:hover,
.star-rating label.active,
.star-rating input:checked ~ label {
  color: var(--star-color);
}

.star-rating label:active { transform: scale(1.2); }

/* RTL star trick */
.star-rating { direction: rtl; }
.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
  color: var(--star-color);
}

.rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.rating-row:last-child { border-bottom: none; }

.rating-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.rating-total-row {
  padding: 12px 0;
  border-top: 2px solid var(--border);
  margin-top: 8px;
}

.rating-total-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

/* ---- Tags / People ---- */
.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 48px;
  cursor: text;
  transition: border-color var(--transition);
}

.tag-input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(45,106,111,0.15);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--accent);
}

[data-theme="dark"] .tag {
  background: rgba(77,184,191,0.12);
  border-color: rgba(77,184,191,0.4);
}

.tag-remove {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
  transition: background var(--transition);
  border: none;
  padding: 0;
}

.tag-remove:hover { background: var(--accent-dark); }

.tag-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin-top: 4px;
}

.tag-autocomplete-item {
  padding: 12px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.tag-autocomplete-item:last-child { border-bottom: none; }
.tag-autocomplete-item:hover, .tag-autocomplete-item.focused {
  background: var(--accent-bg);
  color: var(--accent);
}

/* ---- KPI Cards ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.kpi-card.kpi-full { grid-column: 1 / -1; }

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- Record List Item ---- */
.record-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}

.record-item:last-child { border-bottom: none; }

.record-item:active { background: var(--bg-input); border-radius: var(--radius-sm); }

.record-thumb {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 1.4rem;
  overflow: hidden;
}

.record-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.record-info { flex: 1; min-width: 0; }

.record-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.record-badges {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 5px;
}

.record-rating {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--star-color);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-accent { background: var(--accent-bg); color: var(--accent); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-neutral { background: var(--bg-input);   color: var(--text-muted); }

.record-icons {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-top: 2px;
  flex-shrink: 0;
}

.record-icons svg { width: 16px; height: 16px; color: var(--text-muted); }

/* ---- Photo Grid ---- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.photo-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-input);
  position: relative;
}

.photo-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.photo-thumb:active img { transform: scale(0.97); }

.photo-thumb-add {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.photo-thumb-add:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Attachment List ---- */
.attachment-list { display: flex; flex-direction: column; gap: 8px; }

.attachment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.attachment-icon { color: var(--accent); flex-shrink: 0; }

.attachment-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ---- Map ---- */
#map {
  width: 100%;
  height: calc(100dvh - var(--nav-height) - 64px - var(--safe-bottom));
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.map-marker-count {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- Login Page ---- */
.login-root {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--bg-primary);
  position: relative;
}

/* Subtle top glow */
.login-root::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 280px;
  background: radial-gradient(ellipse 70% 100% at 50% -20%, rgba(45,106,111,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.login-card-wrap {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

/* Brand mark */
.login-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-mark-icon {
  width: 44px; height: 44px;
  background: var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(45,106,111,0.4);
}

[data-theme="dark"] .login-mark-icon {
  box-shadow: 0 4px 12px rgba(77,184,191,0.3);
}

.login-mark-text {
  display: flex;
  flex-direction: column;
}

.login-mark-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.login-mark-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 2px;
}

.login-heading {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.login-subheading {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* Theme toggle on login (small, below card) */
.login-theme-btn {
  margin-top: 20px;
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 1;
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 20px calc(20px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 18px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

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

.lightbox img {
  max-width: 100%;
  max-height: 90dvh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-close {
  position: absolute;
  top: calc(16px + var(--safe-top));
  right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

/* ---- Ranking Stars Display ---- */
.stars-display {
  display: inline-flex;
  gap: 2px;
}

.stars-display .star {
  font-size: 0.9rem;
  color: var(--star-empty);
}

.stars-display .star.filled { color: var(--star-color); }
.stars-display .star.half   { color: var(--star-color); opacity: 0.6; }

/* ---- Section Headers ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  margin-top: 24px;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-action {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 0.85rem; }

/* ---- Alerts ---- */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); }

/* ---- Loading Spinner ---- */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* ---- Admin Table ---- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

/* ---- Toggle Switch ---- */
.toggle {
  position: relative;
  width: 48px; height: 26px;
  display: inline-block;
  flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::after { transform: translateX(22px); }

/* ---- Rich Text Editor ---- */
.richtext-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  flex-wrap: wrap;
}

.richtext-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all var(--transition);
  background: transparent;
  border: none;
}

.richtext-btn:hover, .richtext-btn.active {
  background: var(--accent-bg);
  color: var(--accent);
}

.richtext-content {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.6;
  outline: none;
}

.richtext-content:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(45,106,111,0.15);
}

.richtext-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 4px 0;
}

/* ---- Map location picker ---- */
.map-picker {
  height: 250px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--border);
  margin-top: 8px;
  display: none;
}

.map-picker.visible { display: block; }

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ---- Scroll utility ---- */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }

/* ---- Pill filters ---- */
.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
  margin-bottom: 16px;
}

.filter-pills::-webkit-scrollbar { display: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.pill.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ---- Toasts ---- */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success { background: var(--success); color: white; }
.toast-error   { background: var(--danger);  color: white; }
.toast-info    { background: var(--accent);  color: white; }

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

/* ---- Utility classes ---- */
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* ---- Transitions for theme ---- */
body, .card, .bottom-nav, .top-header, .form-control, .btn, .modal {
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}
