/* ═══════════════════════════════════════════════════════════
   MDW 2026 — Planner page styles
   Reuses :root vars from app.css
   ═══════════════════════════════════════════════════════════ */

body {
  min-height: 100dvh;
  height: auto;
  overflow: auto;
  /* Space for the fixed .export-bar (56px content + safe-area bottom).
     On mobile the .mobile-nav adds another ~56px — see @media below. */
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

/* ─── Top bar ─── */

.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  /* iPhone notch / Dynamic Island: pad top by safe-area.
     Left/right: safe-area for landscape orientations. */
  padding:
    calc(14px + env(safe-area-inset-top, 0px))
    calc(24px + env(safe-area-inset-right, 0px))
    14px
    calc(24px + env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  gap: 20px;
}
.top-bar h1 { font-size: 16px; font-weight: 600; flex: 0 0 auto; }
.top-bar h1 span { color: var(--accent); }
.top-bar a {
  color: var(--text2);
  text-decoration: none;
  font-size: 12px;
  flex: 0 0 auto;
}
.top-bar a:hover { color: var(--text); }
/* Brand link in planner top-bar uses the same .brand styles as index;
   override text-color hover so it doesn't inherit the generic a:hover. */
.top-bar a.brand { color: var(--text); }
.top-bar a.brand:hover { color: var(--text); }
/* Auth button (injected by auth.js) sits at the right edge */
.top-bar .auth-wrap { margin-left: auto; }

/* ─── Summary cards ─── */

.summary-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.stat-card {
  flex: 1 1 0;              /* fill evenly — never overflow */
  min-width: 0;             /* allow shrink below content size */
  padding: 10px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
}
@media (min-width: 640px) {
  .summary-bar { gap: 16px; padding: 16px 24px; }
  .stat-card { padding: 12px 20px; }
}
.stat-card .num {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.stat-card .label {
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
  margin-top: 4px;
}
.stat-like .num     { color: var(--c-like); }
.stat-bookmark .num { color: var(--c-bookmark); }
.stat-planned .num  { color: var(--c-planned); }
.stat-visited .num  { color: var(--c-visited); }

/* ─── Tabs ─── */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 0
          calc(24px + env(safe-area-inset-right, 0px))
          0
          calc(24px + env(safe-area-inset-left, 0px));
  margin-top: -1px;
  background: var(--surface);
  /* Sticky below the natural top-bar — tab switch stays one tap away
     while the plan content scrolls underneath. */
  position: sticky;
  top: 0;
  z-index: 15;
  /* If narrow viewport + translated tab labels overflow, allow horizontal scroll */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  white-space: nowrap;  /* prevent label wrap */
  flex: 0 0 auto;
}
.tab {
  padding: 10px 20px;
  font-family: inherit;
  font-size: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text2);
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── Content ─── */

.content { padding: 24px; max-width: 1100px; margin: 0 auto; }

.section { margin-bottom: 32px; }
.section h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section h2 .count { color: var(--text2); font-weight: normal; }

/* ─── Info tab ─── */

.info-tab {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.info-section h2 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text2);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.info-section p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}
.info-legal-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.info-legal-links li { flex: 0 0 auto; }
.info-legal-links a {
  display: inline-block;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.info-legal-links a:hover {
  border-color: var(--accent);
  background: var(--surface2);
  color: var(--accent);
}
.info-operator {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.7;
}
.info-operator strong { color: var(--text); }
.info-mono {
  font-family: 'SF Mono', monospace;
  font-size: 11px;
  opacity: 0.85;
}
.info-disclaimer p {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.6;
  font-style: italic;
  padding: 12px 16px;
  background: var(--surface);
  border-left: 3px solid var(--border);
  border-radius: 0 4px 4px 0;
}

/* ─── Timeline (day view) ─── */

.day-section { margin-bottom: 24px; }
.day-header {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--c-planned);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.day-route-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.day-route-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.day-route-btn .icon { display: inline-flex; width: 12px; height: 12px; }
.day-route-btn svg { width: 12px; height: 12px; }

.timeline {
  position: relative;
  padding-left: 20px;
  border-left: 2px solid var(--border);
}
.timeline-item {
  position: relative;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}
.timeline-item:hover { border-color: var(--text2); }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-planned);
  border: 2px solid var(--bg);
}
.timeline-item.is-visited::before { background: var(--c-visited); }
.tl-time  { font-size: 11px; color: var(--accent); font-weight: 600; }
.tl-title { font-size: 12px; margin-top: 2px; }
.tl-venue { font-size: 10px; color: var(--text2); }
.tl-notes { font-size: 10px; color: var(--text2); margin-top: 4px; font-style: italic; }
.tl-directions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 2px 8px 2px 6px;
  font-size: 10px;
  color: var(--text2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tl-directions:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.tl-directions .icon { display: inline-flex; width: 10px; height: 10px; }
.tl-directions svg { width: 10px; height: 10px; }

/* ─── List items (Liked/Bookmarked/Visited) ─── */

.ev-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.ev-list-item:hover { background: var(--surface2); }
.ev-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ev-list-dot-like     { background: var(--c-like); }
.ev-list-dot-bookmark { background: var(--c-bookmark); }
.ev-list-dot-visited  { background: var(--c-visited); }
.ev-list-title { font-size: 12px; flex: 1; }
.ev-list-venue { font-size: 10px; color: var(--text2); }
.ev-list-remove {
  font-size: 10px;
  color: var(--text2);
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  font-family: inherit;
}
.ev-list-remove:hover { border-color: var(--c-like); color: var(--c-like); }

.star-display { color: var(--c-bookmark); font-size: 11px; }

/* ─── Team cards ─── */

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.team-card:hover { border-color: var(--accent); }
.team-card .tc-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.team-card .tc-role {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 2px;
  display: inline-block;
  text-transform: uppercase;
  margin-left: 6px;
}
.team-card .tc-role.owner  { background: var(--accent); color: var(--bg); }
.team-card .tc-role.member { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.team-card .tc-desc {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 8px;
  line-height: 1.4;
}
.team-card .tc-meta {
  font-size: 10px;
  color: var(--text2);
  display: flex;
  justify-content: space-between;
}
.team-card .tc-code {
  font-family: 'SF Mono', monospace;
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 2px;
  color: var(--accent);
}

.create-team-card {
  border: 1px dashed var(--border);
  text-align: center;
  padding: 20px;
  background: transparent;
}
.create-team-card:hover { border-color: var(--accent); }

/* ─── Connections list ─── */

.connection-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.conn-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}
.conn-info { flex: 1; }
.conn-name { font-size: 12px; }
.conn-meta { font-size: 10px; color: var(--text2); }

/* ─── Modals ─── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
  /* M4: scroll when content exceeds viewport (Team Created + QR + conn list) */
  max-height: 90dvh;
  overflow-y: auto;
}
.modal-box h3 { font-size: 14px; margin-bottom: 12px; }
.modal-box input, .modal-box textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  margin-bottom: 10px;
}
.modal-box input:focus, .modal-box textarea:focus { border-color: var(--accent); }
.modal-box textarea { height: 60px; resize: vertical; }
.modal-box label {
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 3px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.modal-btn-primary {
  flex: 1;
  padding: 10px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.modal-btn-secondary {
  padding: 10px 16px;
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.modal-invite-code {
  font-family: 'SF Mono', monospace;
  font-size: 20px;
  color: var(--accent);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 4px;
  text-align: center;
  letter-spacing: 2px;
  margin: 12px 0;
  cursor: pointer;
}
.modal-invite-code:hover { border-color: var(--accent); }

/* Bulk add connections */
.tc-conn-header {
  font-size: 11px;
  color: var(--text2);
  margin: 16px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tc-conn-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface2);
}
.tc-conn-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 11px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.tc-conn-item:last-child { border-bottom: none; }
.tc-conn-item:hover { background: var(--surface); }
.tc-conn-item input { accent-color: var(--accent); cursor: pointer; }
.tc-conn-item .conn-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}
.tc-conn-item .tc-conn-meta {
  color: var(--text2);
  font-size: 10px;
  margin-left: auto;
}
.modal-msg {
  font-size: 11px;
  margin-top: 8px;
  padding: 6px;
  border-radius: 3px;
  display: none;
}
.modal-msg.show { display: block; }
.modal-msg.error   { background: #ff6b6b22; color: var(--c-like); }
.modal-msg.success { background: #4ecdc422; color: var(--c-planned); }

/* ─── Export bar (fixed bottom) ─── */

.export-bar {
  /* Safe-area for home indicator (bottom) + landscape insets (left/right) */
  padding:
    12px
    calc(16px + env(safe-area-inset-right, 0px))
    calc(12px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 8px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  /* 6 buttons can overflow narrow viewports — scroll horizontally */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.export-bar::-webkit-scrollbar { display: none; }
.export-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.export-btn {
  padding: 8px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  /* Align the Lucide SVG with the label text */
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.export-btn .icon { display: inline-flex; align-items: center; }
.export-btn .icon svg { width: 13px; height: 13px; display: block; }
.export-btn:hover { border-color: var(--accent); }
.export-btn-primary {
  /* Subtle accent tint instead of a solid accent fill — still visually
     the primary action, but doesn't blast the eye like solid #4ecdc4. */
  background: color-mix(in srgb, var(--accent) 14%, var(--surface2));
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  font-weight: 600;
}
.export-btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface2));
  border-color: var(--accent);
}

.export-btn-danger {
  color: var(--accent2, #ff6b6b);
  border-color: color-mix(in srgb, var(--accent2) 40%, var(--border));
}
.export-btn-danger:hover {
  background: color-mix(in srgb, var(--accent2) 12%, var(--surface2));
  border-color: var(--accent2, #ff6b6b);
}

.account-rights {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 14px 16px 16px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.account-rights .ar-label {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 8px;
  flex: 0 0 auto;
}
.account-rights[hidden] { display: none; }

/* ─── Empty / login states ─── */

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text2);
  font-size: 12px;
}
.empty-state a { color: var(--accent); }

.login-prompt {
  text-align: center;
  padding: 40px 20px;
  color: var(--text2);
  font-size: 12px;
}
.login-prompt a { color: var(--accent); cursor: pointer; }

/* ─── Activity feed ─── */

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.activity-row:hover { border-color: var(--accent); }
.activity-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}
.activity-info { flex: 1; min-width: 0; }
.activity-line {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
}
.activity-line strong { font-weight: 600; }
.activity-meta {
  font-size: 10px;
  color: var(--text2);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   Mobile overrides — iPhone design spec + compact layout
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .top-bar {
    padding:
      calc(12px + env(safe-area-inset-top, 0px))
      calc(14px + env(safe-area-inset-right, 0px))
      12px
      calc(14px + env(safe-area-inset-left, 0px));
    gap: 12px;
  }
  .top-bar h1 { font-size: 15px; }
  .top-bar a { font-size: 11px; }

  .summary-bar {
    padding: 10px 12px;
    gap: 6px;
  }
  .stat-card .num { font-size: 20px; }
  .stat-card .label { font-size: 9px; }

  .tabs {
    padding: 0 calc(12px + env(safe-area-inset-right, 0px))
            0 calc(12px + env(safe-area-inset-left, 0px));
  }
  .tab {
    padding: 10px 14px;
    font-size: 11px;
  }

  .content {
    padding: 16px 14px;
  }

  .export-bar {
    gap: 6px;
    /* Let all 6 buttons wrap to multiple rows instead of scrolling off
       the right edge where the hidden scrollbar makes them unreachable. */
    flex-wrap: wrap;
    overflow-x: visible;
    /* Sit ABOVE the mobile-nav (56px) + home-indicator safe-area.
       Without this the export-bar would overlap the nav. */
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    /* mobile-nav already covers the home-indicator; drop the safe-area
       padding on the export-bar so the two don't double up. */
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .export-btn {
    padding: 7px 10px;
    font-size: 11px;
    /* 3 buttons per row on narrow viewports — flex-grow lets them fill
       evenly without leaving awkward tail gaps. */
    flex: 1 1 calc(33.333% - 4px);
    min-width: 0;
    justify-content: center;
  }
  .export-btn .icon svg { width: 12px; height: 12px; }

  /* Planner page is not a CSS grid (unlike index.html), so the grid-row /
     grid-column rules from app.css are ignored. Pin the nav to the
     viewport bottom explicitly and make it span the full width. */
  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  /* Content clears BOTH bars. Export-bar wraps to 2 rows on mobile
     (2 × ~36px btn + 6px gap + 16px padding = ~94px); mobile-nav is
     56px + home-indicator safe-area. */
  body {
    padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  }

  /* M15: prevent iOS zoom-on-focus in planner modal inputs */
  .modal-box input,
  .modal-box textarea,
  .modal-box select {
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .top-bar h1 { font-size: 13px; }
  .top-bar a { font-size: 10px; }
  .stat-card .num { font-size: 18px; }
  .tab { padding: 9px 10px; }
  .export-btn { padding: 7px 10px; font-size: 10px; }
}
