*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --blue:    #4a90d9;
  --blue-lt: #e8f2fc;
  --green:   #5a9e6f;
  --berry:   #7b5ea7;
  --berry-lt:#f3effe;
  --text:    #1e1e2e;
  --muted:   #6b7280;
  --border:  #e5e7eb;
  --bg:      #f9fafb;
  --white:   #ffffff;
  --radius:  12px;
  --shadow:  0 2px 12px rgba(0,0,0,.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue-lt: #1a2f45;
    --berry-lt:#2a1f3d;
    --text:    #e8e8f0;
    --muted:   #9ca3af;
    --border:  #374151;
    --bg:      #111827;
    --white:   #1f2937;
    --shadow:  0 2px 12px rgba(0,0,0,.35);
  }
  /* Inactive filter pills: raise contrast in dark mode so they stand out
     against the dark page background. */
  .filter-btn { border-color: var(--muted); background: #252d3a; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Header ── */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 900px; margin: 0 auto;
  padding: 0 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.logo-paw { font-size: 1.4rem; }
.logo span { color: var(--berry); }

.header-actions { display: flex; gap: .75rem; align-items: center; }


.btn {
  padding: .45rem 1rem; border-radius: 8px; font-size: .875rem;
  font-weight: 600; cursor: pointer; border: none; transition: opacity .15s, background .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
}
.btn:hover { opacity: .88; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-primary { background: var(--berry); color: var(--white); }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--berry-lt) 0%, var(--blue-lt) 100%);
  padding: 3rem 1.25rem 2.5rem;
  text-align: center;
}
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: .5rem; }
.hero h1 em { font-style: normal; color: var(--berry); }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 520px; margin: 0 auto 1.5rem; }

/* ── Filters ── */
.filters {
  max-width: 900px; margin: 0 auto;
  padding: 1.5rem 1.25rem .5rem;
  display: flex; gap: .75rem; flex-wrap: wrap; align-items: center;
}
.filter-label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: .25rem; }
.filter-btn {
  padding: .35rem .9rem; border-radius: 999px; font-size: .85rem;
  border: 1.5px solid var(--border); background: var(--white);
  color: var(--text);
  cursor: pointer; font-weight: 500; transition: all .15s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--berry); color: var(--white); border-color: var(--berry);
}

/* ── Region filter dropdown ── */
.filter-sep {
  display: inline-block; width: 1px; height: 1.4rem;
  background: var(--border); align-self: center; margin: 0 .15rem;
}
.region-filter { position: relative; }
.region-btn { display: flex; align-items: center; gap: .35rem; }
.region-chevron { font-size: .7rem; opacity: .65; transition: transform .15s; }
.region-btn.open .region-chevron { transform: rotate(180deg); }
.region-btn.active .region-chevron { opacity: 1; }

.region-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 200;
  min-width: 190px; max-height: 280px; overflow-y: auto;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  list-style: none; padding: .35rem 0;
}
.region-menu li {
  padding: .45rem 1rem; font-size: .875rem; cursor: pointer;
  color: var(--text); display: flex; align-items: center; gap: .5rem;
  white-space: nowrap; user-select: none;
}
.region-menu li:hover { background: var(--berry-lt); }
.region-menu li.selected { font-weight: 600; }
.region-menu li.selected::before { content: "✓"; color: var(--berry); flex-shrink: 0; }
.region-menu li:not(.selected)::before { content: ""; display: inline-block; width: 1ch; flex-shrink: 0; }
.region-menu li.location-item { color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: .35rem; padding-bottom: .55rem; }
.region-menu li.location-item:hover { color: var(--text); }
.region-menu li.location-item::before { content: none; }

/* ── Near-me filter ── */
.nearme-filter { position: relative; display: flex; align-items: center; gap: .35rem; }
.nearme-cancel-btn {
  display: flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; padding: 0;
  border: 1.5px solid var(--border); border-radius: 50%;
  background: transparent; color: var(--muted); font-size: .85rem;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.nearme-cancel-btn::after { content: "✕"; }
.nearme-cancel-btn:hover { border-color: var(--muted); color: var(--text); }

/* ── Loading state ── */
.loading {
  text-align: center; padding: 4rem 1rem; color: var(--muted);
}
.spinner {
  display: inline-block; width: 36px; height: 36px;
  border: 3px solid var(--border); border-top-color: var(--berry);
  border-radius: 50%; animation: spin .8s linear infinite;
  margin-bottom: 1rem;
}

/* ── Error state ── */
.error-state {
  text-align: center; padding: 4rem 1rem;
}
.error-state .icon { font-size: 2.5rem; margin-bottom: 1rem; }
.error-state p { color: var(--muted); margin-bottom: 1.25rem; }

/* ── Event grid ── */
.events {
  max-width: 900px; margin: 0 auto;
  padding: .75rem 1.25rem 3rem;
  display: grid; gap: 1rem;
}

/* Month separator */
.month-separator {
  display: flex; align-items: center; gap: .75rem;
  margin: 1.5rem 0 .5rem;
}
.month-separator span {
  font-size: .8rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.month-separator::before,
.month-separator::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.month-separator:first-child { margin-top: 0; }

.event-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  gap: 0;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.event-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.11); }

/* Date column */
.event-date {
  background: var(--berry);
  color: var(--white);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1rem .5rem;
  text-align: center;
}
.event-date .day   { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.event-date .month { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; opacity: .85; margin-top: .15rem; }
.event-date .year  { font-size: .7rem; opacity: .7; }

/* Body */
.event-body { padding: 1rem 1.25rem; min-width: 0; }
.event-name { font-size: 1.05rem; font-weight: 700; margin-bottom: .3rem; }

.event-meta {
  display: flex; flex-wrap: wrap; gap: .4rem .9rem;
  font-size: .825rem; color: var(--muted); margin-bottom: .5rem;
}
.event-meta span { display: flex; align-items: center; gap: .25rem; }
.event-meta a { color: var(--muted); text-decoration: none; }
.event-meta a:hover { color: var(--text); text-decoration: underline; }

.event-desc {
  font-size: .875rem; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}


/* Map column */
.event-map {
  display: flex; align-items: center; justify-content: center;
  padding: .5rem .75rem;
}
.region-map {
  width: 44px; height: auto;
}
.region-map path {
  fill: var(--border);
  stroke: var(--white);
  stroke-width: 1.5;
}
.region-map path.highlighted {
  fill: var(--berry);
}

/* Actions column */
.event-actions {
  display: flex; flex-direction: column;
  align-items: flex-end; justify-content: space-between;
  padding: 1rem 1.25rem;
  gap: .75rem;
}
.event-price {
  font-size: 1.1rem; font-weight: 700; color: var(--green);
  white-space: nowrap;
}
.btn-info {
  background: var(--blue-lt); color: var(--blue);
  padding: .4rem .9rem; border-radius: 8px; font-size: .8rem;
  font-weight: 600; border: none; cursor: pointer; text-decoration: none;
  white-space: nowrap; transition: background .15s;
}
.btn-info:hover { background: var(--blue); color: var(--white); }

.cal-dropdown { position: relative; }
.btn-cal {
  background: transparent; color: var(--muted);
  padding: .4rem .9rem; border-radius: 8px; font-size: .8rem;
  font-weight: 600; border: 1.5px solid var(--border); cursor: pointer;
  white-space: nowrap; transition: all .15s;
}
.btn-cal:hover { border-color: var(--green); color: var(--green); }
.cal-menu {
  display: none; position: absolute; right: 0; bottom: calc(100% + 6px);
  background: var(--white); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow);
  overflow: hidden; min-width: 170px; z-index: 50;
}
.cal-menu.open { display: block; }
.cal-menu button {
  display: flex; align-items: center; gap: .5rem;
  width: 100%; padding: .55rem .9rem; background: none; border: none;
  font-size: .825rem; font-weight: 500; color: var(--text);
  cursor: pointer; text-align: left; transition: background .1s;
}
.cal-menu button:hover { background: var(--bg); }

/* Empty state */
.empty {
  text-align: center; padding: 4rem 1rem; color: var(--muted);
}
.empty .icon { font-size: 3rem; margin-bottom: 1rem; }

/* ── Add event modal ── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--white); border-radius: var(--radius);
  width: 100%; max-width: 480px;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; }

.modal-body { padding: 1.5rem 2rem; }
.modal-body.auth-step { padding: 1.75rem 2rem; }

/* Auth step */
.auth-step { text-align: center; padding: .25rem 0 .5rem; }
.auth-icon { font-size: 2rem; margin-bottom: .75rem; line-height: 1; }
.auth-step p { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; line-height: 1.5; }
.auth-field { margin-bottom: 1rem; }
.auth-field input[type="email"] {
  width: 100%; padding: .7rem .9rem;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 1rem; font-family: inherit;
  background: var(--bg); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.auth-field input[type="email"]:focus {
  border-color: var(--berry);
  box-shadow: 0 0 0 3px rgba(123,94,167,.15);
}
.auth-submit { width: 100%; justify-content: center; padding: .75rem; font-size: .95rem; }

/* Upload step — compact zone at top of form */
.upload-zone-compact {
  display: flex; align-items: center; gap: .75rem;
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: .75rem 1rem; cursor: pointer; margin-bottom: 1.25rem;
  font-size: .875rem; color: var(--muted);
  transition: border-color .15s, background .15s;
}
.upload-zone-compact:hover, .upload-zone-compact.drag-over {
  border-color: var(--berry); background: var(--berry-lt);
}
.upload-zone-compact input { display: none; }
.upload-zone-compact > span:first-child { font-size: 1.25rem; flex-shrink: 0; }

/* URL extraction row */
.url-extract-row {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 1.25rem;
}
.url-extract-row span {
  font-size: .8rem; color: var(--muted); white-space: nowrap; flex-shrink: 0;
}
.url-extract-row input[type="url"] {
  flex: 1; min-width: 0;
  padding: .45rem .65rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: .85rem; font-family: inherit;
  background: var(--white); color: var(--text);
}
.url-extract-row input[type="url"]:focus {
  outline: none; border-color: var(--berry);
}
.url-extract-row .btn { white-space: nowrap; font-size: .82rem; padding: .4rem .75rem; }

/* Inline extraction progress */
.extract-progress-inline {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1rem; border-radius: var(--radius);
  background: var(--berry-lt); margin-bottom: 1.25rem;
  font-size: .875rem; color: var(--berry);
}
.extract-inline-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(123,94,167,.3); border-top-color: var(--berry);
  border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0;
}
.extract-cancel-btn {
  margin-left: auto; background: none; border: none;
  cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1;
}
.extract-cancel-btn:hover { color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Form step */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .3rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field textarea, .field select {
  width: 100%; padding: .55rem .75rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .9rem; font-family: inherit;
  background: var(--white); color: var(--text);
  transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--berry);
}
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.llm-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 600; color: var(--berry);
  background: var(--berry-lt); padding: .15rem .5rem; border-radius: 999px;
  margin-bottom: .75rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .75rem;
}

/* ── Toast notifications ── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .6rem;
  z-index: 9999; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .65rem;
  padding: .75rem 1.1rem;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 4px 20px rgba(0,0,0,.15);
  font-size: .9rem; font-weight: 500; max-width: 320px;
  animation: toast-in .2s ease;
  pointer-events: auto;
}
.toast-success { border-left: 4px solid var(--green); }
.toast-error   { border-left: 4px solid #e74c3c; }
.toast-icon    { font-size: 1.1rem; flex-shrink: 0; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .event-card { grid-template-columns: 64px 1fr; }
  .event-actions { display: none; }
  .event-map { display: none; }
  .event-body { padding-right: 1rem; }
  .hero h1 { font-size: 1.5rem; }
}
