/* =========================================
   CNH — TRIP PLANNER
   Shared header/footer: layout.css
   Shared dashboard styles: dashboard.css
   Planner-specific adjustments below
   ========================================= */

body.trip-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f2f6f7 !important;
  background-image: none !important;
  background-attachment: scroll !important;
  color: #12334b;
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color-scheme: light;
}

/* Use the existing navbar with a solid navy background. */

body.trip-page .navbar {
  background: #051428;
}

/* Preserve the shared profile-icon appearance. */

body.trip-page .navbar .avatar-circle {
  padding: 0;
  cursor: pointer;
}

/* Planner layout */

body.trip-page .page-wrapper.trip-shell {
  display: block;
  flex: 1;
  width: 100%;
  max-width: 1100px;
  min-height: 0;
  margin: 0 auto;
  padding:
    calc(var(--trip-navbar-height, 72px) + 28px)
    24px
    64px;
  overflow: visible;
  visibility: visible;
}

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

.trip-shell .trip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.trip-shell a {
  color: #087e83;
}

/* Heading: overrides dashboard rules that hide mobile h1. */

body.trip-page .trip-shell #heading {
  display: block !important;
  margin: 0;
  padding: 0;
  color: #12334b;
  font-family: "Merriweather", Georgia, serif;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-align: left;
  text-transform: none;
  text-shadow: none;
}

.trip-shell .trip-hero {
  margin-bottom: 24px;
  padding: 32px 0 24px;
  border-bottom: 1px solid #dce6ea;
}

.trip-shell .trip-hero h1::after {
  display: block;
  width: 64px;
  height: 3px;
  margin-top: 20px;
  background: var(--luxury-gold, #c6a75e);
  content: "";
}

.trip-shell .trip-muted {
  color: #536975;
}

/* Reset dashboard heading styles inside the planner only. */

body.trip-page .trip-shell h2,
body.trip-page .trip-shell h3 {
  margin: 0 0 12px;
  padding: 0;
  color: #12334b;
  font-family: "Merriweather", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  text-shadow: none;
  overflow-wrap: anywhere;
}

body.trip-page .trip-shell h3 {
  font-size: 19px;
}

/* Trip cards */

.trip-shell .trip-panel {
  min-width: 0;
  margin: 16px 0;
  padding: 24px;
  border: 1px solid #dce6ea;
  border-radius: 16px;
  background: #ffffff;
  color: #12334b;
  box-shadow: 0 6px 20px rgba(5, 20, 40, 0.04);
  overflow-wrap: anywhere;
}

.trip-shell .trip-panel p {
  color: inherit;
}

.trip-shell .trip-panel p.trip-muted {
  color: #536975;
}

/* Planner buttons only.
   Shared navbar and footer buttons keep layout.css styling. */

.trip-shell .trip-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.trip-shell button {
  display: inline-block;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid #cbd8df;
  border-radius: 8px;
  background: #ffffff;
  color: #12334b;
  font: inherit;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
  cursor: pointer;
}

.trip-shell button.primary {
  border-color: #12334b;
  background: #12334b;
  color: #ffffff;
}

.trip-shell button:hover {
  border-color: #9a7c36;
}

.trip-shell button.primary:hover {
  background: #1c4863;
  color: #ffffff;
}

.trip-shell button:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Add to Trip buttons on dashboard listings */

.trip-add-button {
  display: inline-block;
  max-width: 100%;
  margin: 10px 0;
  padding: 10px 16px;
  border: 1px solid #c6a75e;
  border-radius: 8px;
  background: #12334b;
  color: #ffffff;
  font: inherit;
  line-height: 1.5;
  white-space: normal;
  cursor: pointer;
}

.trip-add-button:hover {
  background: #1c4863;
}

/* Forms */

.trip-shell label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: #12334b;
  font-size: 14px;
}

.trip-shell input,
.trip-shell select,
.trip-shell textarea {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid #9aafb9;
  border-radius: 8px;
  background: #ffffff;
  color: #12334b;
  font: inherit;
  line-height: 1.5;
  box-shadow: none;
}

.trip-shell textarea {
  min-height: 90px;
  resize: vertical;
}

.trip-shell .trip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.trip-shell .trip-wide {
  grid-column: 1 / -1;
}

/* Create/edit dialog */

.trip-shell dialog {
  width: min(620px, calc(100% - 32px));
  max-height: 85vh;
  max-height: 85dvh;
  padding: 24px;
  border: 1px solid #dce6ea;
  border-radius: 16px;
  background: #ffffff;
  color: #12334b;
  overflow-y: auto;
}

.trip-shell dialog::backdrop {
  background: rgba(5, 20, 40, 0.67);
}

.trip-shell #editForm {
  margin: 0;
}

.trip-shell #editForm > .trip-actions {
  margin-top: 16px;
}

/* Messages */

.trip-shell #message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.trip-shell #message:empty {
  display: none;
}

.trip-shell .trip-error {
  color: #9c2631;
}

/* Budget */

.trip-shell .trip-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.trip-shell .trip-summary strong {
  display: block;
  margin-top: 4px;
  color: #12334b;
  font-size: 24px;
}

/* Stop details */

.trip-shell .trip-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.trip-shell .trip-notes {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.trip-shell .trip-badge {
  align-self: flex-start;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 20px;
  background: #e5f4f1;
  color: #18554a;
  font-size: 13px;
}

/* Keep shared footer visible on the planner,
   including in the app. */

body.trip-page .site-footer {
  display: block;
  visibility: visible;
  background: #051428;
}

body.trip-page .site-footer .footer-content {
  overflow-wrap: anywhere;
}

@media (min-width: 769px) {
  body.trip-page .site-footer .footer-content {
    max-height: none;
  }

  body.trip-page .site-footer .footer-arrow {
    display: none;
  }
}

@media (max-width: 768px) {
  body.trip-page .site-footer .footer-accordion.open
  .footer-content {
    max-height: none;
  }
}

/* Keyboard focus */

.trip-shell :focus-visible,
.trip-add-button:focus-visible {
  outline: 3px solid #098f9a;
  outline-offset: 3px;
}

/* Phones */

@media (max-width: 560px) {
  body.trip-page .page-wrapper.trip-shell {
    padding:
      calc(var(--trip-navbar-height, 72px) + 20px)
      16px
      40px;
  }

  .trip-shell .trip-panel {
    padding: 18px;
  }

  .trip-shell .trip-grid {
    grid-template-columns: 1fr;
  }

  .trip-shell .trip-item-header {
    flex-direction: column;
  }

  .trip-shell dialog {
    padding: 18px;
  }

  .trip-shell .trip-summary {
    gap: 16px;
  }
}

/* =========================================
   PRINT / SAVE PDF
   ========================================= */

@page {
  size: A4 portrait;
  margin: 16mm;
}

@media print {

  html {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  body.trip-page {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #12334b !important;
    font-size: 10pt;
    line-height: 1.5;
    overflow: visible !important;
  }

  /* Hide website navigation and editing controls. */

  body.trip-page .navbar,
  body.trip-page .site-footer,
  body.trip-page .trip-top,
  body.trip-page .trip-actions,
  body.trip-page .trip-shell button,
  body.trip-page #message,
  body.trip-page dialog,
  body.trip-page #cookieBanner {
    display: none !important;
  }

  /* Use the printable page width.
     Page margins are controlled by @page above. */

  body.trip-page .page-wrapper.trip-shell {
    display: block !important;
    position: static !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    visibility: visible !important;
  }

  body.trip-page .trip-shell,
  body.trip-page .trip-shell * {
    box-sizing: border-box;
  }

  /* Document title */

  body.trip-page .trip-shell .trip-hero {
    margin: 0 0 7mm !important;
    padding: 0 0 5mm !important;
    border-bottom: 1px solid #c6a75e;
    break-inside: avoid;
    break-after: avoid;
  }

  body.trip-page .trip-shell #heading {
    display: block !important;
    margin: 0 0 3mm !important;
    padding: 0 !important;
    font-size: 24pt !important;
    line-height: 1.25 !important;
    text-align: left !important;
    text-shadow: none !important;
  }

  body.trip-page .trip-shell #heading::after {
    display: none !important;
  }

  body.trip-page .trip-shell #intro {
    margin: 0 !important;
    color: #536975 !important;
    font-size: 10pt;
  }

  /* Trip summary and saved stops */

  body.trip-page .trip-shell .trip-panel {
    width: auto !important;
    max-width: 100% !important;
    margin: 0 0 5mm !important;
    padding: 5mm !important;
    border: 1px solid #cbd8df;
    border-radius: 3mm;
    background: #ffffff !important;
    color: #12334b !important;
    box-shadow: none !important;
    overflow: visible !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Date headings stay with the following stop. */

  body.trip-page .trip-shell #app > h2 {
    margin: 6mm 0 3mm !important;
    padding: 0 !important;
    font-size: 13pt !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  body.trip-page .trip-shell .trip-panel h2 {
    margin: 0 0 3mm !important;
    font-size: 16pt !important;
  }

  body.trip-page .trip-shell .trip-panel h3 {
    margin: 0 0 2mm !important;
    font-size: 12pt !important;
  }

  body.trip-page .trip-shell .trip-panel p {
    margin: 2mm 0 !important;
    font-size: 10pt;
  }

  /* Three aligned budget columns */

  body.trip-page .trip-shell .trip-summary {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5mm;
    margin: 4mm 0;
    break-inside: avoid;
  }

  body.trip-page .trip-shell .trip-summary > div {
    min-width: 0;
    font-size: 9pt;
    overflow-wrap: anywhere;
  }

  body.trip-page .trip-shell .trip-summary strong {
    display: block;
    margin-top: 2mm;
    font-size: 15pt !important;
    line-height: 1.3;
  }

  /* Keep stop name and status aligned. */

  body.trip-page .trip-shell .trip-item-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 5mm;
  }

  body.trip-page .trip-shell .trip-item-header h3 {
    min-width: 0;
  }

  body.trip-page .trip-shell .trip-badge {
    flex-shrink: 0;
    padding: 1mm 2mm;
    border: 1px solid #cbd8df;
    background: #ffffff !important;
    color: #12334b !important;
    font-size: 8pt;
  }

  body.trip-page .trip-shell .trip-notes {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

/* Back arrow — matches the dashboard button */
.trip-page .trip-back-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;

  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;

  background: transparent;
  color: #C6A75E;
  border: 1px solid rgba(198, 167, 94, 0.35);
  border-radius: 14%;

  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.trip-page .trip-back-arrow:hover {
  background: rgba(198, 167, 94, 0.12);
  border-color: rgba(198, 167, 94, 0.55);
}

.trip-page .trip-back-arrow svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #C6A75E;
  transform: translateX(-2px);
}

.trip-page .trip-back-arrow:focus-visible {
  outline: 2px solid #C6A75E;
  outline-offset: 4px;
}

@media print {
  .trip-page .trip-back-arrow {
    display: none !important;
  }
}

/* Mobile budget: three equal columns */
@media screen and (max-width: 600px) {
  .trip-page .trip-summary {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    align-items: stretch;
  }

  .trip-page .trip-summary > div {
    display: flex;
    flex-direction: column;

    width: auto;
    min-width: 0;
    max-width: 100%;
    margin: 0;

    font-size: clamp(11px, 3vw, 14px);
    line-height: 1.45;

    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
  }

  .trip-page .trip-summary > div > strong {
    display: block;
    min-width: 0;
    max-width: 100%;

    margin: auto 0 0;
    padding-top: 8px;

    font-size: clamp(13px, 3.7vw, 18px);
    line-height: 1.3;
    font-variant-numeric: tabular-nums;

    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }
}

/* Even mobile buttons above the trip */
@media screen and (max-width: 600px) {
  .trip-page #app > .trip-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
  }

  .trip-page #app > .trip-actions > button {
    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    height: auto;
    margin: 0;
    padding: 11px 10px;

    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;

    white-space: normal;
    overflow-wrap: anywhere;
    hyphens: auto;
  }

  /* Make Add stop the full-width main action */
  .trip-page #app > .trip-actions > button.primary {
    grid-column: 1 / -1;
  }
}
/* CNH — trip and stop delete confirmations */

body.trip-page dialog.trip-delete-dialog {
  box-sizing: border-box;
  width: min(440px, calc(100% - 32px));
  max-width: none;
  max-height: 85vh;
  max-height: 85dvh;
  margin: auto;
  padding: clamp(20px, 5vw, 30px);
  border: 1px solid #dce6ea;
  border-top: 4px solid #c6a75e;
  border-radius: 16px;
  background: #ffffff;
  color: #12334b;
  font-family: inherit;
  overflow-y: auto;
  overflow-wrap: anywhere;
  box-shadow: 0 20px 65px rgba(5, 20, 40, 0.25);
}

body.trip-page dialog.trip-delete-dialog::backdrop {
  background: rgba(5, 20, 40, 0.67);
}

body.trip-page .trip-delete-dialog h2 {
  margin: 0 0 14px;
  color: #12334b;
  font-family: inherit;
  font-size: clamp(20px, 5vw, 25px);
  font-weight: 700;
  line-height: 1.3;
  text-align: start;
}

body.trip-page .trip-delete-dialog p {
  margin: 0;
  color: #526575;
  font-size: 15px;
  line-height: 1.65;
  text-align: start;
}

body.trip-page .trip-delete-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
  margin-top: 24px;
}

body.trip-page .trip-delete-actions button {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #cbd8df;
  border-radius: 9px;
  background: #ffffff;
  color: #12334b;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

body.trip-page .trip-delete-actions .trip-delete-cancel:hover {
  background: #f1f5f8;
  border-color: #12334b;
}

body.trip-page .trip-delete-actions .trip-delete-confirm {
  border-color: #b42332;
  background: #b42332;
  color: #ffffff;
}

body.trip-page .trip-delete-actions .trip-delete-confirm:hover {
  border-color: #921c29;
  background: #921c29;
}

body.trip-page .trip-delete-actions button:focus-visible {
  outline: 3px solid #c6a75e;
  outline-offset: 3px;
}

@media print {
  body.trip-page dialog.trip-delete-dialog {
    display: none !important;
  }
}

/* Privacy guidance beneath trip and stop notes */

.trip-shell .trip-notes-privacy-hint {
  display: block;
  margin-top: 8px;
  color: #526575;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Keep the planner light in the Android app and mobile web. */
html:has(body.trip-page),
html body.trip-page,
html body.trip-page .page-wrapper.trip-shell {
  background: #f2f6f7 !important;
  background-image: none !important;
  color: #12334b;
  color-scheme: light;
}

html body.trip-page::before,
html body.trip-page::after {
  display: none !important;
}

html body.trip-page .trip-hero {
  background: transparent !important;
}

html body.trip-page .trip-hero #heading,
html body.trip-page #app > h2 {
  color: #12334b !important;
}

html body.trip-page #intro {
  color: #536975 !important;
}