/* TripTrack – Frontend App Styles */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ── Reset ───────────────────────────────────────────────────── */
.tt-root *, .tt-root *::before, .tt-root *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Root container ──────────────────────────────────────────── */
.tt-root {
  --tt-bg:      #0a0c10;
  --tt-surf:    #13161d;
  --tt-surf2:   #1a1e28;
  --tt-border:  #252a38;
  --tt-accent:  #00e5a0;
  --tt-accent2: #7c6ffc;
  --tt-text:    #f0f2f8;
  --tt-muted:   #6b7280;
  --tt-danger:  #ff4d6a;
  --tt-warn:    #ffa94d;
  --tt-radius:  12px;
  --tt-font:    'DM Sans', sans-serif;
  --tt-head:    'Syne', sans-serif;

  position: relative;
  width: 100%;
  height: 90vh;
  min-height: 500px;
  max-height: 900px;
  background: var(--tt-bg);
  color: var(--tt-text);
  font-family: var(--tt-font);
  font-size: 15px;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--tt-border);
}

/* ── Screens ─────────────────────────────────────────────────── */
.tt-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transition: opacity .3s ease, transform .3s ease;
  overflow: hidden;
}
.tt-hidden { display: none !important; }

/* ── Topbar ──────────────────────────────────────────────────── */
.tt-topbar {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--tt-border);
  background: var(--tt-bg);
  flex-shrink: 0;
}
.tt-topbar h2 {
  font-family: var(--tt-head);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -.02em;
}
.tt-back {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--tt-surf);
  border: 1px solid var(--tt-border);
  color: var(--tt-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .18s;
  flex-shrink: 0;
}
.tt-back:hover { color: var(--tt-text); border-color: var(--tt-muted); }

/* ── Splash ──────────────────────────────────────────────────── */
#tt-splash {
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.tt-splash-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.tt-splash-bg::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0,229,160,.13) 0%, transparent 70%);
  top: -180px; left: -160px;
  animation: tt-pulse 5s ease-in-out infinite alternate;
}
.tt-splash-bg::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(124,111,252,.10) 0%, transparent 70%);
  bottom: -120px; right: -120px;
  animation: tt-pulse 6s ease-in-out infinite alternate-reverse;
}
@keyframes tt-pulse { 0% { transform: scale(1); } 100% { transform: scale(1.25); } }

.tt-splash-content {
  position: relative;
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 380px;
  width: 100%;
}
.tt-logo-mark {
  width: 68px; height: 68px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--tt-accent), var(--tt-accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.4rem;
  box-shadow: 0 0 32px rgba(0,229,160,.3);
}
.tt-logo-mark svg { width: 34px; height: 34px; }
.tt-splash-title {
  font-family: var(--tt-head);
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
}
.tt-splash-title span { color: var(--tt-accent); }
.tt-splash-sub {
  color: var(--tt-muted);
  font-size: .9rem;
  margin: .9rem 0 2.2rem;
  line-height: 1.6;
  font-weight: 300;
}
.tt-splash-actions {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  align-items: stretch;
}
.tt-or { color: var(--tt-muted); font-size: .8rem; text-align: center; }

/* ── Buttons ─────────────────────────────────────────────────── */
.tt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .75rem 1.4rem;
  border-radius: 11px;
  border: none;
  font-family: var(--tt-font);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
  line-height: 1;
  text-decoration: none;
}
.tt-btn-primary {
  background: var(--tt-accent);
  color: #0a0c10;
}
.tt-btn-primary:hover {
  background: #1aecad;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,229,160,.28);
}
.tt-btn-primary:active { transform: translateY(0); }
.tt-btn-secondary {
  background: var(--tt-surf);
  color: var(--tt-text);
  border: 1px solid var(--tt-border);
}
.tt-btn-secondary:hover { background: var(--tt-surf2); border-color: var(--tt-muted); }
.tt-btn-ghost {
  background: transparent;
  color: var(--tt-muted);
  border: 1px solid var(--tt-border);
  font-size: .85rem;
  padding: .6rem 1rem;
}
.tt-btn-ghost:hover { color: var(--tt-text); border-color: var(--tt-muted); }
.tt-btn-full { width: 100%; }
.tt-btn-end {
  background: rgba(255,77,106,.12);
  color: var(--tt-danger);
  border: 1px solid rgba(255,77,106,.25);
  padding: .45rem .9rem;
  font-size: .8rem;
  border-radius: 8px;
}
.tt-btn-end:hover { background: rgba(255,77,106,.22); }
.tt-btn-share-fab {
  background: var(--tt-surf);
  color: var(--tt-muted);
  border: 1px solid var(--tt-border);
  padding: .45rem .6rem;
  border-radius: 9px;
}
.tt-btn-share-fab:hover { color: var(--tt-accent); border-color: var(--tt-accent); }

/* ── Form ────────────────────────────────────────────────────── */
.tt-form-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tt-field {
  margin-bottom: 1.1rem;
}
.tt-field label {
  display: block;
  font-size: .75rem;
  color: var(--tt-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .45rem;
}
.tt-optional { text-transform: none; letter-spacing: 0; opacity: .7; }
.tt-field input,
.tt-field textarea {
  width: 100%;
  background: var(--tt-surf);
  border: 1px solid var(--tt-border);
  color: var(--tt-text);
  padding: .75rem 1rem;
  border-radius: 10px;
  font-family: var(--tt-font);
  font-size: .93rem;
  outline: none;
  transition: border-color .18s;
  -webkit-appearance: none;
}
.tt-field input:focus,
.tt-field textarea:focus { border-color: var(--tt-accent); }
.tt-field input::placeholder,
.tt-field textarea::placeholder { color: var(--tt-muted); }
.tt-field textarea { resize: none; }

/* ── Emoji grid ─────────────────────────────────────────────── */
.tt-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .45rem;
}
.tt-emoji-btn {
  background: var(--tt-surf);
  border: 1px solid var(--tt-border);
  color: var(--tt-text);
  padding: .55rem .4rem;
  border-radius: 8px;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  line-height: 1;
}
.tt-emoji-btn:hover { border-color: var(--tt-muted); }
.tt-emoji-btn.tt-emoji-active {
  border-color: var(--tt-accent);
  background: rgba(0,229,160,.1);
}

/* ── Spinner ─────────────────────────────────────────────────── */
.tt-spinner-wrap {
  display: flex;
  align-items: center;
  gap: .7rem;
  justify-content: center;
  color: var(--tt-muted);
  font-size: .85rem;
  padding: .8rem 0;
}
.tt-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--tt-border);
  border-top-color: var(--tt-accent);
  border-radius: 50%;
  animation: tt-spin .7s linear infinite;
}
@keyframes tt-spin { to { transform: rotate(360deg); } }

/* ── Join screen ─────────────────────────────────────────────── */
#tt-join {
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.tt-join-card {
  position: relative;
  background: var(--tt-surf);
  border: 1px solid var(--tt-border);
  border-radius: 18px;
  padding: 2rem 1.6rem 1.6rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: tt-pop .3s ease;
}
@keyframes tt-pop { from { opacity:0; transform:scale(.95); } to { opacity:1; transform:scale(1); } }
.tt-join-emoji { font-size: 2.8rem; margin-bottom: .9rem; }
.tt-join-card h2 {
  font-family: var(--tt-head);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -.03em;
  margin-bottom: .5rem;
}
.tt-join-card p { color: var(--tt-muted); font-size: .87rem; margin-bottom: 1.4rem; line-height: 1.55; }
.tt-join-card .tt-field { text-align: left; }

/* ── Map screen ──────────────────────────────────────────────── */
#tt-tracker { position: relative; }
#tt-map {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.tt-map-ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

/* ─ Map topbar ─ */
.tt-map-topbar {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem .9rem;
  background: rgba(10,12,16,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--tt-border);
  flex-shrink: 0;
}
.tt-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tt-accent);
  box-shadow: 0 0 8px var(--tt-accent);
  animation: tt-blink 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes tt-blink { 0%,100% { opacity:1; } 50% { opacity:.25; } }
.tt-trip-badge {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .45rem;
}
.tt-trip-emoji { font-size: 1rem; flex-shrink: 0; }
.tt-trip-name {
  font-family: var(--tt-head);
  font-weight: 700;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-count {
  background: rgba(0,229,160,.12);
  color: var(--tt-accent);
  border: 1px solid rgba(0,229,160,.22);
  font-size: .72rem;
  padding: .22rem .55rem;
  border-radius: 6px;
  flex-shrink: 0;
  font-weight: 500;
}

/* ─ FABs ─ */
.tt-fabs {
  pointer-events: all;
  position: absolute;
  right: .8rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.tt-fab {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(10,12,16,.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--tt-border);
  color: var(--tt-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .18s;
}
.tt-fab:hover { border-color: var(--tt-accent); color: var(--tt-accent); }
.tt-fab.tt-fab-on { border-color: var(--tt-accent); background: rgba(0,229,160,.1); color: var(--tt-accent); }

/* ─ Offline badge ─ */
.tt-offline-badge {
  pointer-events: all;
  margin: .6rem auto 0;
  background: rgba(255,169,77,.15);
  border: 1px solid rgba(255,169,77,.3);
  color: var(--tt-warn);
  font-size: .75rem;
  padding: .35rem .8rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: .4rem;
  width: fit-content;
}

/* ─ Bottom panel ─ */
.tt-bottom-panel {
  pointer-events: all;
  margin-top: auto;
  background: rgba(10,12,16,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--tt-border);
  padding: .85rem .9rem 1rem;
}
.tt-panel-header {
  display: flex;
  align-items: center;
  margin-bottom: .65rem;
}
.tt-panel-title {
  font-family: var(--tt-head);
  font-weight: 600;
  font-size: .85rem;
}
.tt-last-update {
  margin-left: auto;
  font-size: .73rem;
  color: var(--tt-accent);
  opacity: .8;
}
.tt-members-scroll {
  display: flex;
  gap: .65rem;
  overflow-x: auto;
  padding-bottom: .25rem;
  scrollbar-width: none;
}
.tt-members-scroll::-webkit-scrollbar { display: none; }

/* ─ Member card ─ */
.tt-member-card {
  flex-shrink: 0;
  background: var(--tt-surf);
  border: 1px solid var(--tt-border);
  border-radius: 11px;
  padding: .55rem .75rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  transition: border-color .18s;
  min-width: 140px;
  max-width: 180px;
}
.tt-member-card:hover { border-color: var(--tt-muted); }
.tt-member-card.tt-me { border-color: var(--tt-accent); }
.tt-member-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}
.tt-member-info { flex: 1; min-width: 0; }
.tt-member-name {
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-member-time {
  font-size: .68rem;
  color: var(--tt-muted);
  margin-top: 1px;
}
.tt-member-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Share modal ─────────────────────────────────────────────── */
.tt-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 20;
  display: flex;
  align-items: flex-end;
}
.tt-modal {
  width: 100%;
  background: var(--tt-surf);
  border-top: 1px solid var(--tt-border);
  border-radius: 18px 18px 0 0;
  padding: 1.2rem 1.2rem 2rem;
  animation: tt-slide-up .3s ease;
}
@keyframes tt-slide-up { from { transform:translateY(100%); } to { transform:translateY(0); } }
.tt-modal-handle {
  width: 36px; height: 3px;
  background: var(--tt-border);
  border-radius: 2px;
  margin: 0 auto 1.1rem;
}
.tt-modal h3 {
  font-family: var(--tt-head);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: .35rem;
}
.tt-link-box {
  background: var(--tt-bg);
  border: 1px solid var(--tt-border);
  border-radius: 9px;
  padding: .7rem .9rem;
  font-size: .78rem;
  color: var(--tt-accent);
  font-family: monospace;
  word-break: break-all;
  margin-bottom: .9rem;
  user-select: all;
}
.tt-share-row {
  display: flex;
  gap: .6rem;
  align-items: center;
  margin-bottom: .9rem;
}
.tt-share-row .tt-btn-primary,
.tt-share-row .tt-btn-secondary { flex: 1; }
.tt-trip-code-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
}
.tt-trip-code-wrap code {
  background: var(--tt-bg);
  border: 1px solid var(--tt-border);
  padding: .2rem .55rem;
  border-radius: 6px;
  letter-spacing: .1em;
  font-size: .85rem;
  color: var(--tt-text);
}

/* ── Map tile darkening ─────────────────────────────────────── */
#tt-map .leaflet-tile { filter: brightness(.65) saturate(.55) contrast(1.1); }
#tt-map .leaflet-container { background: #0e1117 !important; }

/* ── Custom marker ───────────────────────────────────────────── */
.tt-marker-wrap { cursor: pointer; }
.tt-marker-pin {
  width: 36px; height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid rgba(255,255,255,.2);
  box-shadow: 0 4px 14px rgba(0,0,0,.55);
}
.tt-marker-pin.tt-me-pin {
  width: 42px; height: 42px;
  border-color: rgba(255,255,255,.35);
}
.tt-marker-emoji {
  transform: rotate(45deg);
  font-size: 14px;
  display: block;
  line-height: 1;
}
.tt-me-pin .tt-marker-emoji { font-size: 17px; }
.tt-pulse-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  animation: tt-ring 2s ease-out infinite;
  z-index: -1;
}
@keyframes tt-ring { 0% { transform:scale(.85); opacity:.7; } 100% { transform:scale(2.2); opacity:0; } }

/* ── Misc helpers ────────────────────────────────────────────── */
.tt-muted { color: var(--tt-muted); }

/* Leaflet tooltip */
.tt-root .leaflet-tooltip {
  background: rgba(10,12,16,.9) !important;
  border: 1px solid #252a38 !important;
  color: #f0f2f8 !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 12px !important;
  border-radius: 7px !important;
  padding: 4px 8px !important;
  box-shadow: none !important;
}
.tt-root .leaflet-tooltip-top:before { border-top-color: #252a38 !important; }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .tt-root {
    height: 92vh;
    max-height: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .tt-splash-title { font-size: 2.1rem; }
  .tt-emoji-grid { grid-template-columns: repeat(6, 1fr); gap: .35rem; }
  .tt-fabs { right: .55rem; }
  .tt-form-body { padding: 1rem .9rem 2rem; }
}
