/* ================================================================
   LostGreta — Vibe-Map Styles
   Single Point design + Party Mode + Sass-o-meter + Rain
   ================================================================ */

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

:root {
  --bg:        #f5f5f5;
  --white:     #ffffff;
  --black:     #1a1a1a;
  --grey-100:  #f7f7f8;
  --grey-200:  #ebebed;
  --grey-400:  #9b9ba5;
  --grey-600:  #5c5c66;
  --blue:      #2B59FF;
  --red:       #E53935;
  --neon-pink: #ff00ff;
  --neon-cyan: #00ffff;
  --neon-grn:  #39ff14;
  --font:      'DM Sans', -apple-system, sans-serif;
  --radius:    20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
}

html, body {
  height: 100%; font-family: var(--font);
  background: var(--bg); color: var(--black);
  overflow: hidden; -webkit-font-smoothing: antialiased;
}

/* ── Mode Visibility ───────────────────────────────────────────── */
[data-mode="driving"] .overview-only { display: none !important; }
[data-mode="overview"] .driving-only { display: none !important; }

/* ── Overlay ───────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--white); transition: opacity 0.4s, visibility 0.4s;
}
.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.overlay-content { text-align: center; padding: 2rem; }
.overlay-icon {
  width: 48px; height: 48px; margin: 0 auto 1.5rem; color: var(--blue);
  animation: spin-pulse 2s ease-in-out infinite;
}
.overlay-icon svg { width: 100%; height: 100%; }
@keyframes spin-pulse {
  0%, 100% { transform: rotate(0deg) scale(1); opacity: 0.6; }
  50%      { transform: rotate(180deg) scale(1.1); opacity: 1; }
}
.overlay-content h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.4rem; }
.overlay-content p { font-size: 0.9rem; color: var(--grey-600); margin-bottom: 1.5rem; }
.btn-overlay {
  padding: 14px 32px; font-family: var(--font);
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--white); background: var(--black);
  border: none; border-radius: var(--radius-xs); cursor: pointer;
}
.btn-overlay-skip {
  background: transparent; color: var(--grey-600);
  border: 2px solid var(--grey-200); font-size: 0.78rem;
  padding: 12px 28px;
}

/* ── App Shell ─────────────────────────────────────────────────── */
.app { position: relative; width: 100%; height: 100%; }
.map-container { width: 100%; height: 100%; }

/* MapLibre controls */
.maplibregl-ctrl-top-right { top: 60px; }
.maplibregl-ctrl-group {
  background: var(--white) !important; border: none !important;
  border-radius: var(--radius-xs) !important; box-shadow: var(--shadow) !important;
}
.maplibregl-ctrl-group button {
  width: 38px !important; height: 38px !important;
  background: var(--white) !important; border: none !important;
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--grey-200) !important; }
.maplibregl-ctrl-attrib { background: rgba(255,255,255,0.75) !important; font-size: 0.55rem !important; }
[data-mode="driving"] .maplibregl-ctrl-top-right { display: none; }

/* ══════════════════════════════════════════════════════════════════
   SEARCH BAR
   ══════════════════════════════════════════════════════════════════ */
.search-bar {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 1001;
  display: flex; align-items: center; gap: 0;
  background: var(--white); border-radius: 28px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  height: 48px;
}
.search-icon { flex-shrink: 0; margin-left: 16px; color: var(--grey-400); }
.search-bar input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 0 12px; font-family: var(--font); font-size: 0.82rem;
  color: var(--black);
}
.search-bar input::placeholder { color: var(--grey-400); font-size: 0.78rem; }
#search-btn {
  flex-shrink: 0; padding: 0 20px; height: 100%;
  font-family: var(--font); font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.04em; color: var(--white); background: var(--black);
  border: none; cursor: pointer; transition: background 0.2s;
}
#search-btn:hover { background: #333; }

/* ══════════════════════════════════════════════════════════════════
   VIBE TOGGLE
   ══════════════════════════════════════════════════════════════════ */
.vibe-toggle {
  position: absolute; top: 72px; right: 12px; z-index: 1001;
  padding: 10px 18px; font-family: var(--font); font-size: 0.75rem;
  font-weight: 700; letter-spacing: 0.06em;
  color: var(--black); background: var(--white);
  border: 2px solid var(--grey-200); border-radius: 24px;
  cursor: pointer; box-shadow: var(--shadow);
  transition: all 0.3s;
}

/* ══════════════════════════════════════════════════════════════════
   SASS-O-METER
   ══════════════════════════════════════════════════════════════════ */
.sass-panel {
  position: absolute; top: 120px; right: 12px; z-index: 1000;
  width: 220px; padding: 16px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: all 0.3s;
}
.sass-title {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--grey-400); margin-bottom: 10px;
}
.sass-bar-wrap {
  height: 6px; background: var(--grey-200); border-radius: 3px;
  overflow: hidden; margin-bottom: 10px;
}
.sass-bar {
  height: 100%; width: 0%; border-radius: 3px;
  background: linear-gradient(90deg, var(--blue), var(--neon-pink));
  transition: width 0.3s ease;
}
.sass-text {
  font-size: 0.78rem; font-weight: 600; color: var(--black);
  line-height: 1.4; min-height: 40px;
}

/* In driving mode, reposition below turn card */
[data-mode="driving"] .sass-panel {
  top: auto; bottom: 180px; right: 12px;
  width: 190px; padding: 12px;
}

/* ══════════════════════════════════════════════════════════════════
   PHOTO MARKERS
   ══════════════════════════════════════════════════════════════════ */
.photo-marker { position: relative; cursor: pointer; }
.photo-marker img {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--white); box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  display: block; transition: all 0.3s;
}
.photo-marker.user img { border-color: var(--blue); }
.photo-marker.dest img { border-color: var(--black); }
.photo-marker.user::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: rgba(43,89,255,0.2);
  animation: marker-pulse 2s ease-out infinite; z-index: -1;
}
@keyframes marker-pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}
.marker-label {
  position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%);
  font-family: var(--font); font-size: 0.6rem; font-weight: 700;
  color: var(--white); background: var(--black);
  padding: 2px 8px; border-radius: 6px; white-space: nowrap;
  letter-spacing: 0.03em; text-transform: uppercase;
}
/* Umbrella emoji for rain */
.marker-umbrella {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  font-size: 16px; z-index: 2;
}

/* ── Bounce (Konami / Speed) ───────────────────────────────────── */
.bounce img {
  animation: marker-bounce 0.4s ease infinite !important;
}
@keyframes marker-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

/* ══════════════════════════════════════════════════════════════════
   OVERVIEW CARD
   ══════════════════════════════════════════════════════════════════ */
.ov-card {
  position: absolute; bottom: 24px; left: 16px; right: 16px; z-index: 1000;
  background: var(--white); border-radius: var(--radius);
  padding: 28px 24px 24px; box-shadow: var(--shadow-lg);
  animation: slide-up 0.5s ease;
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ov-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ov-accent-line { width: 28px; height: 3px; background: var(--blue); border-radius: 2px; }
.ov-label {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em;
  color: var(--grey-400); text-transform: uppercase;
}
.ov-card-name { font-size: 1.65rem; font-weight: 800; line-height: 1.15; margin-bottom: 4px; }
.ov-card-address { font-size: 0.85rem; color: var(--grey-600); margin-bottom: 20px; }
.ov-card-stats {
  display: flex; gap: 32px; margin-bottom: 20px;
  padding-top: 16px; border-top: 1px solid var(--grey-200);
}
.ov-stat { display: flex; flex-direction: column; }
.ov-stat-label {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--grey-400); text-transform: uppercase; margin-bottom: 2px;
}
.ov-stat-value { font-size: 1.15rem; font-weight: 800; }
.btn-navigate {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px;
  font-family: var(--font); font-size: 0.9rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--white); background: var(--black);
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-navigate:hover { background: #333; }
.btn-navigate:active { transform: scale(0.98); }

/* ══════════════════════════════════════════════════════════════════
   DRIVING MODE
   ══════════════════════════════════════════════════════════════════ */
.drv-turn-card {
  position: absolute; top: 16px; left: 16px; right: 16px; z-index: 1000;
  display: flex; align-items: flex-start; gap: 16px; padding: 20px;
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.drv-turn-icon {
  flex-shrink: 0; width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--black); border-radius: var(--radius-xs); color: var(--white);
}
.drv-turn-icon svg { width: 28px; height: 28px; }
.drv-turn-body { flex: 1; min-width: 0; }
.drv-turn-dist-label {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--grey-400); text-transform: uppercase;
}
.drv-turn-instruction { font-size: 1.6rem; font-weight: 900; line-height: 1.15; margin: 2px 0; }
.drv-turn-road { font-size: 0.8rem; color: var(--grey-600); }

.drv-bottom {
  position: absolute; bottom: 16px; left: 16px; right: 16px; z-index: 1000;
  background: var(--white); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow-lg);
}
.drv-stats { display: flex; gap: 32px; margin-bottom: 16px; }
.drv-stat { display: flex; flex-direction: column; }
.drv-stat-label {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--grey-400); text-transform: uppercase; margin-bottom: 2px;
}
.drv-stat-value { font-size: 1.3rem; font-weight: 900; }
.btn-exit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px;
  font-family: var(--font); font-size: 0.85rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--white); background: var(--black);
  border: none; border-radius: var(--radius-sm); cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════════
   PARTY MODE 🎉
   ══════════════════════════════════════════════════════════════════ */
[data-vibe="party"] { --bg: #0a0015; --black: #1a1a1a; }
[data-vibe="party"] .vibe-toggle {
  background: var(--neon-pink); color: var(--white);
  border-color: var(--neon-pink);
  box-shadow: 0 0 20px rgba(255,0,255,0.3);
}
[data-vibe="party"] .sass-panel {
  background: rgba(20,0,40,0.7); border-color: rgba(255,0,255,0.25);
  box-shadow: 0 0 24px rgba(255,0,255,0.15);
}
[data-vibe="party"] .sass-title { color: var(--neon-cyan); }
[data-vibe="party"] .sass-text { color: var(--white); }
[data-vibe="party"] .sass-bar-wrap { background: rgba(255,255,255,0.1); }

[data-vibe="party"] .search-bar {
  background: rgba(20,0,40,0.85); border: 1px solid rgba(255,0,255,0.3);
}
[data-vibe="party"] .search-bar input { color: var(--white); }
[data-vibe="party"] .search-bar input::placeholder { color: rgba(255,255,255,0.4); }
[data-vibe="party"] #search-btn { background: var(--neon-pink); }
[data-vibe="party"] .search-icon { color: var(--neon-pink); }

[data-vibe="party"] .ov-card {
  background: rgba(20,0,40,0.9); border: 1px solid rgba(255,0,255,0.2);
}
[data-vibe="party"] .ov-card-name { color: var(--white); }
[data-vibe="party"] .ov-card-address { color: rgba(255,255,255,0.5); }
[data-vibe="party"] .ov-stat-value { color: var(--neon-cyan); }
[data-vibe="party"] .ov-card-stats { border-color: rgba(255,255,255,0.1); }
[data-vibe="party"] .btn-navigate {
  background: var(--neon-pink);
  box-shadow: 0 0 20px rgba(255,0,255,0.4);
}

[data-vibe="party"] .drv-turn-card,
[data-vibe="party"] .drv-bottom {
  background: rgba(20,0,40,0.9); border: 1px solid rgba(255,0,255,0.2);
}
[data-vibe="party"] .drv-turn-instruction { color: var(--white); }
[data-vibe="party"] .drv-stat-value { color: var(--neon-cyan); }
[data-vibe="party"] .drv-turn-icon { background: var(--neon-pink); }
[data-vibe="party"] .btn-exit {
  background: var(--neon-pink);
  box-shadow: 0 0 16px rgba(255,0,255,0.3);
}

/* Party marker: disco pulse */
[data-vibe="party"] .photo-marker.dest img {
  border-color: var(--neon-pink) !important;
  box-shadow: 0 0 16px var(--neon-pink), 0 0 32px var(--neon-cyan);
  animation: disco 1.2s ease-in-out infinite !important;
}
@keyframes disco {
  0%, 100% { transform: scale(1) rotate(0deg); filter: hue-rotate(0deg); }
  25%  { transform: scale(1.08) rotate(5deg); filter: hue-rotate(90deg); }
  50%  { transform: scale(1) rotate(-5deg); filter: hue-rotate(180deg); }
  75%  { transform: scale(1.08) rotate(5deg); filter: hue-rotate(270deg); }
}

/* ══════════════════════════════════════════════════════════════════
   RAIN EFFECT
   ══════════════════════════════════════════════════════════════════ */
.rain-overlay {
  display: none; position: fixed; inset: 0;
  z-index: 800; pointer-events: none; overflow: hidden;
}
.raindrop {
  position: absolute; top: -20px;
  width: 2px; background: linear-gradient(transparent, rgba(174,194,224,0.5));
  animation: rain-fall linear infinite;
}
@keyframes rain-fall {
  0%   { transform: translateY(-5vh); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(105vh); opacity: 0.3; }
}

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; top: 72px; left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 10000; padding: 12px 24px;
  background: var(--black); color: var(--white);
  border-radius: var(--radius-xs);
  font-family: var(--font); font-size: 0.8rem; font-weight: 600;
  box-shadow: var(--shadow); transition: transform 0.3s ease; white-space: nowrap;
}
.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }
[data-vibe="party"] .toast { background: var(--neon-pink); }

/* ── MapLibre Popup ────────────────────────────────────────────── */
.maplibregl-popup-content {
  font-family: var(--font) !important; font-size: 0.85rem !important;
  font-weight: 600 !important; padding: 12px 16px !important;
  border-radius: var(--radius-xs) !important; box-shadow: var(--shadow-lg) !important;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 768px)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sass-panel { width: 180px; padding: 14px; }
  .ov-card-name { font-size: 1.45rem; }
  .drv-turn-instruction { font-size: 1.4rem; }
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 480px)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  :root {
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
  }

  /* ── Search Bar ── */
  .search-bar {
    top: 8px; left: 8px; right: 8px;
    height: 42px; border-radius: 21px;
  }
  .search-icon { margin-left: 12px; }
  .search-icon svg { width: 16px; height: 16px; }
  .search-bar input { padding: 0 8px; font-size: 0.72rem; }
  .search-bar input::placeholder { font-size: 0.68rem; }
  #search-btn { padding: 0 14px; font-size: 0.72rem; }

  /* ── Vibe Toggle ── */
  .vibe-toggle {
    top: 58px; right: 8px;
    padding: 7px 12px; font-size: 0.65rem;
    border-radius: 18px;
  }

  /* ── Sass-o-meter (overview) ── */
  .sass-panel {
    top: auto; bottom: 260px; right: 8px; left: 8px;
    width: auto; padding: 10px 14px;
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
  }
  .sass-title { margin-bottom: 0; font-size: 0.6rem; flex-shrink: 0; }
  .sass-bar-wrap {
    flex: 1; min-width: 60px; margin-bottom: 0; height: 5px;
  }
  .sass-text {
    width: 100%; min-height: auto; font-size: 0.7rem;
    margin-top: 2px; line-height: 1.3;
  }

  /* ── Sass-o-meter (driving) ── */
  [data-mode="driving"] .sass-panel {
    top: auto; bottom: 155px; left: 8px; right: 8px;
    width: auto; padding: 8px 12px;
  }

  /* ── MapLibre controls ── */
  .maplibregl-ctrl-top-right { top: 56px; right: 4px; }
  .maplibregl-ctrl-group button {
    width: 32px !important; height: 32px !important;
  }

  /* ── Photo Markers ── */
  .photo-marker img {
    width: 42px; height: 42px; border-width: 2.5px;
  }
  .photo-marker.user::before {
    width: 42px; height: 42px; margin: -21px 0 0 -21px;
  }
  .marker-label { font-size: 0.5rem; bottom: -16px; padding: 1px 6px; }

  /* ── Overview Card ── */
  .ov-card {
    bottom: 8px; left: 8px; right: 8px;
    padding: 18px 16px 16px;
    border-radius: var(--radius);
  }
  .ov-header { margin-bottom: 8px; gap: 8px; }
  .ov-accent-line { width: 22px; height: 2.5px; }
  .ov-label { font-size: 0.55rem; }
  .ov-card-name { font-size: 1.25rem; margin-bottom: 2px; }
  .ov-card-address { font-size: 0.78rem; margin-bottom: 14px; }
  .ov-card-stats {
    gap: 24px; margin-bottom: 14px; padding-top: 12px;
  }
  .ov-stat-label { font-size: 0.55rem; }
  .ov-stat-value { font-size: 1rem; }
  .btn-navigate {
    padding: 14px; font-size: 0.82rem;
    border-radius: var(--radius-sm);
  }

  /* ── Driving Turn Card ── */
  .drv-turn-card {
    top: 8px; left: 8px; right: 8px;
    padding: 14px; gap: 12px;
  }
  .drv-turn-icon { width: 44px; height: 44px; border-radius: 8px; }
  .drv-turn-icon svg { width: 22px; height: 22px; }
  .drv-turn-dist-label { font-size: 0.55rem; }
  .drv-turn-instruction { font-size: 1.2rem; }
  .drv-turn-road { font-size: 0.72rem; }

  /* ── Driving Bottom ── */
  .drv-bottom {
    bottom: 8px; left: 8px; right: 8px;
    padding: 14px 16px;
  }
  .drv-stats { gap: 24px; margin-bottom: 12px; }
  .drv-stat-label { font-size: 0.55rem; }
  .drv-stat-value { font-size: 1.1rem; }
  .btn-exit {
    padding: 12px; font-size: 0.78rem;
    border-radius: var(--radius-sm);
  }

  /* ── Toast ── */
  .toast {
    top: 56px; padding: 10px 16px;
    font-size: 0.72rem; max-width: 90vw;
    white-space: normal; text-align: center;
  }

  /* ── Popup ── */
  .maplibregl-popup-content {
    font-size: 0.78rem !important; padding: 10px 12px !important;
  }
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — VERY SMALL (≤ 360px)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
  .search-bar input::placeholder { font-size: 0.6rem; }
  .ov-card-name { font-size: 1.1rem; }
  .ov-card-stats { gap: 16px; }
  .drv-turn-instruction { font-size: 1.05rem; }
  .sass-panel { padding: 8px 10px; }
  .sass-text { font-size: 0.65rem; }
}

/* ══════════════════════════════════════════════════════════════════
   SAFE AREA (notched phones)
   ══════════════════════════════════════════════════════════════════ */
@supports (padding-top: env(safe-area-inset-top)) {
  .search-bar { top: calc(8px + env(safe-area-inset-top)); }
  .drv-turn-card { top: calc(8px + env(safe-area-inset-top)); }
  .ov-card { bottom: calc(8px + env(safe-area-inset-bottom)); }
  .drv-bottom { bottom: calc(8px + env(safe-area-inset-bottom)); }
  .toast { top: calc(56px + env(safe-area-inset-top)); }
}
