/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  color-scheme: light;
  --bg-app: #f5f2ee;
  --bg-app-accent: #fff8f4;
  --bg-surface: rgba(255, 255, 255, 0.84);
  --bg-surface-strong: rgba(255, 255, 255, 0.94);
  --text-strong: #18212f;
  --text-default: #334155;
  --text-subtle: #64748b;
  --border-subtle: rgba(15, 23, 42, 0.1);
  --accent-start: #ff8a5b;
  --accent-mid: #ff5d6c;
  --accent-end: #ff3d81;
  --accent-success: #0ea5a4;
  --accent-success-deep: #0284c7;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 24px 60px rgba(15, 23, 42, 0.14);
  --radius-card: 28px;
  --radius-pill: 999px;
  --content-width: 960px;
  --content-width-narrow: 480px;
}

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

html {
  background: var(--bg-app);
}

body {
  overscroll-behavior-y: contain;
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top, rgba(255, 138, 91, 0.16), transparent 34%),
    linear-gradient(180deg, var(--bg-app-accent), var(--bg-app));
  color: var(--text-strong);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.app-body--authenticated {
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

.app-shell {
  min-height: 100vh;
}

.app-shell--map {
  position: relative;
}

.page {
  padding: 24px 20px 120px;
}

.page--auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.page__inner {
  width: min(100%, var(--content-width));
  margin: 0 auto;
}

.page__inner--narrow {
  width: min(100%, var(--content-width-narrow));
}

.page__header {
  margin-bottom: 20px;
}

.page__header--compact {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #d94660;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page__title {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.05;
}

.page__lede {
  margin: 12px 0 0;
  max-width: 62ch;
  color: var(--text-default);
  font-size: 16px;
  line-height: 1.6;
}

.card {
  padding: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.page .card + .card {
  margin-top: 20px;
}

.auth-card {
  background: var(--bg-surface-strong);
  box-shadow: var(--shadow-strong);
}

.auth-card__footer {
  margin-top: 18px;
  text-align: center;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading__title {
  margin: 0;
  color: var(--text-strong);
  font-size: 22px;
  line-height: 1.2;
}

.section-heading__text {
  margin: 8px 0 0;
  color: var(--text-default);
  line-height: 1.55;
}

.flash-stack {
  position: relative;
  z-index: 950;
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: 20px 20px 0;
}

.app-shell--map .flash-stack {
  position: absolute;
  inset: 0 auto auto 0;
  right: 0;
  pointer-events: none;
}

.flash {
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.flash + .flash {
  margin-top: 10px;
}

.flash--notice {
  border-color: rgba(14, 165, 164, 0.16);
  background: rgba(248, 255, 255, 0.88);
}

.flash--alert {
  border-color: rgba(220, 38, 38, 0.14);
  background: rgba(255, 248, 248, 0.94);
}

.flash__message {
  margin: 0;
  color: var(--text-strong);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field__label {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
}

.input {
  width: 100%;
  appearance: none;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-strong);
  font: inherit;
  padding: 14px 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.input::placeholder {
  color: #94a3b8;
}

.input:focus {
  outline: none;
  border-color: rgba(255, 93, 108, 0.35);
  box-shadow: 0 0 0 4px rgba(255, 93, 108, 0.12);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: #111827;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  padding: 14px 18px;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background-color 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: linear-gradient(145deg, var(--accent-start), var(--accent-mid) 60%, var(--accent-end));
  box-shadow: 0 18px 30px rgba(255, 93, 108, 0.22);
}

.button--secondary {
  border-color: var(--border-subtle);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-strong);
  box-shadow: none;
}

.button--danger {
  background: #fff1f2;
  color: #be123c;
}

.button--block {
  width: 100%;
}

.button--small {
  padding: 11px 14px;
  font-size: 13px;
}

.text-link {
  color: #d94660;
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.form-actions,
.actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.actions-inline form {
  margin: 0;
}

.form-errors {
  border: 1px solid rgba(220, 38, 38, 0.12);
  border-radius: 20px;
  background: rgba(255, 248, 248, 0.88);
  padding: 14px 16px;
}

.form-errors__title {
  margin: 0 0 8px;
  color: #991b1b;
  font-weight: 700;
}

.form-errors__list {
  margin: 0;
  padding-left: 18px;
  color: #7f1d1d;
}

.info-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.65);
}

.info-panel__text {
  margin: 0;
  color: var(--text-default);
}

.invite-link-copy__group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.invite-link-copy__group .input {
  flex: 1 1 auto;
}

.invite-link-copy__button {
  flex: 0 0 auto;
  min-width: 84px;
}

.invite-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.invite-list__item + .invite-list__item {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.invite-row--stacked {
  display: grid;
  gap: 8px;
  justify-content: stretch;
}

.invite-row__main {
  min-width: 0;
}

.invite-row__topline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.invite-row__email {
  color: var(--text-strong);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 8px;
  color: var(--text-subtle);
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge--pending {
  background: rgba(255, 93, 108, 0.12);
  color: #be123c;
}

.badge--success {
  background: rgba(14, 165, 164, 0.12);
  color: #0f766e;
}

.badge--muted {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
}

.empty-state {
  padding: 20px;
  border: 1px dashed rgba(15, 23, 42, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.empty-state__title {
  margin: 0;
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 700;
}

.empty-state__text {
  margin: 8px 0 0;
  color: var(--text-subtle);
  line-height: 1.5;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 0;
  z-index: 900;
}

.app-header__identity {
  min-width: 0;
}

.app-header__label {
  display: block;
  margin-bottom: 2px;
  color: #6b7280;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-header__email {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  color: #111827;
  overflow-wrap: anywhere;
}

.app-header__logout {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.app-header__logout-form {
  margin: 0;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  padding: 12px 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  min-height: 70px;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right,
    transparent 0%,
    rgba(0, 0, 0, 0.1) 20%,
    rgba(0, 0, 0, 0.1) 80%,
    transparent 100%);
}

.nav-item--map {
  grid-column: 1;
}

.nav-item--friends {
  grid-column: 2;
}

.nav-item--invites {
  grid-column: 4;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #8e8e93;
  padding: 6px 16px;
  min-width: 70px;
  min-height: 50px;
  transition: color 0.2s ease;
  position: relative;
  flex: 1;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:active {
  opacity: 0.6;
}

.nav-item.active {
  color: #007aff;
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-item.active .nav-label {
  font-weight: 700;
}

.nav-icon {
  font-size: 28px;
  font-weight: 300;
  margin-bottom: 4px;
  transition: transform 0.2s ease;
  line-height: 1;
  display: inline-block;
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1.2;
}

.nav-share {
  grid-column: 3;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-self: center;
  width: min(140px, 100%);
  transform: translateY(-26px);
  z-index: 2;
}

.nav-share__button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 108px;
  height: 108px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--accent-start), var(--accent-mid) 60%, var(--accent-end));
  color: #fff7ed;
  box-shadow: 0 18px 34px rgba(255, 93, 108, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.nav-share__button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 22px 38px rgba(255, 93, 108, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  filter: saturate(1.05);
}

.nav-share__button:active:not(:disabled) {
  transform: translateY(1px);
}

.nav-share__button:disabled {
  cursor: wait;
  filter: saturate(0.92);
}

.nav-share__halo {
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.28), transparent 58%);
  pointer-events: none;
}

.nav-share__label {
  position: relative;
  z-index: 1;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-share-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2100;
}

.nav-share-modal.active {
  display: flex;
}

.nav-share-modal__card {
  position: relative;
  width: min(320px, calc(100vw - 32px));
  padding: 22px 20px 18px;
  border-radius: 24px;
  background: rgba(255, 251, 245, 0.96);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  text-align: center;
}

.nav-share-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: #475569;
  font-size: 20px;
  cursor: pointer;
}

.nav-share-modal__eyebrow {
  margin: 0 0 10px;
  color: #e11d48;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav-share-modal__message {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.45;
}

.nav-share.is-live .nav-share__button {
  background: linear-gradient(145deg, #14b8a6, #06b6d4 58%, var(--accent-success-deep));
  box-shadow: 0 18px 34px rgba(6, 182, 212, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.nav-share.has-error .nav-share-modal__eyebrow {
  color: #b91c1c;
}

#map {
  height: 100vh;
  margin-bottom: 0;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

.map-page {
  position: relative;
}

.mapboxgl-canvas {
  outline: none;
}

.friend-location-share-feed {
  display: none;
}

.location-error {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1001;
  padding: 12px 16px;
  border: 1px solid rgba(220, 38, 38, 0.14);
  background: rgba(255, 247, 247, 0.92);
  color: #7f1d1d;
  border-radius: 18px;
  font-size: 14px;
  max-width: 300px;
  box-shadow: var(--shadow-soft);
  display: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.location-error code {
  background: rgba(220, 38, 38, 0.08);
  border-radius: 4px;
  padding: 1px 4px;
}

.location-error--static {
  display: block;
  top: auto;
  bottom: calc(90px + env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
  .app-body--authenticated {
    padding-bottom: calc(75px + env(safe-area-inset-bottom));
  }

  .page {
    padding: 20px 16px 112px;
  }

  .page--auth {
    padding: 24px 16px;
  }

  .card {
    padding: 20px;
    border-radius: 24px;
  }

  .page__title {
    font-size: 30px;
  }

  .app-header {
    padding: 14px 16px 10px;
  }

  .app-header__logout {
    padding: 9px 12px;
    font-size: 13px;
  }

  .bottom-nav {
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    min-height: 75px;
  }

  .nav-item {
    padding: 8px 8px;
    min-height: 55px;
  }

  .nav-share {
    width: 120px;
    transform: translateY(-22px);
  }

  .nav-share__button {
    width: 92px;
    height: 92px;
  }

  .nav-share__label {
    font-size: 16px;
  }

  .nav-share-modal {
    padding: 18px;
  }

  .nav-share-modal__card {
    width: min(300px, calc(100vw - 24px));
    padding: 20px 18px 16px;
  }

  .nav-share-modal__message {
    font-size: 15px;
  }

  .nav-icon {
    font-size: 26px;
    margin-bottom: 4px;
  }

  .nav-label {
    font-size: 10px;
  }

  #map {
    padding-bottom: calc(75px + env(safe-area-inset-bottom));
  }

  .invite-row {
    display: grid;
    gap: 14px;
    justify-content: stretch;
  }

  .invite-link-copy__group {
    display: grid;
  }

  .actions-inline {
    width: 100%;
  }

  .actions-inline form,
  .actions-inline .button {
    flex: 1 1 160px;
  }

  .location-error {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

@media (min-width: 769px) {
  .app-header {
    padding-left: max(24px, calc((100vw - 960px) / 2));
    padding-right: max(24px, calc((100vw - 960px) / 2));
  }

  .bottom-nav {
    max-width: 500px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
  }
}
