/* ═══════════════════════════════════════════════════════════════
   The Welcome Book — Guest View Design System
   v.thewelcomebook.com
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS Variables (--primary set by PHP inline style) ─── */
:root {
  --primary: #50A3D4;
  --primary-light: #EBF5FB;
  --primary-dark: #2980B9;
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface-warm: #F8F6F1;
  --text: #1C1917;
  --text-secondary: #78716C;
  --text-tertiary: #A8A29E;
  --border: #E7E5E4;
  --border-light: #F5F5F4;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  --nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ─── App Shell ─── */
.app-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--surface);
  position: relative;
  overflow-x: hidden;
}

/* ─── Hero Header ─── */
.hero { position: relative; height: 300px; overflow: hidden; }
.hero-image { width: 100%; height: 100%; object-fit: cover; }
.hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0) 35%, rgba(0,0,0,0.6) 100%);
}
.hero-content { position: absolute; bottom: 0; left: 0; right: 0; padding: 24px 20px; color: white; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 6px 12px; border-radius: 100px; font-size: 12px; font-weight: 600; margin-bottom: 10px;
}
.hero-name { font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.hero-address { font-size: 14px; opacity: 0.85; margin-top: 4px; }

/* ─── Quick Actions Bar (horizontal scroll) ─── */
.quick-actions {
  display: flex; gap: 8px; padding: 16px 20px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.quick-actions::-webkit-scrollbar { display: none; }
.quick-action {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 100px; font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; transition: all 0.15s ease; min-height: 44px;
}
.quick-action:active { transform: scale(0.96); background: var(--border-light); }
.quick-action svg { width: 18px; height: 18px; flex-shrink: 0; }
.quick-action.primary { background: var(--primary); border-color: var(--primary); color: white; }

/* ─── Section ─── */
.section { padding: 0 20px; margin-bottom: 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 18px; font-weight: 700; color: var(--text); }
.section-link { font-size: 14px; font-weight: 600; color: var(--primary); min-height: 44px; display: flex; align-items: center; }

/* ─── Cards ─── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: transform 0.15s ease;
}
.card:active { transform: scale(0.985); }
.card-body { padding: 16px; }

/* ─── Weather Widget ─── */
.weather-card {
  border-radius: var(--radius); padding: 20px; color: white;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #4A90D9 0%, #357ABD 50%, #2C6AA0 100%);
}
.weather-card::after {
  content: ''; position: absolute; top: -30px; right: -10px;
  width: 100px; height: 100px; background: rgba(255,255,255,0.08); border-radius: 50%;
}
.weather-main { display: flex; align-items: flex-start; justify-content: space-between; position: relative; z-index: 1; }
.weather-temp { font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.weather-desc { font-size: 15px; opacity: 0.85; text-transform: capitalize; margin-top: 2px; }
.weather-feels { font-size: 13px; opacity: 0.65; margin-top: 4px; }
.weather-icon { width: 64px; height: 64px; }
.weather-icon img { width: 100%; height: 100%; object-fit: contain; }
.weather-details {
  display: flex; gap: 16px; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.15); position: relative; z-index: 1;
}
.weather-detail { font-size: 13px; opacity: 0.8; }
.weather-detail strong { display: block; font-size: 14px; font-weight: 600; opacity: 1; }

/* ─── Tide Widget ─── */
.tide-card {
  border-radius: var(--radius); padding: 20px; color: white;
  background: linear-gradient(135deg, #1E3A5F 0%, #2B5278 50%, #1A4A6E 100%);
}
.tide-header { display: flex; align-items: flex-start; justify-content: space-between; }
.tide-height { font-size: 36px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.tide-status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.15); border-radius: 100px; padding: 4px 12px; font-size: 13px; font-weight: 600;
}
.tide-next { font-size: 13px; opacity: 0.7; margin-top: 12px; }
.tide-times {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12);
}
.tide-time-item { background: rgba(255,255,255,0.08); border-radius: 10px; padding: 10px 12px; text-align: center; }
.tide-time-label { font-size: 11px; font-weight: 600; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.05em; }
.tide-time-value { font-size: 16px; font-weight: 700; margin-top: 2px; }
.tide-time-height { font-size: 12px; opacity: 0.6; margin-top: 1px; }

/* ─── Info List ─── */
.info-list { border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--surface); }
.info-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  min-height: 56px; transition: background 0.1s ease;
}
.info-item:active { background: var(--border-light); }
.info-item + .info-item { border-top: 1px solid var(--border-light); }
.info-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.info-icon svg { width: 18px; height: 18px; }
.info-content { flex: 1; min-width: 0; }
.info-label { font-size: 15px; font-weight: 600; color: var(--text); }
.info-meta { font-size: 13px; color: var(--text-tertiary); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-chevron { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; }

/* ─── Category Pills ─── */
.cat-scroll {
  display: flex; gap: 8px; padding: 0 20px 16px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0; padding: 8px 16px; border-radius: 100px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all 0.15s ease; min-height: 40px;
}
.cat-pill.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ─── Place Cards ─── */
.place-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin: 0 20px 12px;
}
.place-img { width: 100%; height: 140px; object-fit: cover; background: var(--border-light); }
.place-body { padding: 14px 16px; }
.place-name { font-size: 16px; font-weight: 700; color: var(--text); }
.place-addr { font-size: 13px; color: var(--text-tertiary); margin-top: 3px; }
.place-rating { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: #F59E0B; margin-top: 8px; }
.place-actions { display: flex; gap: 8px; margin-top: 12px; }
.place-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 100px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  min-height: 36px; transition: all 0.15s ease;
}
.place-btn:active { background: var(--border-light); }
.place-btn svg { width: 14px; height: 14px; }

/* ─── Detail Pages ─── */
.detail-view {
  position: fixed; top: 0; bottom: 0; left: 0; right: 0;
  z-index: 40; background: var(--surface);
  width: 100%; max-width: 430px;
  margin-left: auto; margin-right: auto;
  overflow-y: auto;
  visibility: hidden; opacity: 0;
  transform: translateX(40px);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease, visibility 0.3s;
}
.detail-view.open { visibility: visible; opacity: 1; transform: translateX(0); }
.detail-header {
  position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px;
}
.detail-back {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background 0.15s ease;
}
.detail-back:active { background: var(--border-light); }
.detail-back svg { width: 20px; height: 20px; }
.detail-title { font-size: 17px; font-weight: 700; }
.detail-body { padding: 20px; padding-bottom: 40px; }
.detail-block {
  background: var(--surface-warm); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px;
}
.detail-block-label {
  font-size: 12px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px;
}
.detail-block-value { font-size: 17px; font-weight: 600; color: var(--text); }
.detail-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 8px 16px; border-radius: 100px;
  font-size: 13px; font-weight: 600; background: var(--primary); color: white; min-height: 36px;
}

/* ─── Tips Card ─── */
.tips-card {
  background: #FFFBEB; border: 1px solid #FDE68A; border-radius: var(--radius); padding: 16px;
}
.tips-icon { width: 32px; height: 32px; border-radius: 8px; background: #FEF3C7; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.tips-icon svg { width: 16px; height: 16px; color: #D97706; }
.tips-title { font-size: 14px; font-weight: 700; color: #92400E; margin-bottom: 6px; }
.tips-text { font-size: 14px; line-height: 1.6; color: #78350F; }

/* ─── Welcome Card ─── */
.welcome-card {
  background: var(--surface-warm); border-radius: var(--radius); padding: 20px;
  border: 1px solid var(--border-light);
}
.welcome-text { font-size: 15px; line-height: 1.7; color: var(--text-secondary); }

/* ─── Forecast Row ─── */
.forecast-scroll {
  display: flex; gap: 10px; padding: 0 20px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.forecast-scroll::-webkit-scrollbar { display: none; }
.forecast-item {
  flex-shrink: 0; text-align: center; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 80px;
}
.forecast-day { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.forecast-icon { width: 36px; height: 36px; margin: 6px auto; }
.forecast-icon img { width: 100%; height: 100%; }
.forecast-high { font-size: 16px; font-weight: 700; color: var(--text); }
.forecast-low { font-size: 13px; color: var(--text-tertiary); }

/* ─── Bottom Nav ─── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border); z-index: 50;
  padding-bottom: var(--safe-bottom);
}
.bottom-nav-inner { display: flex; justify-content: space-around; align-items: center; height: var(--nav-height); }
.nav-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; width: 64px; height: 100%; color: var(--text-tertiary); transition: color 0.15s ease;
}
.nav-tab svg { width: 22px; height: 22px; }
.nav-tab span { font-size: 10px; font-weight: 600; }
.nav-tab.active { color: var(--primary); }

/* ─── Views (SPA) ─── */
.view { display: none; padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px); }
.view.active { display: block; }

/* ─── Copy Toast ─── */
.copy-toast {
  position: fixed; bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: white; padding: 10px 20px; border-radius: 100px;
  font-size: 14px; font-weight: 600; opacity: 0; transition: all 0.3s ease;
  z-index: 100; pointer-events: none;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Divider ─── */
.divider { height: 8px; background: var(--bg); }

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  .detail-view { transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ─── Safe Area ─── */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
}
