/* Coastal Modern visual system - approved redesign direction: crisp,
   bright, contemporary; white card surfaces on a cool blue-grey page;
   deep ocean-blue text; restrained turquoise accents; strong card
   separation; generous but disciplined spacing; editorial type. No
   beige/muddy grey anywhere. Carries over Package 3's authentication,
   Joint Selection Mode, save-status, and conflict-modal states - this
   file restyles those, it does not remove or rename them. */
:root {
  --page: #F4F8FA;
  --card: #FFFFFF;
  --ink: #153C4D;       /* primary text */
  --muted: #526574;     /* secondary text */
  --accent: #087F8C;
  --accent-bright: #21A8B5;
  --line: #C7DBE3;       /* borders */
  --shadow: 0 2px 10px #153c4d14, 0 10px 28px #153c4d0f;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--page); }
h1, h2, h3 { letter-spacing: -0.02em; }
.hidden { display: none !important; }

/* --- Login screen -------------------------------------------------- */
#loginScreen { max-width: 420px; margin: 10vh auto; padding: 30px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
#loginScreen h1 { font-size: 25px; margin: 0 0 4px; color: var(--ink); }
#loginScreen p.lead { color: var(--muted); margin: 0 0 18px; }
#loginForm label { display: block; font-size: 12px; font-weight: 800; margin: 12px 0 4px; color: var(--muted); }
#loginForm select, #loginForm input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: var(--card); color: var(--ink); }
#loginError { color: #9b3b3b; font-size: 12px; min-height: 16px; margin-top: 8px; }
#sessionExpiredNotice { max-width: 420px; margin: 16px auto 0; padding: 10px 14px; background: #fff6e2; border: 1px solid #f0d9a0; border-radius: 10px; font-size: 12px; color: var(--ink); }

/* --- App shell -------------------------------------------------------- */
.appHeader { display: flex; align-items: center; gap: 16px; padding: 16px 22px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; scroll-margin-top: 0; }

/* --- Sticky section navigation ---------------------------------------- */
/* Compact, pill-link bar (same idea as legacy-site/index.html's own
   sticky nav) so a 300-attraction catalogue plus several panels below
   it stay reachable in one click. Plain hash links - no click handler,
   no renderCards() call - so navigating never re-renders the catalogue;
   the browser's own anchor-scrolling (and each target's
   scroll-margin-top below) keeps the destination heading clear of this
   bar once it is pinned to the top of the viewport. */
.sectionNav { position: sticky; top: 0; z-index: 40; display: flex; gap: 6px; align-items: center; padding: 8px 18px; background: #fafffcee; backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sectionNav a { flex-shrink: 0; text-decoration: none; white-space: nowrap; font-size: 11.5px; font-weight: 800; padding: 6px 11px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.sectionNav a:hover { border-color: var(--accent-bright); color: var(--accent); }
.sectionNav a:first-child { background: var(--page); color: var(--muted); }

/* Every nav target clears the sticky bar's height (its own padding +
   line-height, ~40px) when scrolled to, so the destination heading is
   never hidden underneath it. */
#section-attractions, #section-main-map, #scenicDrivesPanel, #railFerryPanel, #tripPanel, #placesDiscoveryPanel { scroll-margin-top: 48px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

.sectionBlock { margin: 0; }
.sectionHeading { font-size: 13px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin: 18px 18px 0; }
.map-layout .sectionHeading { margin: 0 0 8px; }
.profileBadge { font-weight: 850; color: var(--ink); }
.jointSwitch { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; cursor: pointer; color: var(--muted); }
.jointSwitch.readOnly { opacity: .55; cursor: not-allowed; }
.appHeader .btn { margin-left: auto; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.toolbar input, .toolbar select { border: 1px solid var(--line); border-radius: 9px; background: var(--page); color: var(--ink); padding: 9px 10px; min-height: 38px; font: inherit; }
.toolbar input[type=search] { min-width: 220px; flex: 1; }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 9px; padding: 9px 13px; font-weight: 750; font: inherit; cursor: pointer; transition: border-color .15s, color .15s; }
.btn:hover { border-color: var(--accent-bright); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); color: white; }
.btn:disabled { opacity: .5; cursor: default; }
.notice { padding: 12px 16px; background: var(--card); border-left: 4px solid var(--accent-bright); border-radius: 10px; line-height: 1.55; margin: 12px 18px; color: var(--ink); box-shadow: var(--shadow); }

/* --- Attraction cards: strong separation, Coastal Modern surfaces --- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; margin: 0 18px 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; min-width: 0; box-shadow: var(--shadow); }

/* Collapsed: one compact, scannable row - see COLLAPSED CARDS in the
   approved spec. Deliberately no empty sections/placeholders. */
.cardRow { display: flex; align-items: center; gap: 10px; padding: 13px 15px; }
.cardRowId { flex: 1; min-width: 0; }
.cardRowName { font-size: 14.5px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cardRowMeta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cardRowPrefs { display: flex; gap: 6px; flex-shrink: 0; }
.prefChip { font-size: 10.5px; font-weight: 750; color: var(--muted); background: var(--page); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; white-space: nowrap; }
.chevronBtn { border: none; background: none; color: var(--accent); font-weight: 800; font-size: 12px; cursor: pointer; padding: 6px 4px; flex-shrink: 0; white-space: nowrap; }
.chevronBtn:hover { color: var(--accent-bright); }

/* Expanded: visual hero first, then identity / preferences / actions. */
.cardMedia { display: flex; align-items: stretch; gap: 0; }
.cardPhoto { flex: 0 0 62%; min-width: 0; }
.cardMiniMap { flex: 0 0 38%; min-width: 0; }
.cardPhoto img { display: block; width: 100%; height: 220px; object-fit: cover; border-top-left-radius: 16px; }
.photoCredit { font-size: 9.5px; color: var(--muted); padding: 5px 10px 0; line-height: 1.4; }
.cardMiniMap .miniMapCanvas { height: 220px; background: #dce9ee; border-top-right-radius: 16px; }
.cardMedia .mediaPlaceholder { height: 220px; border-radius: 0; }
.cardMedia .cardPhoto .mediaPlaceholder { border-top-left-radius: 16px; }
.cardMedia .cardMiniMap .mediaPlaceholder { border-top-right-radius: 16px; }
.mediaPlaceholder { border: 1px dashed var(--line); background: var(--page); display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; }
.mediaPlaceholder span { font-size: 11px; color: var(--muted); font-weight: 700; }

.cardBody { padding: 15px 16px 16px; }
.identity { margin-bottom: 10px; }
.idMeta { font-size: 11px; font-weight: 750; letter-spacing: .02em; color: var(--muted); text-transform: uppercase; }
.idName { font-size: 18px; font-weight: 850; color: var(--ink); margin: 3px 0 6px; letter-spacing: -0.01em; }
.idDesc { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin: 0; }

.prefsSection { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.prefsSection .dual { flex: 1; min-width: 0; }
.mapGroupChip { border: 1px solid var(--line); background: var(--page); color: var(--ink); font-size: 11.5px; font-weight: 750; border-radius: 20px; padding: 7px 13px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.mapGroupChip:hover { border-color: var(--accent-bright); }
.mapGroupChip.active { background: var(--accent); border-color: var(--accent); color: white; }
.joint { font-size: 11.5px; color: var(--accent); font-weight: 700; margin: 2px 0 12px; }

.actionsRow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
.linkAction { font-size: 12px; font-weight: 750; color: var(--accent); text-decoration: none; background: none; border: none; cursor: pointer; padding: 0; font-family: inherit; }
.linkAction:hover { color: var(--accent-bright); text-decoration: underline; }
.linkAction.asButton { margin-left: 0; }

.dual { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.person { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--page); }
.person.readOnly { background: #eef1f2; }
.person label { display: block; font-size: 10.5px; font-weight: 850; margin-bottom: 5px; color: var(--muted); }
.person select { width: 100%; min-width: 0; padding: 7px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.saveStatus { display: block; font-size: 10px; color: var(--muted); min-height: 14px; margin-top: 3px; cursor: default; }
.pill { font-size: 10px; padding: 4px 6px; background: var(--page); border: 1px solid var(--line); border-radius: 6px; font-weight: 750; display: inline-block; margin-top: 4px; color: var(--muted); }

.imageUrlEditor { margin: 12px 0 0; padding: 10px 11px; background: var(--page); border: 1px solid var(--line); border-radius: 10px; }
.imageUrlEditor label { display: block; font-size: 10px; font-weight: 800; color: var(--muted); margin-bottom: 5px; }
.imageUrlRow { display: flex; gap: 6px; flex-wrap: wrap; }
.imageUrlRow input { flex: 1; min-width: 160px; padding: 7px; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: 12px; background: var(--card); color: var(--ink); }
.imageUrlError { font-size: 11px; color: #9b3b3b; min-height: 14px; margin-top: 4px; }

.smallmap { height: 180px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 12px 0 0; }
.smallmap iframe { width: 100%; height: 100%; border: 0; }

/* Leaflet's default attribution control is sized for a full-page map;
   at card-mini-map size its default font/padding eats a
   disproportionate share of the map. Keep the required credit text
   fully visible, just compact and pinned along the bottom edge. */
.leaflet-control-attribution { font-size: 9px; line-height: 1.3; padding: 1px 5px; background: rgba(255, 255, 255, 0.82); }
.cardMiniMap .leaflet-control-attribution { max-width: 100%; white-space: normal; }

/* --- Global panels (map group, scenic drives, rail/ferry, trip, Google discovery) --- */
.map-layout { display: grid; grid-template-columns: 340px 1fr; gap: 14px; align-items: start; margin: 18px; }
.side { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; max-height: 660px; overflow: auto; box-shadow: var(--shadow); }
.mapControls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mapControls select { border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; font: inherit; background: var(--card); color: var(--ink); }
.mapControls .notice { margin: 0; }
#atlasMap { height: 660px; border-radius: 16px; border: 1px solid var(--line); background: #dce9ee; }
.drive { padding: 9px 0; border-bottom: 1px solid var(--line); }
.drive .tit { font-weight: 800; font-size: 12px; color: var(--ink); }
.drive small { color: var(--muted); }
.drive a { font-size: 11px; color: var(--accent); }
.help { font-size: 12px; color: var(--muted); line-height: 1.6; }
.mapgroup { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 18px; box-shadow: var(--shadow); }
.mapgroup h3 { color: var(--ink); margin-top: 0; }
.mapgroup label { display: block; font-size: 12px; font-weight: 700; margin: 8px 0 4px; color: var(--muted); }
.mapgroup input[type=date], .mapgroup input[type=text] { padding: 8px; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: var(--page); color: var(--ink); }

/* --- Conflict modal -------------------------------------------------- */
.conflictBackdrop { position: fixed; inset: 0; background: #0f2a3399; display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.conflictModal { background: var(--card); border-radius: 16px; max-width: 480px; padding: 22px; box-shadow: var(--shadow); color: var(--ink); }
.conflictModal h3 { margin-top: 0; }

/* --- Add/edit custom attraction modal ---------------------------------- */
.customAttractionModal { max-width: 460px; max-height: 90vh; overflow: auto; }
.customAttractionModal label { display: block; font-size: 11px; font-weight: 800; color: var(--muted); margin: 12px 0 4px; }
.customAttractionModal input, .customAttractionModal select, .customAttractionModal textarea { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--page); color: var(--ink); }
.customAttractionModal textarea { resize: vertical; }
.caLocationRow { display: flex; gap: 6px; flex-wrap: wrap; }
.caLocationRow input { flex: 1; min-width: 100px; }
.caLocationRow .btn { flex-shrink: 0; }
#caPickMapWrap { margin-top: 8px; }
#caPickMap { height: 220px; border-radius: 10px; border: 1px solid var(--line); background: #dce9ee; }

/* Edit/Delete on a custom attraction - secondary, never styled like the primary action row above it. */
.customOwnerRow { display: flex; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.customOwnerRow .linkAction { font-size: 11px; color: var(--muted); }
.customOwnerRow .linkAction.danger { color: #9b3b3b; }
.customOwnerRow .linkAction:hover { color: var(--accent); }
.customOwnerRow .linkAction.danger:hover { color: #c24b4b; }

@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .map-layout { grid-template-columns: 1fr; }
  .side { max-height: 420px; }
}
@media (max-width: 760px) {
  .cardMedia { flex-direction: column; }
  .cardPhoto, .cardMiniMap { flex: 1 1 auto; }
  .cardPhoto img, .cardMiniMap .miniMapCanvas, .cardMedia .mediaPlaceholder { height: 200px; border-radius: 0; }
  .cardPhoto img { border-top-left-radius: 16px; border-top-right-radius: 16px; }
  .cardMiniMap .miniMapCanvas, .cardMedia .cardMiniMap .mediaPlaceholder { border-radius: 0; }
}
@media (max-width: 620px) {
  .cards { grid-template-columns: 1fr; margin: 0 12px 16px; }
  #atlasMap { height: 420px; }
  .cardRow { flex-wrap: wrap; }
  .cardRowPrefs { order: 3; width: 100%; }
  .prefsSection { flex-direction: column; align-items: stretch; }
  .mapGroupChip { width: 100%; text-align: center; }
  .actionsRow { gap: 10px 14px; }
}
