/* ============================================
   WTFDIP — app.css
   v0.1 Prototype
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500&display=swap');

/* --- CSS Variables / Theming --- */
:root {
  /* Theme: set dynamically by theme.js. Defaults here. */
  --bg:        #5B5BD6;
  --fg:        rgba(255,255,255,0.85);
  --fg-dim:    rgba(255,255,255,0.45);
  --btn-bg:    rgba(255,255,255,0.15);
  --btn-fg:    rgba(255,255,255,0.9);
  --btn-primary-bg: rgba(255,255,255,0.2);
  --btn-primary-border: rgba(255,255,255,0.4);
  --sheet-bg:  rgba(255,255,255,0.08);
  --sheet-border: rgba(255,255,255,0.15);

  /* Layout */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--bg);
  color: var(--fg);
  transition: background-color 0.8s ease;
  -webkit-font-smoothing: antialiased;
}

/* --- Views --- */
.view {
  display: none;
  flex-direction: column;
  height: 100dvh;
  padding:
    calc(var(--safe-top) + 1.5rem)
    calc(var(--safe-right) + 1.5rem)
    calc(var(--safe-bottom) + 1.5rem)
    calc(var(--safe-left) + 1.5rem);
}
.view.active { display: flex; }

/* --- Header / Wordmark --- */
header { flex-shrink: 0; }

.wordmark {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--fg-dim);
  text-transform: uppercase;
}

/* --- Main content areas --- */
main { flex: 1; display: flex; flex-direction: column; justify-content: center; }

/* Empty state */
.empty-state {
  justify-content: center;
  align-items: center;
}
.empty-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 1.2rem;
  color: var(--fg-dim);
  letter-spacing: 0.05em;
}

/* Parked state */
.parked-state {
  justify-content: flex-start;
  gap: 1.5rem;
}

/* --- Street Display --- */
.street-display {
  line-height: 0.9;
  margin-top: 0.5rem;
}
.street-display span {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4rem, 22vw, 7rem);
  color: var(--fg);
  letter-spacing: 0.01em;
  display: block;
}

/* --- Meta Grid --- */
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}
.meta-item { display: flex; flex-direction: column; gap: 0.2rem; }
.meta-label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
  text-transform: uppercase;
}
.meta-value {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--fg);
}

/* --- Map Container --- */
#map-container {
  flex: 1;
  min-height: 140px;
  max-height: 200px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,0.15);
}
#map { width: 100%; height: 100%; }

.map-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--fg-dim);
  font-size: 0.85rem;
  min-height: 140px;
}
.map-placeholder small { font-size: 0.7rem; opacity: 0.6; }

/* --- Footer / Buttons --- */
footer { flex-shrink: 0; display: flex; flex-direction: column; gap: 0.75rem; }

.parked-footer { gap: 0.6rem; }

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.btn-primary, .btn-secondary, .btn-ghost {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--btn-primary-border);
  background: var(--btn-primary-bg);
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-primary:active, .btn-secondary:active { opacity: 0.7; }

.btn-secondary {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fg-dim);
  font-size: 0.8rem;
}
.btn-ghost:hover { color: var(--fg); }

/* --- Modals --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }

.modal-sheet {
  width: 100%;
  background: var(--bg);
  border-top: 1px solid var(--sheet-border);
  border-radius: 20px 20px 0 0;
  padding: 1rem 1.5rem calc(var(--safe-bottom) + 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: slideUp 0.25s ease;
}
.modal-sheet--tall { min-height: 60vh; }

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--fg-dim);
  border-radius: 2px;
  align-self: center;
  opacity: 0.4;
  margin-bottom: 0.5rem;
}

.modal-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 1.1rem;
  color: var(--fg);
}

.modal-or {
  text-align: center;
  color: var(--fg-dim);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.6rem;
}

/* --- Move By Presets --- */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.preset-btn {
  padding: 0.75rem 0.5rem;
  background: var(--btn-primary-bg);
  border: 1px solid var(--btn-primary-border);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}
.preset-btn:active, .preset-btn.selected {
  background: rgba(255,255,255,0.35);
}

/* --- Datetime input --- */
.datetime-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--btn-primary-bg);
  border: 1px solid var(--btn-primary-border);
  border-radius: 10px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color-scheme: dark;
}

/* --- Map app selector --- */
.mapapp-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.mapapp-btn {
  width: 100%;
  padding: 0.9rem 1rem;
  background: var(--btn-primary-bg);
  border: 1px solid var(--btn-primary-border);
  border-radius: 10px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.mapapp-btn:active { background: rgba(255,255,255,0.3); }

.remember-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg-dim);
  font-size: 0.8rem;
  cursor: pointer;
}

/* --- Share modal --- */
.share-url-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.share-url-input {
  flex: 1;
  padding: 0.7rem 0.8rem;
  background: var(--btn-primary-bg);
  border: 1px solid var(--btn-primary-border);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-note {
  font-size: 0.78rem;
  color: var(--fg-dim);
  line-height: 1.4;
}

/* --- A2HS modal --- */
.a2hs-instructions {
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--fg);
  line-height: 1.6;
}
.a2hs-instructions strong { font-weight: 500; }

/* --- Shared view extras --- */
.shared-cta {
  text-align: center;
  padding: 0.6rem;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 5rem);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--fg);
  padding: 0.6rem 1.2rem;
  border-radius: 99px;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  z-index: 999;
  white-space: nowrap;
  transition: opacity 0.3s;
}
.toast.hidden { display: none; }
