@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@500&display=swap");

:root {
  color-scheme: dark;
  --page: #181818;
  --panel: rgb(20, 20, 20);
  --panel-soft: rgb(30, 30, 30);
  --panel-hover: rgb(35, 35, 35);
  --line: rgb(78, 78, 78);
  --line-soft: rgb(50, 50, 50);
  --text: rgb(249, 249, 249);
  --muted: rgb(180, 180, 180);
  --quiet: rgb(140, 140, 140);
  --dim: rgb(100, 100, 100);
  --yellow: rgb(255, 193, 7);
  --yellow-dark: rgb(255, 160, 0);
  --green: rgb(40, 167, 69);
  --red: rgb(220, 53, 69);
  --ink: rgb(20, 20, 20);
}

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

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.topbar {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.95rem;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  margin-right: auto;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s;
}

.logo-link:hover {
  opacity: 0.8;
}

.logo-link img {
  width: 32px;
  height: 32px;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.95rem;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a.active {
  color: var(--yellow);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.account-trigger.authenticated {
  color: rgb(52, 199, 89);
  border-color: rgba(52, 199, 89, 0.8);
}

.account-trigger.authenticated::after {
  content: "";
  position: absolute;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgb(52, 199, 89);
  top: 1px;
  right: 1px;
  box-shadow: 0 0 0 2px var(--page);
}

.account-menu-panel {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  min-width: 15rem;
  padding: 0.375rem;
  border-radius: 10px;
  border: 1px solid rgb(55, 55, 55);
  background: rgb(22, 22, 22);
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.45);
  z-index: 1200;
  display: none;
}

.account-menu-panel.open {
  display: block;
}

.account-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: rgb(225, 225, 225);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8125rem;
  text-align: left;
  padding: 0.55rem 0.625rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.account-menu-item:hover {
  background: rgb(45, 45, 45);
  color: var(--text);
}

.account-menu-item-meta {
  color: var(--quiet);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.save-state {
  min-width: 4.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.danger-btn {
  min-height: 2.25rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.primary-btn {
  padding: 0 0.8rem;
  background: linear-gradient(135deg, var(--yellow) 0%, var(--yellow-dark) 100%);
  border-color: rgba(255, 193, 7, 0.45);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.22);
}

.ghost-btn {
  padding: 0 0.75rem;
  background: var(--panel-soft);
  color: var(--text);
}

.icon-btn {
  width: 2.25rem;
  padding: 0;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 800;
}

.danger-btn {
  padding: 0 0.8rem;
  background: rgba(220, 53, 69, 0.12);
  border-color: rgba(220, 53, 69, 0.45);
  color: rgb(255, 210, 214);
}

.primary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover,
.danger-btn:hover {
  background-color: rgb(45, 45, 45);
  border-color: rgb(100, 100, 100);
  color: var(--text);
}

.primary-btn:hover {
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.trip-dashboard {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.dashboard-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    radial-gradient(circle at 12% 24%, rgba(255, 193, 7, 0.11), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(40, 167, 69, 0.09), transparent 24%),
    var(--panel);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dashboard-hero h1 {
  margin: 0.1rem 0 0;
  color: var(--text);
  font-family: "Caveat", cursive;
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  font-weight: 500;
  line-height: 0.95;
  text-shadow: 0px 5px 5px black;
}

.dashboard-hero p:not(.eyebrow) {
  max-width: 44rem;
  margin-top: 0.65rem;
  color: var(--muted);
  line-height: 1.5;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.trip-list-status {
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.trip-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.trip-card {
  width: 100%;
  min-height: 13rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.trip-card:hover {
  border-color: rgba(255, 193, 7, 0.62);
  background: var(--panel-soft);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.trip-card h2 {
  margin: 0.2rem 0 0;
  font-size: 1.12rem;
  line-height: 1.25;
}

.trip-card-destination {
  color: var(--yellow);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.trip-card-meta {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.trip-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--quiet);
  font-size: 0.78rem;
}

.trip-card-arrow {
  color: var(--yellow);
  font-weight: 900;
}

.workspace {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 290px) minmax(180px, 230px) minmax(390px, 1fr) minmax(285px, 340px);
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.trip-panel,
.day-rail,
.timeline-panel,
.editor-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.trip-panel,
.editor-panel {
  padding: 1.25rem;
}

.day-rail,
.timeline-panel {
  overflow: hidden;
}

.trip-visual {
  position: relative;
  height: 6.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(249, 249, 249, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(249, 249, 249, 0.04) 1px, transparent 1px),
    rgb(24, 24, 24);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.route-line {
  position: absolute;
  inset: 22px 28px;
  border: 2px solid transparent;
  border-top-color: var(--yellow);
  border-right-color: rgba(255, 193, 7, 0.55);
  border-radius: 50%;
  transform: rotate(-12deg);
  filter: drop-shadow(0 0 5px rgba(255, 193, 7, 0.25));
}

.pin {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--page);
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 0 5px rgba(255, 193, 7, 0.9);
}

.pin-a {
  left: 28px;
  bottom: 22px;
}

.pin-b {
  left: 48%;
  top: 28px;
  background: var(--green);
  box-shadow: 0 0 5px rgba(40, 167, 69, 0.9);
}

.pin-c {
  right: 28px;
  bottom: 34px;
  background: var(--yellow);
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 0.85rem;
}

label span,
.rail-header,
.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgb(16, 16, 16);
  color: var(--text);
  outline: none;
  padding: 0.65rem 0.7rem;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.13);
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.share-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.section-divider {
  height: 1px;
  margin: 1rem 0;
  background: var(--line-soft);
}

.lodging-heading {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rail-header,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rail-header {
  min-height: 3.55rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}

.day-list {
  padding: 0.5rem;
  display: grid;
  gap: 0.5rem;
  max-height: calc(100vh - 116px);
  overflow: auto;
}

.day-tab {
  width: 100%;
  display: grid;
  grid-template-columns: 2.35rem 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.day-tab:hover,
.day-tab.active {
  background: var(--panel-soft);
  border-color: var(--line);
}

.day-tab.active {
  border-color: rgba(255, 193, 7, 0.62);
  background: rgba(255, 193, 7, 0.09);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.16);
}

.day-number {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: rgb(16, 16, 16);
  border: 1px solid var(--line-soft);
  color: var(--yellow);
  font-weight: 800;
}

.day-meta {
  min-width: 0;
}

.day-title,
.day-date {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.day-date {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.timeline-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-header {
  padding: 1rem;
  border-bottom: 1px solid var(--line-soft);
}

.panel-header.compact {
  padding: 0 0 14px;
  border-bottom: none;
}

.panel-header h1,
.panel-header h2 {
  margin: 2px 0 0;
  letter-spacing: 0;
}

.panel-header h1 {
  font-size: 2rem;
  line-height: 1.05;
  color: var(--text);
  font-family: "Caveat", cursive;
  font-weight: 500;
  text-shadow: 0px 5px 5px black;
}

.panel-header h2 {
  font-size: 1.1rem;
  line-height: 1.2;
}

.eyebrow {
  margin: 0;
}

.day-editor-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 210px);
  gap: 0.65rem;
  padding: 0.9rem 1rem 0;
}

.day-editor-row label {
  margin-bottom: 0;
}

.timeline {
  min-height: 0;
  padding: 0.75rem 1rem 1rem;
  overflow: auto;
}

.timeline-empty {
  min-height: 16rem;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(120, 120, 120, 0.55);
  border-radius: 4px;
  color: var(--quiet);
  text-align: center;
}

.timeline-entry {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.entry-time {
  color: var(--yellow);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.entry-card {
  width: 100%;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
  color: inherit;
  text-align: left;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.entry-card:hover,
.entry-card.active {
  border-color: rgb(100, 100, 100);
  background: var(--panel-hover);
}

.entry-card.active {
  border-color: var(--yellow);
  background: rgba(255, 193, 7, 0.1);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.16);
}

.entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.entry-title {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.3;
}

.entry-type {
  flex: 0 0 auto;
  color: var(--ink);
  background: var(--green);
  border-radius: 999px;
  padding: 0.16rem 0.48rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.entry-location,
.entry-notes {
  color: var(--muted);
  margin: 0.5rem 0 0;
  line-height: 1.45;
  font-size: 0.86rem;
}

.entry-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
}

.entry-links a {
  color: var(--yellow);
  border: 1px solid rgba(255, 193, 7, 0.4);
  border-radius: 4px;
  padding: 0.28rem 0.5rem;
  text-decoration: none;
  font-size: 0.82rem;
}

.item-form {
  margin-top: 4px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translate(-50%, 16px);
  max-width: min(520px, calc(100vw - 2rem));
  padding: 0.65rem 0.85rem;
  border: 1px solid rgb(55, 55, 55);
  border-radius: 6px;
  background: rgb(22, 22, 22);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.35);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 8, 8, 0.78);
  backdrop-filter: blur(6px);
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: min(92vw, 440px);
  border: 1px solid rgb(55, 55, 55);
  border-radius: 10px;
  background: rgb(22, 22, 22);
  color: var(--text);
  padding: 1rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.modal-header h2 {
  margin-top: 0.15rem;
  font-size: 1.1rem;
}

.modal-copy {
  margin-bottom: 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.auth-status {
  min-height: 1.1rem;
  margin-top: 0.65rem;
  color: var(--quiet);
  font-size: 0.8rem;
}

.auth-status.authenticated {
  color: rgb(52, 199, 89);
}

.auth-status.failed {
  color: rgb(248, 113, 113);
}

.auth-status.checking {
  color: rgb(160, 160, 160);
}

.readonly .editor-panel,
.readonly .day-editor-row,
.readonly #addDayBtn,
.readonly #addItemBtn,
.readonly #saveTripBtn {
  display: none;
}

.readonly #newTripBtn {
  display: none;
}

.dashboard-mode #saveTripBtn,
.dashboard-mode #shareTripBtn {
  display: none;
}

.masked .trip-panel input,
.masked .trip-panel textarea,
.masked .day-tab,
.masked .timeline-panel {
  filter: none;
}

.masked .private-mask {
  color: var(--yellow);
  font-weight: 800;
  letter-spacing: 0.16em;
}

.readonly .workspace {
  grid-template-columns: minmax(220px, 300px) minmax(180px, 230px) minmax(420px, 1fr);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(210px, 290px) 1fr;
  }

  .day-rail,
  .timeline-panel {
    min-height: 420px;
  }

  .editor-panel {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 1rem;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    order: 2;
    width: 100%;
  }

  .top-actions {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .logo-link {
    margin-right: 0;
  }

  .save-state {
    flex: 1;
    text-align: left;
  }

  .workspace,
  .readonly .workspace {
    grid-template-columns: 1fr;
  }

  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .editor-panel {
    grid-column: auto;
  }

  .day-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    overflow-x: auto;
    max-height: none;
  }

  .day-rail {
    min-height: auto;
  }

  .timeline-panel {
    min-height: 360px;
  }

  .timeline-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .date-grid {
    grid-template-columns: 1fr;
  }

  .day-editor-row {
    grid-template-columns: 1fr;
  }
}
