/* ══════════════════════════════════════════════════════════════
   PORT DAYS v2 — Cruise Shore Itinerary PWA
══════════════════════════════════════════════════════════════ */
:root {
  --navy:       #0a2540;
  --navy-mid:   #112f4e;
  --navy-light: #1a3f60;
  --teal:       #00b4d8;
  --teal-glow:  rgba(0, 180, 216, 0.15);
  --coral:      #f4845f;
  --coral-glow: rgba(244, 132, 95, 0.15);
  --sand:       #fdf3e7;
  --sand-dark:  #f5e6cc;
  --gold:       #e9a84c;
  --green:      #4caf7d;
  --purple:     #7c5cbf;
  --white:      #ffffff;
  --text:       #1a2940;
  --text-mid:   #3a4f6a;
  --text-light: #6b7f95;
  --bg:         #f8f4ef;
  --card-bg:    #ffffff;
  --border:     rgba(10, 37, 64, 0.08);
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 2px 12px rgba(10,37,64,0.08);
  --shadow-md:  0 4px 24px rgba(10,37,64,0.12);
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tl-time-w:  52px;
  --tl-dot-w:   24px;
  --tl-gap:     10px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; overflow-x: hidden; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
a { color: inherit; }

/* INSTALL BANNER */
.install-banner { background: var(--navy); color: var(--white); padding: 10px 16px; display: flex; align-items: center; gap: 10px; font-size: 0.82rem; position: sticky; top: 0; z-index: 100; }
.install-banner span { flex: 1; }
.install-banner #installBtn { background: var(--teal); color: var(--navy); font-weight: 600; font-size: 0.8rem; padding: 5px 12px; border-radius: 20px; white-space: nowrap; }
.install-banner .dismiss { color: var(--white); opacity: 0.6; font-size: 1rem; padding: 4px; }

/* HEADER */
.app-header { background: var(--navy); padding: 14px 14px 10px; padding-top: calc(14px + env(safe-area-inset-top, 0px)); position: sticky; top: 0; z-index: 90; box-shadow: 0 2px 20px rgba(0,0,0,0.25); }
.header-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.header-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex-shrink: 1; }
.wave-emoji { font-size: 1.4rem; flex-shrink: 0; animation: sway 3s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
.app-header h1 { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700; color: var(--white); line-height: 1.1; white-space: nowrap; }
.header-sub { font-size: 0.68rem; color: rgba(255,255,255,0.55); letter-spacing: 0.03em; text-transform: uppercase; line-height: 1.5; }
.header-sub-ship { display: block; }
.header-sub-dates { display: block; }

/* COUNTDOWN PILLS */
.countdown-pills { display: flex; gap: 5px; flex-shrink: 0; }
.pill { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 5px 8px; text-align: center; min-width: 62px; max-width: 76px; transition: background 0.2s; }
.pill.today { background: var(--coral-glow); border-color: var(--coral); }
.pill-label { display: block; font-size: 0.56rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-days { display: block; font-family: var(--font-serif); font-size: 0.95rem; font-weight: 700; color: var(--teal); line-height: 1.1; }
.pill.today .pill-days { color: var(--coral); }

/* TAB NAV */
.tab-nav { background: var(--navy-mid); display: flex; border-bottom: 2px solid rgba(255,255,255,0.06); position: sticky; top: 67px; z-index: 80; overflow-x: auto; scrollbar-width: none; }
.tab-nav::-webkit-scrollbar { display: none; }
.tab-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 11px 8px; font-size: 0.8rem; font-weight: 500; color: rgba(255,255,255,0.5); border-bottom: 2px solid transparent; transition: all 0.2s; white-space: nowrap; min-width: 80px; }
.tab-btn .tab-flag { font-size: 1rem; }
.tab-btn.active { color: var(--white); border-bottom-color: var(--teal); }
.tab-btn:active { background: rgba(255,255,255,0.05); }

/* TAB CONTENT */
.tab-content { display: none; padding-bottom: calc(32px + var(--safe-bottom)); }
.tab-content.active { display: block; }

/* PORT HERO */
.port-hero { position: relative; height: 180px; overflow: hidden; display: flex; align-items: center; }
.ocho-hero   { background: linear-gradient(135deg, #1a5c3a 0%, #2d7a55 40%, #0e3d25 100%); }
.cayman-hero { background: linear-gradient(135deg, #0077b6 0%, #00b4d8 50%, #0a2540 100%); }
.bimini-hero { background: linear-gradient(135deg, #e8a045 0%, #d4691e 40%, #8b2500 100%); }
.port-hero::before { content: ''; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 30 Q15 15 30 30 Q45 45 60 30' stroke='rgba(255,255,255,0.06)' fill='none' stroke-width='1'/%3E%3C/svg%3E") repeat; animation: wavemove 8s linear infinite; }
@keyframes wavemove { from { background-position: 0 0; } to { background-position: 60px 0; } }
.hero-overlay { position: relative; z-index: 1; padding: 24px 20px 36px; width: 100%; }
.hero-badge { display: inline-block; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); color: rgba(255,255,255,0.9); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 3px 10px; border-radius: 20px; margin-bottom: 6px; }
.hero-title { font-family: var(--font-serif); font-size: 2.2rem; font-weight: 700; color: var(--white); line-height: 1; margin-bottom: 4px; }
.hero-tagline { color: rgba(255,255,255,0.65); font-size: 0.8rem; letter-spacing: 0.04em; }
.hero-wave { position: absolute; bottom: -1px; left: 0; right: 0; height: 40px; }
.hero-wave svg { width: 100%; height: 100%; }

/* ALERT BANNERS */
.alert-banner { display: flex; gap: 10px; padding: 12px 16px; margin: 16px; border-radius: var(--radius-sm); font-size: 0.82rem; line-height: 1.5; align-items: flex-start; }
.alert-banner.warning { background: rgba(233,168,76,0.12); border-left: 3px solid var(--gold); color: #5a3e0a; }
.alert-banner.critical { background: rgba(244,132,95,0.12); border-left: 3px solid var(--coral); color: #6b2c10; }
.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* ══ TIMELINE — times LEFT of the line ══════════════════════
   Columns: [time] [dot] [card]
   Line runs through center of dot column.                  */
.timeline { padding: 8px 12px 24px 12px; max-width: 640px; margin: 0 auto; position: relative; }
.timeline::before {
  content: '';
  position: absolute;
  /* line center = left-padding + time-col + gap + half-dot-col */
  left: calc(12px + var(--tl-time-w) + var(--tl-gap) + var(--tl-dot-w) / 2 - 1px);
  top: 0; bottom: 0; width: 2px;
  background: linear-gradient(to bottom, var(--teal) 0%, var(--border) 100%);
  z-index: 0;
}
.stop-card { display: grid; grid-template-columns: var(--tl-time-w) var(--tl-dot-w) 1fr; column-gap: var(--tl-gap); margin-bottom: 20px; position: relative; z-index: 1; align-items: start; }
.stop-time { font-size: 0.7rem; font-weight: 600; color: var(--text-light); text-align: right; padding-top: 15px; letter-spacing: -0.01em; line-height: 1.2; }
.stop-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--teal); margin-top: 16px; position: relative; z-index: 2; align-self: start; justify-self: center; transition: transform 0.2s; }
.stop-dot.accent { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-glow); }
.stop-dot.ship { background: var(--navy); border-color: var(--navy); }
.stop-card.terminal .stop-body { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%); }
.stop-card.terminal .stop-name { color: var(--white); }
.stop-card.terminal .stop-desc { color: rgba(255,255,255,0.7); }

/* STOP BODY */
.stop-body { background: var(--card-bg); border-radius: var(--radius); padding: 13px 13px 11px; box-shadow: var(--shadow); border: 1px solid var(--border); animation: cardIn 0.3s ease both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.stop-card:active .stop-body { box-shadow: var(--shadow-md); }
.stop-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.stop-name { font-family: var(--font-serif); font-size: 1rem; font-weight: 600; color: var(--navy); line-height: 1.2; margin-bottom: 4px; }
.stop-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.stop-tag { display: inline-block; font-size: 0.68rem; font-weight: 500; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.stop-tag.nature    { background: rgba(76,175,125,0.12); color: #1a6642; }
.stop-tag.food      { background: rgba(244,132,95,0.12); color: #8a3210; }
.stop-tag.transport { background: rgba(0,180,216,0.12); color: #005070; }
.stop-tag.culture   { background: rgba(233,168,76,0.12); color: #6b4400; }
.stop-tag.cost      { background: rgba(10,37,64,0.06); color: var(--text-mid); }
.stop-desc { font-size: 0.83rem; color: var(--text-mid); line-height: 1.55; margin-bottom: 10px; }

/* MAP BUTTON */
.map-btn { background: var(--navy); color: var(--white); font-size: 0.72rem; font-weight: 500; padding: 5px 10px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; transition: background 0.2s; }
.map-btn:active { background: var(--navy-light); }

/* TIP BLOCKS */
.tip-block { display: flex; gap: 8px; background: rgba(0,180,216,0.07); border-left: 3px solid var(--teal); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 8px 10px; margin-bottom: 8px; font-size: 0.79rem; color: var(--text-mid); line-height: 1.45; }
.tip-block.warning { background: rgba(244,132,95,0.07); border-left-color: var(--coral); }
.tip-icon { font-size: 0.9rem; flex-shrink: 0; }

/* BRING BLOCK */
.bring-block { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; align-items: center; }
.bring-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-light); margin-right: 2px; }
.bring-tag { background: var(--sand); color: var(--navy); font-size: 0.72rem; padding: 3px 8px; border-radius: 20px; border: 1px solid var(--sand-dark); }

/* DURATION */
.duration-bar { text-align: right; margin-top: 4px; }
.duration-label { font-size: 0.68rem; color: var(--text-light); font-weight: 500; }

/* ══ ALTERNATIVES — collapsible swipeable card row ══════════ */
.alts-details { margin-top: 8px; margin-bottom: 4px; border-radius: var(--radius-sm); overflow: hidden; }
.alts-summary { display: flex; align-items: center; gap: 6px; padding: 7px 10px; background: rgba(124,92,191,0.08); border: 1px solid rgba(124,92,191,0.18); border-radius: var(--radius-sm); font-size: 0.76rem; font-weight: 600; color: var(--purple); cursor: pointer; list-style: none; user-select: none; transition: background 0.2s; }
.alts-summary::-webkit-details-marker { display: none; }
.alts-details[open] .alts-summary { background: rgba(124,92,191,0.13); border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-bottom: none; }
.alts-chevron { margin-left: auto; font-size: 0.65rem; transition: transform 0.2s; color: var(--purple); opacity: 0.7; }
.alts-details[open] .alts-chevron { transform: rotate(180deg); }
.alts-body { display: flex; gap: 8px; padding: 10px; background: rgba(124,92,191,0.05); border: 1px solid rgba(124,92,191,0.14); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); overflow-x: auto; scrollbar-width: none; }
.alts-body::-webkit-scrollbar { display: none; }
.alt-card { flex-shrink: 0; width: 148px; background: var(--white); border: 1px solid rgba(124,92,191,0.15); border-radius: var(--radius-sm); padding: 10px; cursor: pointer; transition: box-shadow 0.2s, transform 0.15s; }
.alt-card:active { box-shadow: var(--shadow-md); transform: scale(0.98); }
.alt-emoji { font-size: 1.4rem; margin-bottom: 4px; display: block; }
.alt-name { font-family: var(--font-serif); font-size: 0.82rem; font-weight: 600; color: var(--navy); line-height: 1.2; margin-bottom: 3px; }
.alt-desc { font-size: 0.71rem; color: var(--text-light); line-height: 1.35; }
.alt-tag { display: inline-block; margin-top: 5px; font-size: 0.63rem; font-weight: 600; padding: 2px 6px; border-radius: 20px; background: rgba(124,92,191,0.1); color: var(--purple); }

/* ══ MEMORY CHECKBOX ════════════════════════════════════════ */
.memory-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; background: rgba(233,168,76,0.07); border: 1px dashed rgba(233,168,76,0.4); border-radius: var(--radius-sm); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background 0.2s; }
.memory-row:has(input:checked) { background: rgba(76,175,125,0.08); border-color: rgba(76,175,125,0.35); border-style: solid; }
.memory-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--green); flex-shrink: 0; cursor: pointer; }
.memory-label { font-size: 0.75rem; color: var(--text-mid); line-height: 1.3; flex: 1; }
.memory-row:has(input:checked) .memory-label { color: #1a6642; font-weight: 500; }
.memory-done { display: none; font-size: 0.9rem; }
.memory-row:has(input:checked) .memory-done { display: inline; }
.memory-row:has(input:checked) .memory-prompt { display: none; }

/* BUDGET CARD */
.budget-card { margin: 0 12px 24px; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%); border-radius: var(--radius); padding: 18px; max-width: 616px; }
.budget-title { font-family: var(--font-serif); font-size: 1rem; color: var(--white); margin-bottom: 14px; }
.budget-rows { display: flex; flex-direction: column; gap: 8px; }
.budget-row { display: flex; justify-content: space-between; font-size: 0.82rem; color: rgba(255,255,255,0.7); border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 8px; }
.budget-row:last-child { border-bottom: none; padding-bottom: 0; }
.budget-row.total { color: var(--white); font-weight: 700; font-size: 0.9rem; border-top: 1px solid rgba(255,255,255,0.2); padding-top: 10px; margin-top: 2px; }

/* PACK LIST */
.pack-header { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%); padding: 24px 20px 20px; text-align: center; }
.pack-title { font-family: var(--font-serif); font-size: 1.4rem; color: var(--white); margin-bottom: 4px; }
.pack-sub { font-size: 0.78rem; color: rgba(255,255,255,0.55); margin-bottom: 14px; }
.progress-bar-wrap { background: rgba(255,255,255,0.12); border-radius: 20px; height: 8px; overflow: hidden; margin-bottom: 6px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--teal), var(--green)); border-radius: 20px; width: 0%; transition: width 0.4s ease; }
.progress-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); margin-bottom: 12px; }
.reset-btn { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); font-size: 0.75rem; padding: 5px 14px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.15); }
.reset-btn:active { background: rgba(255,255,255,0.2); }
.pack-sections { padding: 12px 12px 32px; max-width: 640px; margin: 0 auto; }
.pack-section { margin-bottom: 20px; }
.pack-section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-light); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.pack-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer; transition: all 0.2s; -webkit-tap-highlight-color: transparent; }
.pack-item:active { transform: scale(0.99); }
.pack-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--teal); flex-shrink: 0; margin-top: 1px; cursor: pointer; }
.pack-item span { font-size: 0.83rem; color: var(--text-mid); line-height: 1.4; transition: all 0.2s; }
.pack-item:has(input:checked) span { text-decoration: line-through; color: var(--text-light); opacity: 0.6; }
.pack-item:has(input:checked) { background: rgba(76,175,125,0.05); border-color: rgba(76,175,125,0.2); }

/* MAP MODAL */
.map-modal { position: fixed; inset: 0; background: rgba(10,37,64,0.75); z-index: 200; display: flex; align-items: flex-end; backdrop-filter: blur(4px); animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.map-modal-content { background: var(--white); border-radius: var(--radius) var(--radius) 0 0; padding: 20px; padding-bottom: calc(20px + var(--safe-bottom)); width: 100%; animation: slideUp 0.25s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.map-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.map-modal-title { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 600; color: var(--navy); }
.map-close { color: var(--text-light); font-size: 1.1rem; padding: 4px 8px; }
.map-buttons { display: flex; flex-direction: column; gap: 10px; }
.map-action-btn { display: block; text-align: center; padding: 13px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; text-decoration: none; transition: opacity 0.2s; }
.map-action-btn:active { opacity: 0.8; }
.map-action-btn.google { background: var(--navy); color: var(--white); }
.map-action-btn.apple { background: var(--sand); color: var(--navy); border: 1px solid var(--sand-dark); }
.map-hint { text-align: center; font-size: 0.72rem; color: var(--text-light); margin-top: 10px; }

[hidden] { display: none !important; }
