/* CruiseHQ — Utility overrides & base component classes */

.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.focus\:not-sr-only:focus { position:static; width:auto; height:auto; padding:0.5rem 1rem; margin:0; overflow:visible; clip:auto; white-space:normal; }

/* Card component */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  /* A pasted URL or booking ref must wrap, not widen its grid column and scroll the page.
     `anywhere` (unlike break-word) also lowers the min-content width grid/flex reserve. */
  min-width: 0;
  overflow-wrap: anywhere;
}
.card-elevated { background: var(--bg-card-elevated); }
.card-pad-sm { padding: 0.875rem; }
.card-pad-lg { padding: 1.5rem; }

/* Button component */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:0.5rem;
       padding:0.625rem 1rem; border-radius:12px; font-weight:500; font-size:14px;
       transition: all 0.15s ease; cursor:pointer; border: 1px solid transparent;
       min-height: 44px; user-select:none; -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); font-weight: 600; border-radius: 10px; }
.btn-primary:hover { background: var(--btn-primary-hover); color: var(--btn-primary-text); }
.btn-secondary { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); font-weight: 600; border-radius: 10px; }
.btn-secondary:hover { background: var(--btn-secondary-hover); color: var(--btn-secondary-text); }
/* Icon-only row actions stay quiet; text ghost buttons use the outline recipe below */
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-outline { background: transparent; color: var(--btn-ghost-text); border: 1px solid var(--btn-ghost-border); font-weight: 600; }
.btn-outline:hover { background: var(--surface-alt); }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); font-weight: 600; border-radius: 10px; }
.btn-danger:hover { filter: brightness(0.96); }
.btn-sm { padding: 0.4rem 0.75rem; min-height: 36px; font-size: 13px; border-radius: 10px; }
/* Disabled: outline + muted text, never a faded fill with faded text */
.btn:disabled { background: transparent; border-color: var(--btn-ghost-border); color: var(--text-muted); pointer-events: none; }

/* Keyboard focus on every interactive element */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 2px;
}

/* Input */
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.75rem;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}
.textarea { min-height: 100px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid var(--focus-ring); outline-offset: 1px;
  border-color: var(--focus-ring);
}
.input::placeholder { color: var(--text-muted); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--danger-text); box-shadow: 0 0 0 3px var(--danger-bg);
}

/* Label */
.label { display:block; font-size:13px; font-weight:500; color: var(--text-secondary); margin-bottom: 0.375rem; }
.field { margin-bottom: 1rem; }

/* Badges */
.badge { display:inline-flex; align-items:center; gap: 0.25rem; padding: 0.2rem 0.65rem;
         border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.01em; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-error   { background: var(--danger-bg);  color: var(--danger-text); }
.badge-info    { background: var(--info-bg);    color: var(--info-text); }
.badge-neutral { background: var(--chip-3-bg);  color: var(--chip-3-text); }
button.badge { border: 0; cursor: pointer; font-family: inherit; min-height: 28px; }
button.badge:hover { filter: brightness(0.95); }

/* Progress bar */
.progress-track { width:100%; height: 10px; background: var(--progress-track); border-radius: 999px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--progress-fill); box-shadow: inset 0 0 0 1.5px var(--progress-edge);
                  transition: width 0.6s ease; border-radius: 999px; }
.progress-fill-secondary { background: var(--btn-secondary-bg); box-shadow: inset 0 0 0 1.5px var(--accent-1-deep); }

/* Section header */
.section-title { font-family: 'Playfair Display', Georgia, serif; font-size: 26px; font-weight: 600; color: var(--heading); line-height: 1.2; }
.section-sub   { color: var(--text-secondary); font-size: 14px; }

/* Divider */
.divider { height: 1px; background: var(--divider); margin: 1rem 0; }

/* Chip / tab */
.chip { display:inline-flex; align-items:center; gap: 0.375rem; padding: 0.4rem 0.8rem;
        border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface); color: var(--text-muted);
        cursor: pointer; transition: all 0.15s ease; border: 1px solid var(--border); }
.chip:hover { background: var(--surface-alt); color: var(--text); }
.chip[aria-selected="true"], .chip.active { background: var(--btn-primary-bg); color: var(--btn-primary-text); border-color: var(--btn-primary-bg); }

/* FAB */
.fab { position: fixed; right: 1rem; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
       width: 56px; height: 56px; border-radius: 50%; background: var(--btn-primary-bg);
       color: var(--btn-primary-text); border: none; box-shadow: var(--shadow-lg);
       display:flex; align-items:center; justify-content:center; cursor:pointer; z-index: 50;
       transition: transform 0.15s ease, box-shadow 0.15s ease; }
.fab:hover { background: var(--btn-primary-hover); color: var(--btn-primary-text); transform: translateY(-2px); }
.fab:active { transform: scale(0.94); }
@media (min-width: 640px) {
  .fab { bottom: 1.5rem; }
}

/* Nav */
.nav-item { display:flex; align-items:center; gap: 0.75rem; padding: 0.65rem 0.85rem; border-radius: 10px;
            color: var(--nav-text); font-weight: 500; font-size: 14px; cursor: pointer;
            transition: all 0.15s ease; -webkit-tap-highlight-color: transparent; }
.nav-item svg { color: var(--nav-icon); }
.nav-item:hover { background: var(--nav-hover-bg); }
.nav-item.active { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 600;
                   box-shadow: inset 3px 0 0 var(--accent-1-deep); }
.nav-item.active svg { color: var(--accent-1-deep); }
/* Rainbow Pastel signature: a 6px rainbow stripe across the top of the menu, and menu icons
   cycling through the six hues. On every other theme the stripe has no height. */
.nav-stripe { height: 0; background: var(--brand-stripe); flex-shrink: 0; }
[data-theme="rainbow"] .nav-stripe { height: 6px; }
[data-theme="rainbow"] .nav-item:nth-child(6n+1) svg { color: var(--chip-1-text); }
[data-theme="rainbow"] .nav-item:nth-child(6n+2) svg { color: var(--chip-2-text); }
[data-theme="rainbow"] .nav-item:nth-child(6n+3) svg { color: var(--chip-3-text); }
[data-theme="rainbow"] .nav-item:nth-child(6n+4) svg { color: var(--chip-4-text); }
[data-theme="rainbow"] .nav-item:nth-child(6n+5) svg { color: var(--chip-5-text); }
[data-theme="rainbow"] .nav-item:nth-child(6n+6) svg { color: var(--chip-6-text); }

.bottom-nav-item { display:flex; flex-direction: column; align-items:center; gap: 2px; padding: 6px 2px;
                   color: var(--nav-text); font-size: 10px; font-weight: 500; min-width: 0;
                   background: transparent; border: none; font-family: inherit;
                   -webkit-tap-highlight-color: transparent; cursor: pointer;
                   transition: color 0.15s ease; }
.bottom-nav-item svg { color: var(--nav-icon); }
.bottom-nav-item.active { color: var(--nav-active-text); background: var(--nav-active-bg); font-weight: 600; }
.bottom-nav-item.active svg { color: var(--accent-1-deep); }

/* Toast */
.toast { pointer-events: auto; background: var(--bg-card); color: var(--text-primary);
         padding: 0.75rem 1rem; border-radius: 12px; box-shadow: var(--shadow-lg);
         border: 1px solid var(--border); display: flex; align-items:center; gap: 0.6rem;
         font-size: 14px; margin-top: 0.5rem; }
.toast-success svg { color: var(--success-text); }
.toast-error svg { color: var(--danger-text); }
.toast-info svg { color: var(--info-text); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
                  z-index: 90; display: flex; align-items: flex-end; justify-content: center;
                  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0); }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 2rem 1rem; }
}
.modal-panel { background: var(--bg-card); border-radius: 20px 20px 0 0; width: 100%; max-width: 640px;
               max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg);
               animation: slideUp 0.28s ease; }
@media (min-width: 640px) {
  .modal-panel { border-radius: 20px; animation: scaleIn 0.2s ease; }
}
.modal-header { position: sticky; top: 0; background: var(--bg-card);
                padding: 1.25rem 1.25rem 0.75rem; border-bottom: 1px solid var(--divider);
                display: flex; align-items: center; justify-content: space-between; z-index: 1; }
.modal-body { padding: 1rem 1.25rem 1.5rem; }

/* Scrollbar refinement */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: padding-box; border: 2px solid transparent; }

/* Section content wrapper */
.section-wrap { max-width: 1200px; margin: 0 auto; padding: 1rem; padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 640px) {
  .section-wrap { padding: 1.5rem; padding-bottom: 2rem; }
}

/* ---- v1.1 visual layer ---- */

/* Native checkboxes/radios/ranges pick up the theme instead of browser blue */
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--accent-2-deep); }

/* Hero countdown card */
.hero-card {
  position: relative;
  overflow: hidden;
  background: var(--hero-grad, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem 1.5rem 2.25rem;
  box-shadow: var(--shadow-md);
  min-width: 0;
  overflow-wrap: anywhere;
}
.hero-card .hero-number {
  color: var(--hero-number, var(--accent-hover));
  font-size: clamp(56px, 10vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.hero-waves {
  position: absolute; left: 0; right: 0; bottom: -2px; height: 42px;
  pointer-events: none; opacity: 0.5;
}
.hero-waves svg { width: 200%; height: 100%; display: block;
  animation: heroDrift 18s linear infinite; }
@keyframes heroDrift {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-waves svg { animation: none; }
}

/* ---- Dashboard header scene (illustrated sky, sea and ship) ---- */
.scene { position: relative; overflow: hidden; isolation: isolate; border-radius: 22px;
  min-height: 300px; border: 1px solid var(--border); box-shadow: var(--shadow-md); background: var(--surface-alt); }
.scene-bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -3; }
.scene-sky { position: absolute; top: 12px; right: 4%; width: clamp(150px, 22%, 260px); height: auto; z-index: -2; }
.scene-ship { position: absolute; right: 5%; bottom: 22px; width: clamp(230px, 40%, 470px); height: auto; z-index: -1;
  transform-origin: 50% 90%; animation: shipBob 7s ease-in-out infinite; }
.scene-waves { position: absolute; left: 0; right: 0; bottom: 0; height: 52px; overflow: hidden; z-index: 0; pointer-events: none; }
.scene-waves svg { width: 200%; height: 100%; display: block; animation: heroDrift 26s linear infinite; }
@keyframes shipBob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-4px) rotate(-0.6deg); } }
@media (prefers-reduced-motion: reduce) { .scene-ship, .scene-waves svg { animation: none; } }
.scene-content { position: relative; z-index: 1; padding: 1.75rem 1.75rem 4.5rem; max-width: 58%; }
.scene-eyebrow { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.7rem; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; background: var(--surface); color: var(--accent-1-deep);
  box-shadow: var(--shadow-sm); }
.scene-title { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; color: var(--heading);
  font-size: clamp(30px, 4.6vw, 46px); line-height: 1.05; margin-top: 0.7rem; letter-spacing: -0.01em; }
.scene-title-sub { font-size: 0.5em; font-weight: 600; color: var(--text); }
.scene-line { color: var(--text); font-size: 15px; margin-top: 0.4rem; }
.scene-small { font-size: 13px; }
.cd-tiles { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.cd-tile { min-width: 66px; padding: 0.55rem 0.7rem; text-align: center; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: var(--shadow-sm); }
.cd-num { font-family: 'Playfair Display', Georgia, serif; font-size: 30px; font-weight: 700; line-height: 1; color: var(--heading); }
.cd-tile:first-child .cd-num { color: var(--accent-1-deep); }
.cd-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-top: 0.25rem; }
@media (max-width: 639px) {
  .scene { min-height: 470px; }
  .scene-content { max-width: 100%; padding: 1.25rem 1.25rem 0; }
  .scene-ship { width: 74%; right: 3%; bottom: 18px; }
  .scene-sky { width: 120px; top: auto; bottom: 150px; right: 2%; }
  .scene-glint { display: none; }   /* the sun moves on phones, so its glint would float behind the ship */
  .cd-tile { min-width: 60px; flex: 1; }
}

/* ---- Stat strip under the scene ---- */
.kpi-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 900px) { .kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem 1.1rem; }
.kpi-top { display: flex; align-items: center; gap: 0.55rem; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.kpi-value { font-family: 'Playfair Display', Georgia, serif; font-size: 28px; font-weight: 700; color: var(--heading); line-height: 1.1; }
.kpi-sub { font-size: 12px; color: var(--text-muted); }

/* ---- Free demo (inert unless the demo shim set html.is-demo) ---- */
html.is-demo .demo-hide { display: none !important; }
.demo-bar { position: relative; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  flex-wrap: wrap; padding: 0.4rem 1rem; font-size: 13px; font-weight: 600;
  background: var(--callout-bg); color: var(--text); border-bottom: 1px solid var(--callout-border); }
.demo-bar .btn { min-height: 30px; padding: 0.25rem 0.75rem; }
.demo-card { background: var(--callout-bg); border: 1.5px solid var(--callout-border); }
.demo-card li { display: flex; align-items: center; gap: 0.5rem; }
.demo-card li svg { color: var(--accent-1-deep); flex-shrink: 0; }

/* ---- Luna Sync card ---- */
.sync-code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 40px; font-weight: 600; letter-spacing: 0.12em;
  text-align: center; color: var(--heading); background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 14px; padding: 0.75rem; margin-bottom: 0.75rem; }
.sync-code-input { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 24px; letter-spacing: 0.15em; text-align: center; }
.sync-pics { display: flex; justify-content: center; gap: 1.25rem; margin: 0.75rem 0 1rem; }
.sync-pics > span { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.sync-pic { font-size: 44px; line-height: 1; }
.sync-key { display: block; width: 100%; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 14px; line-height: 1.6;
  word-break: break-all; text-align: left; padding: 0.75rem; border-radius: 10px; color: var(--text);
  background: var(--surface-alt); border: 1px solid var(--border); cursor: pointer; }
.sync-key-hidden { filter: blur(6px); user-select: none; }

/* Widget header: icon + label */
.widget-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em; }
.widget-head svg { color: var(--accent-hover); width: 15px; height: 15px; }

/* Card hover lift (pointer devices only) */
@media (hover: hover) {
  .dash-grid .card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
  .dash-grid .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
}

/* Glass top bar */
.topbar-glass {
  background: color-mix(in srgb, var(--bg-main) 78%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

/* Bottom nav active pill */
.bottom-nav-item { position: relative; border-radius: 10px; }
.bottom-nav-item.active::before {
  content: ''; position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 999px; background: var(--accent-1-deep);
}

/* Dress-code chips (outfit planner) */
.dress-formal   { background: var(--chip-1-bg); color: var(--chip-1-text); }
.dress-smart    { background: var(--chip-2-bg); color: var(--chip-2-text); }
.dress-casual   { background: var(--chip-3-bg); color: var(--chip-3-text); }
.dress-theme    { background: var(--chip-4-bg); color: var(--chip-4-text); }

/* Confetti canvas */
#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 95; }

/* Dashboard grid */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .dash-grid { grid-template-columns: repeat(3, 1fr); }
}
.dash-span-2 { grid-column: span 1; }
@media (min-width: 640px) {
  .dash-span-2 { grid-column: span 2; }
}
.dash-span-full { grid-column: 1 / -1; }

/* Progress ring */
.progress-ring { transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-linecap: round; }

/* Timeline styling */
.tl-line { position: relative; padding-left: 32px; }
.tl-line::before { content: ''; position: absolute; left: 12px; top: 8px; bottom: 8px; width: 2px; background: var(--divider); }
.tl-item { position: relative; padding-bottom: 1.25rem; }
.tl-item::before { content: ''; position: absolute; left: -25px; top: 8px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent-1); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--accent-1-deep); }
.tl-item.done::before { background: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-2-deep); }
.tl-item.overdue::before { background: var(--danger-bg); box-shadow: 0 0 0 2px var(--danger-text); }


/* Utility classes */
.text-accent { color: var(--accent-text); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.bg-accent-primary { background: var(--accent-primary); }
.bg-accent-light { background: var(--accent-light-bg); }
.border-default { border-color: var(--border); }

/* Hide chrome when running as installed PWA if needed */
@media (display-mode: standalone) {
  .hide-in-standalone { display: none !important; }
}

/* Safe area helpers */
.pt-safe { padding-top: env(safe-area-inset-top, 0px); }
.pb-safe { padding-bottom: env(safe-area-inset-bottom, 0px); }
.pl-safe { padding-left: env(safe-area-inset-left, 0px); }
.pr-safe { padding-right: env(safe-area-inset-right, 0px); }

/* Icon sizing */
.i-sm { width: 16px; height: 16px; }
.i-md { width: 20px; height: 20px; }
.i-lg { width: 24px; height: 24px; }
.i-xl { width: 32px; height: 32px; }

/* Print — only the data, no app chrome, natural document flow */
@page { margin: 1.5cm; }
@media print {
  #sidebar, #topbar, #bottomnav, #banner-slot, #toast-root, #modal-root,
  .fab, .btn, .chip, [role="tablist"], input[type="search"], .leaflet-control-container,
  [data-jump], .hero-waves, #confetti-canvas, .demo-bar {
    display: none !important;
  }
  /* Textareas would print only their visible box: app.js sets each one to its content height
     on beforeprint. (Not CSS field-sizing — it also shrinks the width to a one-letter column.) */
  .textarea { width: 100%; overflow: visible; resize: none; }
  .input, .select, .textarea { border-color: #bbb; }
  body { background: #fff !important; color: #000 !important; min-height: auto; }
  #app-root, main, #route-target { display: block !important; overflow: visible !important; min-height: auto !important; }
  .section-wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid; }
  .dash-grid { display: block; }
  .dash-grid > * { margin-bottom: 0.75rem; }
  a { text-decoration: none; color: inherit; }
}
