/* ═══════════════════════════════════════════════════════════════
   Sparkle Pools — Shared Styles
   Common CSS extracted from all page files
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Places Autocomplete Override ── */
.pac-container, .pac-container * { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important; }

/* ── Font Faces ── */
@font-face { font-family: 'Koch Geometric'; src: url('KochGeometric-Book.otf') format('opentype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Koch Geometric'; src: url('KochGeometric-Medium.otf') format('opentype'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'Koch Geometric'; src: url('KochGeometric-Demi.otf') format('opentype'); font-weight: 600; font-style: normal; }
@font-face { font-family: 'Koch Geometric'; src: url('KochGeometric-Bold.otf') format('opentype'); font-weight: 700; font-style: normal; }
@font-face { font-family: 'Koch Geometric'; src: url('KochGeometric-Ultra.otf') format('opentype'); font-weight: 800; font-style: normal; }

/* ── CSS Variables ── */
:root {
  --blue: #1b5fa8; --blue-light: #2e7dd1; --blue-dark: #0e3d72;
  --teal: #0097a7; --teal-bg: #e0f7fa;
  --sky: #e3f4fa; --white: #ffffff;
  --gray-50: #f7f9fc; --gray-100: #eef1f6; --gray-200: #d8dee8;
  --gray-400: #8a95a8; --gray-600: #4a5568; --gray-700: #374151; --gray-800: #1e2533;
  --green: #2e7d32; --green-light: #43a047; --green-bg: #e8f5e9;
  --red: #c62828; --red-bg: #ffebee;
  --orange: #e65100; --orange-bg: #fff3e0;
  --gold: #f57f17; --gold-bg: #fffde7;
  --purple: #6a1b9a; --purple-bg: #f3e5f5;
  --shadow: 0 2px 12px rgba(27,95,168,0.10); --shadow-lg: 0 8px 32px rgba(27,95,168,0.16);
}

/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; touch-action: manipulation; }
body { font-family: 'Koch Geometric', sans-serif; background: var(--gray-50); color: var(--gray-800); min-height: 100vh; }

/* ── Header ── */
.sticky-top { position: sticky; top: 0; z-index: 200; }
header {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, var(--blue-light) 100%);
  padding: calc(16px + env(safe-area-inset-top)) 28px 16px; display: flex; align-items: center; gap: 16px;
  box-shadow: 0 2px 16px rgba(14,61,114,0.25); position: sticky; top: 0; z-index: 200;
}
.back-btn {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0; text-decoration: none;
  transition: background 0.15s;
}
.back-btn:hover { background: rgba(255,255,255,0.22); }
.back-btn svg { width: 20px; height: 20px; fill: white; }
.header-title { flex: 1; }
.header-title h1 { font-size: 20px; font-weight: 700; color: white; letter-spacing: 0.3px; }
.header-title p  { font-size: 12px; color: rgba(255,255,255,0.7); margin-top: 1px; }
.new-btn {
  background: white; color: var(--blue); border: none; border-radius: 8px;
  padding: 8px 16px; font-family: 'Koch Geometric', sans-serif; font-size: 13px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  transition: box-shadow 0.15s;
}
.new-btn:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.new-btn svg { width: 16px; height: 16px; fill: var(--blue); }

/* ── Filters Bar ── */
.filters-bar {
  background: white; border-bottom: 1.5px solid var(--gray-100);
  padding: 12px 28px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  position: sticky; top: 78px; z-index: 100;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap .si {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; pointer-events: none;
}
.search-wrap .si svg { width: 15px; height: 15px; }
#searchInput {
  width: 100%; padding: 8px 32px 8px 34px; border: 1.5px solid var(--gray-200);
  border-radius: 8px; font-family: 'Koch Geometric', sans-serif; font-size: 13px;
  background: var(--gray-50); color: var(--gray-800); outline: none; transition: border 0.15s;
}
#searchInput:focus { border-color: var(--blue-light); background: white; }
.clear-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--gray-400); font-size: 16px;
  display: none; line-height: 1;
}
.clear-btn.visible { display: block; }
.filter-select {
  padding: 8px 10px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-family: 'Koch Geometric', sans-serif; font-size: 13px; color: var(--gray-800);
  background: var(--gray-50); outline: none; cursor: pointer;
}
.filter-select:focus { border-color: var(--blue-light); }
.results-count { font-size: 12px; color: var(--gray-400); white-space: nowrap; margin-left: auto; }
.results-count strong { color: var(--gray-800); }

/* ── Main Wrap ── */
.main-wrap { padding: 20px 28px; max-width: 1200px; margin: 0 auto; }

/* ── State Messages ── */
.state-msg {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 24px; color: var(--gray-400); text-align: center; gap: 12px;
}
.state-msg svg { width: 48px; height: 48px; fill: var(--gray-200); }
.state-msg p { font-size: 15px; font-weight: 600; color: var(--gray-600); }
.state-msg small { font-size: 13px; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--gray-200);
  border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal (slide-in panel) ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(14,61,114,0.50); backdrop-filter: blur(3px);
  z-index: 500; display: flex; align-items: flex-start; justify-content: flex-end;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-panel {
  background: white; width: 100%; max-width: 480px; height: 100vh;
  overflow: hidden; box-shadow: -8px 0 40px rgba(14,61,114,0.18);
  transform: translateX(30px); transition: transform 0.25s ease;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.modal-overlay.open .modal-panel { transform: translateX(0); }
.modal-header {
  padding: calc(20px + env(safe-area-inset-top)) 24px 16px; border-bottom: 1.5px solid var(--gray-100);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  background: white; z-index: 10;
}
.modal-header h2 { font-size: 17px; font-weight: 700; flex: 1; color: var(--gray-800); }
.modal-close {
  background: var(--gray-100); border: none; border-radius: 50%; width: 32px; height: 32px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px;
  color: var(--gray-600); flex-shrink: 0; transition: background 0.15s;
}
.modal-close:hover { background: var(--gray-200); }
.modal-body { padding: 20px 24px; flex: 1; overflow-y: auto; }
.modal-footer {
  padding: 16px 24px; border-top: 1.5px solid var(--gray-100);
  display: flex; gap: 10px; flex-shrink: 0; background: white;
}

/* ── Form Fields ── */
.field-section { margin-bottom: 20px; }
.field-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--blue); margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1.5px solid var(--sky);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.field-row.full { grid-template-columns: 1fr; }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }
.field-label { font-size: 11px; font-weight: 600; color: var(--gray-400); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.4px; }
.field-input {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-family: 'Koch Geometric', sans-serif; font-size: 13px; color: var(--gray-800);
  background: var(--gray-50); outline: none; transition: border 0.15s;
}
.field-input:focus { border-color: var(--blue-light); background: white; box-shadow: 0 0 0 3px rgba(46,125,209,0.1); }
.field-select {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-family: 'Koch Geometric', sans-serif; font-size: 13px; color: var(--gray-800);
  background: var(--gray-50); outline: none; cursor: pointer;
}
.field-select:focus { border-color: var(--blue-light); }

/* ── Toggles ── */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.toggle-label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.toggle-wrap { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0; background: var(--gray-200); border-radius: 11px;
  cursor: pointer; transition: background 0.2s;
}
.toggle-wrap input:checked + .toggle-track { background: var(--blue); }
.toggle-track::before {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: white; top: 3px; left: 3px; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-wrap input:checked + .toggle-track::before { transform: translateX(18px); }

/* ── Highlight ── */
mark { background: #fff59d; color: inherit; border-radius: 2px; padding: 0 1px; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--gray-800); color: white; padding: 10px 20px; border-radius: 24px;
  font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; z-index: 9999; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); }

/* ── Timeout Overlay ── */
.timeout-overlay {
  position: fixed; inset: 0; background: rgba(14,61,114,0.70); backdrop-filter: blur(4px);
  z-index: 9990; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.timeout-overlay.open { opacity: 1; pointer-events: all; }
.timeout-box {
  background: white; border-radius: 20px; padding: 32px 28px; max-width: 340px; width: 90%;
  text-align: center; box-shadow: var(--shadow-lg);
}
.timeout-icon {
  width: 64px; height: 64px; border-radius: 50%; background: var(--sky);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.timeout-icon svg { width: 32px; height: 32px; fill: var(--blue); }
.timeout-box h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.timeout-box p { font-size: 14px; color: var(--gray-400); margin-bottom: 20px; }
.timeout-countdown { font-size: 40px; font-weight: 800; color: var(--blue); line-height: 1; }
.timeout-countdown-label { font-size: 12px; color: var(--gray-400); margin: 4px 0 20px; }
.timeout-btns { display: flex; gap: 10px; }
.timeout-stay { flex: 1; background: var(--blue); color: white; border: none; border-radius: 10px; padding: 12px; font-family: 'Koch Geometric', sans-serif; font-size: 14px; font-weight: 700; cursor: pointer; }
.timeout-logout { flex: 1; background: white; color: var(--gray-600); border: 1.5px solid var(--gray-200); border-radius: 10px; padding: 12px; font-family: 'Koch Geometric', sans-serif; font-size: 14px; font-weight: 600; cursor: pointer; }

/* ── Shared Responsive ── */
@media (max-width: 640px) {
  header { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 10px; }
  .header-title h1 { font-size: 17px; }
  .header-title p  { font-size: 11px; }
  .new-btn { padding: 7px 11px; font-size: 12px; }

  .filters-bar { padding: 8px 12px; gap: 7px; flex-wrap: wrap; top: 60px; }
  .search-wrap { min-width: 0; flex: 1 1 100%; order: -1; }
  .filter-select { font-size: 12px; padding: 7px 8px; flex: 1 1 auto; }
  .results-count { display: none; }

  .main-wrap { padding: 12px 10px; }

  .modal-panel { max-width: 100%; }
  .modal-header { padding: calc(14px + env(safe-area-inset-top)) 16px 14px; }
  .modal-body   { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }

  .field-row, .field-row.three { grid-template-columns: 1fr; }
  .field-section { margin-bottom: 16px; }

  .timeout-box { padding: 24px 20px; }
  .timeout-countdown { font-size: 34px; }
}
