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

:root {
  --color-bg: #0A0E14;
  --color-surface: #141B24;
  --color-surface-2: #1C2632;
  --color-border: #243040;
  --color-primary: #00B4D8;
  --color-primary-hover: #0096C7;
  --color-text: #E8EDF2;
  --color-text-muted: #8B9DAF;
  --color-danger: #E63946;
  --color-success: #52B788;
  --radius: 12px;
  --space: 1rem;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Nav ─────────────────────────────────────────────── */
nav {
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
nav .brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--color-primary);
  margin-right: auto;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
}
nav a:hover { color: var(--color-text); }

/* ── Main ────────────────────────────────────────────── */
main {
  flex: 1;
  padding: 1.25rem 1rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* ── Feed intent cards ───────────────────────────────── */
.intent-card {
  position: relative;
  height: 210px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 0.75rem;
  background-color: var(--color-surface-2);
  background-size: cover;
  background-position: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.intent-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.intent-card:active { transform: scale(0.98); }

/* Two-layer gradient: dark bottom + accent colour bleed from bottom */
.intent-card .card-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, transparent 25%, rgba(10,14,20,0.93) 100%),
    linear-gradient(to top, rgba(var(--accent-rgb, 0,180,216), 0.28) 0%, transparent 50%);
}

.intent-card .tag-chip {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(var(--accent-rgb, 0,180,216), 0.85);
  color: #fff;
  backdrop-filter: blur(4px);
}

.intent-card .card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.9rem 1rem;
}
.intent-card .card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 0.35rem;
  line-height: 1.25;
}
.intent-card .card-meta-row {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.intent-card .card-meta-row .dot { opacity: 0.4; }

/* ── Standard card (forms, detail, etc.) ─────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space);
  margin-bottom: 0.75rem;
}
.card-meta {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
label {
  display: block;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}
input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font-body);
  background: var(--color-surface-2);
  color: var(--color-text);
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: transparent;
}
select option { background: var(--color-surface-2); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-primary); color: #0A0E14; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.btn-secondary:hover { background: var(--color-surface-2); }
.btn-secondary.selected {
  background: var(--color-primary);
  color: #0A0E14;
  border-color: var(--color-primary);
  font-weight: 700;
}
.btn-danger { background: var(--color-danger); color: white; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline:hover { background: rgba(0,180,216,0.08); }
.btn-block { width: 100%; display: block; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Commitment badges */
.commitment-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-going { background: rgba(0,180,216,0.18); color: var(--color-primary); }
.badge-interested { background: rgba(255,200,80,0.18); color: #c8960a; }

/* ── Alerts ──────────────────────────────────────────── */
.banner {
  background: rgba(244,162,97,0.1);
  border: 1px solid rgba(244,162,97,0.25);
  border-radius: var(--radius);
  padding: 0.75rem var(--space);
  font-size: 0.875rem;
  margin-bottom: var(--space);
  color: var(--color-text);
}

/* ── Headings ────────────────────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space);
}
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--color-text-muted); }

/* ── Status chips ────────────────────────────────────── */
.tag-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(0,180,216,0.15);
  color: var(--color-primary);
}
.status-chip {
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-display);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-open   { background: rgba(82,183,136,0.15); color: #52B788; }
.status-full   { background: rgba(244,162,97,0.15);  color: #F4A261; }
.status-cancelled { background: rgba(230,57,70,0.15); color: #E63946; }

/* ── Utilities ───────────────────────────────────────── */
.text-muted { color: var(--color-text-muted); font-size: 0.875rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.flex-row { display: flex; align-items: center; gap: 0.75rem; }
.spacer { flex: 1; }
[x-cloak] { display: none !important; }

/* ── Detail page participant list ────────────────────── */
.participant-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.participant-row:last-child { border-bottom: none; }
.participant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

/* ── Availability management ─────────────────────────── */
.day-picker { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.day-chip {
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  user-select: none;
  transition: all 0.15s;
}
.day-chip.selected {
  background: var(--color-primary);
  color: #0A0E14;
  border-color: var(--color-primary);
  font-weight: 700;
}
.day-chip:hover { border-color: var(--color-primary); color: var(--color-text); }
.time-row { display: flex; gap: 0.75rem; align-items: center; }
.time-row input[type="time"] { flex: 1; }
.avail-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.avail-details { flex: 1; }
.avail-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }
.avail-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ── Browse header ───────────────────────────────────────── */
.browse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* ── View toggle (List | Map) ────────────────────────────── */
.view-toggle {
  display: flex;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.view-toggle button {
  padding: 0.35rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.view-toggle button.active {
  background: var(--color-primary);
  color: #0A0E14;
}

/* ── Filter section ──────────────────────────────────────── */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.filter-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.filter-chip:hover { border-color: var(--color-primary); color: var(--color-text); }
.filter-chip.active {
  background: rgba(0,180,216,0.15);
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}

/* ── Result count ────────────────────────────────────────── */
.result-count { margin-bottom: 0.75rem; font-size: 0.8rem; }

/* ── Browse map container ────────────────────────────────── */
.map-container {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
/* Explicit px heights — height:100% resolves to 0 when parent was display:none */
#browse-map { height: 460px; width: 100%; }
#browse-map.leaflet-container { height: 460px; }

.leaflet-popup-content-wrapper {
  background: #141B24 !important;
  color: #E8EDF2 !important;
  border: 1px solid #243040 !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6) !important;
}
.leaflet-popup-tip { background: #141B24 !important; }
.leaflet-popup-content { margin: 10px 12px !important; }

/* ── Intent detail photo ─────────────────────────────────── */
.detail-photo-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin-bottom: 1rem;
  height: 220px;
}
.detail-photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Intent detail map ───────────────────────────────────── */
.detail-map-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin-bottom: 1.25rem;
}
#detail-map { height: 180px; width: 100%; }
#detail-map.leaflet-container { height: 180px; }

/* ── User profile hero ───────────────────────────────── */
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.profile-photo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-primary);
  box-shadow: 0 0 0 4px rgba(0,180,216,0.15);
}
.profile-photo-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
}

/* ── Map pin label (detail page) ────────────────────── */
.map-pin-label {
  background: rgba(10,14,20,0.88) !important;
  border: 1px solid #00B4D8 !important;
  color: #E8EDF2 !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  padding: 0.2rem 0.55rem !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
  white-space: nowrap !important;
}
.map-pin-label::before { border-top-color: #00B4D8 !important; }

/* ── Share row (detail page) ─────────────────────────── */
.share-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 1rem;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}
.share-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
}

/* ── Mobile responsive ───────────────────────────────── */
@media (max-width: 480px) {
  main { padding: 1rem 0.75rem; }
  h1 { font-size: 1.35rem; }
  .intent-card { height: 185px; }
  .intent-card .card-title { font-size: 0.98rem; }
  nav { padding: 0.75rem 1rem; gap: 1.25rem; }
  /* Slightly smaller brand on narrow screens to clear the phone-frame border-radius clip */
  nav .brand { font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  .intent-card { transition: none; }
  .btn { transition: none; }
}

/* ── Photo picker (post intent) ─────────────────────── */
.photo-picker {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}
.photo-option {
  flex: 0 0 100px;
  height: 68px;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  transition: border-color 0.15s;
}
.photo-option.selected { border-color: var(--color-primary); }
.photo-check {
  position: absolute;
  top: 4px;
  right: 6px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* ── Seed / Demo badge ──────────────────────────────── */
.seed-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255,183,3,0.9);
  color: #0A0E14;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
}

/* ── Intent type badge ──────────────────────────────── */
.intent-type-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.intent-type-generic {
  background: rgba(0, 180, 216, 0.9);
  color: #fff;
}

/* ── Crop modal ─────────────────────────────────────── */
.crop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}
.crop-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  width: 100%;
  max-width: 480px;
}
.crop-container {
  height: 300px;
  background: #000;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
}
.crop-zoom-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.75rem;
}
.crop-zoom-row .btn { min-width: 2.5rem; font-size: 1.1rem; padding: 0.3rem 0.6rem; }

/* Circular crop box preview */
.crop-container .cropper-view-box,
.crop-container .cropper-face {
  border-radius: 50%;
}

/* Period hint text */
.period-hint {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  opacity: 0.55;
}
/* Day group preset chips (slightly different style) */
.day-chip-group {
  font-size: 0.8rem;
  opacity: 0.8;
  border-style: dashed;
}
.day-chip-group:hover { opacity: 1; border-style: solid; }
