/* ── Pico overrides — Swiss reset ───────────────────────────── */

/* Strip Pico's generous header/nav spacing */
header.container-fluid {
  padding-block: 0;
}

:root {
  --pico-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pico-font-size: 93%;
  --pico-border-radius: 0;
  --pico-spacing: 0.75rem;
  --pico-typography-spacing-vertical: 0.75rem;
  --pico-form-element-spacing-vertical: 0.35rem;
  --pico-form-element-spacing-horizontal: 0.65rem;
  --pico-nav-element-spacing-vertical: 0.2rem;
  --pico-nav-element-spacing-horizontal: 0.35rem;
  --pico-nav-link-spacing-vertical: 0.2rem;
  --pico-nav-link-spacing-horizontal: 0.35rem;
  --pico-primary: #111;
  --pico-primary-hover: #000;
  --pico-primary-background: #111;
  --pico-primary-border: #111;
  --pico-secondary: #555;
  --pico-muted-color: #888;
  --pico-muted-border-color: #ddd;
  --gap: 1.5rem;
}

/* Flatten Pico's article/button chrome */
article {
  border-radius: 0;
  box-shadow: none;
}

button, [role="button"], input, select, textarea {
  border-radius: 0 !important;
}

/* ── Nav ────────────────────────────────────────────────────── */

header {
  border-bottom: 1px solid #ddd;
  padding: 0;
}

header nav {
  align-items: center;
  padding: 0.35rem 0;
  min-height: 0;
}

header nav ul {
  margin: 0;
}

header nav ul li {
  padding: 0;
}

header nav a {
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: #111;
}

header nav a:hover {
  color: #000;
}

header nav ul:last-child {
  gap: 0.75rem;
  align-items: center;
}

header nav ul:last-child small {
  color: #888;
  font-size: 0.75rem;
}

header nav ul:last-child button {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid #ddd;
  background: none;
  color: #999;
  font-weight: 400;
  letter-spacing: 0;
  margin: 0;
}

header nav ul:last-child button:hover {
  border-color: #999;
  color: #333;
  background: none;
}

/* ── Layout ─────────────────────────────────────────────────── */

main.container {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #111;
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.page-header h1,
.page-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-header .muted {
  margin: 0;
  font-size: 0.85rem;
  color: #888;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  align-items: center;
  border-top: 1px solid #ddd;
  padding-top: 1.5rem;
}

.form-error {
  color: #c00;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.muted {
  color: #888;
}

/* ── Buttons ────────────────────────────────────────────────── */

[role="button"],
button {
  font-size: 0.82rem;
}

[role="button"].outline,
button.outline {
  border: 1px solid #ddd;
  background: none;
  color: #555;
}

[role="button"].outline:hover,
button.outline:hover {
  border-color: #999;
  color: #111;
}

[role="button"].outline.secondary,
button.outline.secondary {
  color: #888;
}

/* ── Form labels ────────────────────────────────────────────── */

label {
  margin-bottom: 0.6rem;
}

label > input,
label > select,
label > textarea {
  margin-top: 0.2rem;
}

/* ── Login ──────────────────────────────────────────────────── */

.login-wrap {
  max-width: 360px;
  margin: 5rem auto;
}

.login-wrap hgroup h1 {
  font-size: 1.4rem;
  margin-bottom: 0;
}

.login-wrap hgroup p {
  color: #888;
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

.login-wrap article {
  border: 1px solid #ddd;
  padding: 2rem;
  background: none;
  box-shadow: none;
}

/* ── Trip list ──────────────────────────────────────────────── */

.trip-list {
  margin: 0;
}

.trip-list-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.1rem 0;
  border-bottom: 1px solid #e8e8e8;
  gap: 1.5rem;
}

.trip-list-item:first-child {
  border-top: 1px solid #e8e8e8;
}

.trip-list-main {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex: 1;
  min-width: 0;
}

.trip-list-main a {
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-list-main a:hover {
  text-decoration: underline;
}

.trip-dates {
  font-size: 0.82rem;
  color: #888;
  white-space: nowrap;
}

.trip-list-actions {
  display: flex;
  gap: 1rem;
  white-space: nowrap;
}

.trip-list-actions a {
  font-size: 0.8rem;
  color: #888;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.trip-list-actions a:hover {
  color: #111;
  text-decoration: underline;
}

/* ── CSS-only tabs ──────────────────────────────────────────── */

.tab-radio {
  display: none;
}

.tab-panel {
  display: none;
}

#tab-info:checked ~ #panel-info,
#tab-flights:checked ~ #panel-flights,
#tab-accommodations:checked ~ #panel-accommodations,
#tab-carrentals:checked ~ #panel-carrentals,
#tab-itinerary:checked ~ #panel-itinerary {
  display: block;
}

.tab-labels {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 0;
}

.tab-labels label {
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #aaa;
  transition: color 0.1s;
  user-select: none;
}

.tab-labels label:hover {
  color: #555;
}

#tab-info:checked ~ .tab-labels label[for="tab-info"],
#tab-flights:checked ~ .tab-labels label[for="tab-flights"],
#tab-accommodations:checked ~ .tab-labels label[for="tab-accommodations"],
#tab-carrentals:checked ~ .tab-labels label[for="tab-carrentals"],
#tab-itinerary:checked ~ .tab-labels label[for="tab-itinerary"] {
  color: #111;
  border-bottom-color: #111;
}

/* ── Flights table ──────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.flights-table {
  width: 100%;
  white-space: nowrap;
  border-collapse: collapse;
}

.flights-table th {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #888;
  border-bottom: 1px solid #ddd;
  padding: 0.4rem 0.5rem;
  text-align: left;
}

.flights-table td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

.flights-table.compact td,
.flights-table.compact th {
  padding: 0.3rem 0.4rem;
  font-size: 0.82rem;
}

.compact-input {
  padding: 0.2rem 0.35rem;
  font-size: 0.82rem;
  min-width: 0;
  border: 1px solid #ddd;
  background: #fff;
}

.compact-input:focus {
  border-color: #111;
  outline: none;
  box-shadow: none;
}

.iata-input {
  width: 52px;
  text-transform: uppercase;
  font-family: "Courier New", monospace;
  font-weight: 600;
}

/* ── Remove button ──────────────────────────────────────────── */

.remove-btn {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.15rem 0.4rem;
  line-height: 1;
  transition: color 0.1s;
}

.remove-btn:hover {
  color: #c00;
}

.small-btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  margin-top: 0.75rem;
  border: 1px solid #ddd;
  background: none;
  color: #555;
}

.small-btn:hover {
  border-color: #999;
  color: #111;
}

/* ── Form card (accommodations / car rentals) ───────────────── */

.form-card {
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  border: 1px solid #e0e0e0;
  background: #fafafa;
}

.form-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e8e8e8;
}

.form-card-header strong {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #888;
}

.form-card label {
  margin-bottom: 0.5rem;
}

/* ── View page sections ─────────────────────────────────────── */

.trip-section {
  margin-bottom: 2.5rem;
}

.trip-section h2 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #888;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
}

.accommodation-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.accommodation-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid #e8e8e8;
}

.accommodation-item:first-child {
  border-top: 1px solid #e8e8e8;
}

.accommodation-item strong {
  font-size: 0.95rem;
}

.car-rental-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid #e8e8e8;
}

.car-rental-item:first-child {
  border-top: 1px solid #e8e8e8;
}

.car-rental-item p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
}

.notes-content {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #555;
}

.notes-content p,
.notes-content ul,
.notes-content ol {
  margin: 0.2rem 0;
}

/* ── Itinerary ──────────────────────────────────────────────── */

.itinerary-content h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 2.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #111;
}

.itinerary-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.75rem;
  color: #333;
}

.itinerary-content h3 {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-top: 1.25rem;
  text-transform: uppercase;
  color: #555;
}

.itinerary-content blockquote {
  border-left: 2px solid #ddd;
  padding: 0.2rem 0.75rem;
  margin: 0.5rem 0;
  color: #777;
  font-style: normal;
  font-size: 0.9rem;
}

.itinerary-content table {
  width: 100%;
  border-collapse: collapse;
}

.itinerary-content table th,
.itinerary-content table td {
  border: 1px solid #ddd;
  padding: 0.4rem 0.6rem;
  font-size: 0.88rem;
}

/* ── EasyMDE ────────────────────────────────────────────────── */

#panel-itinerary .CodeMirror {
  min-height: 420px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.875rem;
  border: 1px solid #ddd;
}

.markdown-help {
  margin-bottom: 1.25rem;
  border: 1px solid #e8e8e8;
}

.markdown-help summary {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #888;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.markdown-help pre {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.8rem;
  line-height: 1.7;
  background: #fafafa;
  border-top: 1px solid #e8e8e8;
}

/* ── Danger zone ────────────────────────────────────────────── */

.danger-zone {
  margin-top: 3rem;
  border: 1px solid #fcc;
  padding: 1rem 1.25rem;
}

.danger-zone summary {
  color: #c00;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.danger-zone button.contrast {
  font-size: 0.85rem;
  background: none;
  border: 1px solid #c00;
  color: #c00;
  padding: 0.35rem 0.75rem;
}

.danger-zone button.contrast:hover {
  background: #c00;
  color: #fff;
}

/* ── Print title ────────────────────────────────────────────── */

.print-title {
  display: none;
}

/* ── Mobile ─────────────────────────────────────────────────── */

@media (max-width: 600px) {
  /* Stack page header vertically */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .btn-group {
    width: 100%;
  }

  .btn-group > * {
    flex: 1;
    text-align: center;
  }

  /* Trip list: stack name + dates */
  .trip-list-item {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.85rem 0;
  }

  .trip-list-main {
    flex-direction: column;
    gap: 0.1rem;
  }

  .trip-list-actions {
    gap: 1.25rem;
  }

  /* Tabs: scroll horizontally, don't wrap */
  .tab-labels {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tab-labels::-webkit-scrollbar {
    display: none;
  }

  .tab-labels label {
    white-space: nowrap;
    padding: 0.5rem 0.9rem;
  }

  /* Form grid: single column */
  .form-card .grid {
    grid-template-columns: 1fr;
  }

  /* Form actions: stack */
  .form-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .form-actions > * {
    width: 100%;
    text-align: center;
  }

  /* Flights table: tighter inputs */
  .compact-input {
    font-size: 0.78rem;
    padding: 0.15rem 0.25rem;
  }

  /* View page: tighter sections */
  .trip-section {
    margin-bottom: 1.75rem;
  }

  /* Car rental / accommodation: no side padding */
  .accommodation-item,
  .car-rental-item {
    padding-left: 0;
    padding-right: 0;
  }
}
