/* ========================================================
   EVOLVE Maui — Shared Brand Styles
   Import in any webapp: <link rel="stylesheet" href="shared.css">
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  /* Brand Palette */
  --navy: #04152F;
  --indigo: #2F3192;
  --cyan: #14FFFF;
  --pink: #FF2D78;
  --blue: #4F5BD5;
  --gold: #FFD700;
  --white: #FFFFFF;
  --black: #000000;

  /* UI Surfaces */
  --dark-card: #0a1e3d;
  --dark-input: #0d2648;
  --border: rgba(79, 91, 213, 0.3);
  --text-muted: #8899bb;

  /* Semantic */
  --success: #00cc66;
  --danger: #cc1144;
  --danger-bg: #991133;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Touch targets (Apple HIG minimum) */
  --touch-target: 44px;
}

/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
}

/* ---- Header ---- */
.header {
  background: var(--black);
  border-bottom: 2px solid var(--cyan);
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.header h1 {
  font-size: 24px; font-weight: 800;
  background: var(--cyan);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.header-nav {
  display: flex; gap: 6px; align-items: center;
}
.header-nav a {
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 600;
  padding: 5px 10px; border-radius: 6px;
  transition: all 0.2s;
}
.header-nav a:hover { color: var(--cyan); background: rgba(20,255,255,0.08); }
.header-nav a.active { color: var(--cyan); }

/* ---- Buttons ---- */
.btn {
  padding: 8px 16px; border: none; border-radius: 8px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.btn-cyan { background: var(--cyan); color: var(--black); }
.btn-cyan:hover { background: #00e0e0; }
.btn-pink { background: var(--pink); color: var(--white); }
.btn-pink:hover { background: #e6266c; }
.btn-gold { background: var(--gold); color: var(--black); }
.btn-gold:hover { background: #e6c200; }
.btn-blue { background: var(--blue); color: var(--white); }
.btn-blue:hover { background: #3a45b8; }
.btn-outline { background: transparent; color: var(--cyan); border: 1px solid var(--cyan); }
.btn-outline:hover { background: rgba(20, 255, 255, 0.1); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--danger-bg); color: var(--white); }
.btn-danger:hover { background: var(--danger); }

/* ---- Cards ---- */
.card {
  background: var(--dark-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-bottom: 16px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.card-title { font-size: 18px; font-weight: 700; }

/* ---- Container ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 0; padding: 0 24px;
  background: rgba(10, 30, 61, 0.8);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 14px 20px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s; white-space: nowrap;
}
.tab:hover { color: var(--white); }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ---- Forms ---- */
.form-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 180px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; min-width: 0; padding: 10px 12px;
  background: var(--dark-input); color: var(--white);
  border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 14px; transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--cyan);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: #556688; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px; font-size: 14px;
  border-bottom: 1px solid rgba(79, 91, 213, 0.15); vertical-align: middle;
}
tr:hover td { background: rgba(20, 255, 255, 0.03); }

/* ---- Badges ---- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-cyan { background: rgba(20, 255, 255, 0.15); color: var(--cyan); }
.badge-gold { background: rgba(255, 215, 0, 0.15); color: var(--gold); }
.badge-blue { background: rgba(79, 91, 213, 0.2); color: #8890dd; }
.badge-muted { background: rgba(136, 153, 187, 0.1); color: var(--text-muted); }
.badge-success { background: rgba(0, 200, 100, 0.15); color: var(--success); }
.badge-pink { background: rgba(255, 45, 120, 0.15); color: var(--pink); }

/* ---- Save Status ---- */
.save-status {
  font-size: 11px; color: var(--text-muted); padding: 4px 10px;
  border-radius: 20px; background: rgba(20,255,255,0.06);
}
.save-status.saved { color: var(--success); }

/* ---- Utility ---- */
.text-cyan { color: var(--cyan); }
.text-pink { color: var(--pink); }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.gradient-text {
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.view { display: none; }
.view.active { display: block; }

/* ---- App Switcher Nav ---- */
.nav-toggle {
  background: transparent; color: var(--cyan); border: 1px solid var(--cyan);
  border-radius: 8px; width: 36px; height: 36px; cursor: pointer;
  font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.nav-toggle:hover { background: rgba(20,255,255,0.12); }
.nav-toggle.floating { position: fixed; top: 16px; left: 16px; z-index: 140; background: var(--dark-card); }

.nav-overlay {
  position: fixed; inset: 0; background: rgba(4,21,47,0.7);
  z-index: 150; opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

.nav-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px;
  background: var(--dark-card); border-right: 2px solid var(--cyan);
  z-index: 151; transform: translateX(-100%); transition: transform 0.25s ease;
  display: flex; flex-direction: column; padding: 20px;
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.nav-drawer-title { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.nav-drawer-close {
  background: transparent; color: var(--text-muted); border: none;
  font-size: 24px; cursor: pointer; line-height: 1; padding: 4px 8px;
}
.nav-drawer-close:hover { color: var(--cyan); }

.nav-drawer-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  color: var(--white); text-decoration: none; border-radius: 10px;
  font-size: 14px; font-weight: 600; transition: background 0.15s;
  margin-bottom: 4px;
}
.nav-drawer-link:hover { background: rgba(20,255,255,0.08); }
.nav-drawer-link.active { background: rgba(20,255,255,0.15); color: var(--cyan); }
.nav-drawer-link-icon { font-size: 20px; line-height: 1; }

/* ---- Modal (shared scaffold) ---- */
/* Static modals: <div class="modal-overlay" id="x"><div class="modal-content">…</div></div>
   Dynamic modals: <div class="modal-overlay" id="modal"><div class="modal-content">
                     <button class="modal-close-btn" data-close="modal">×</button>
                     <div id="modalContent"></div></div></div>                              */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(4, 21, 47, 0.85);
  z-index: 200; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal-content {
  background: var(--dark-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
  width: 100%; max-width: 720px; max-height: 85vh; overflow-y: auto;
}
.modal-content h2 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.modal-field { margin-bottom: 14px; }
.modal-field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.modal-field input, .modal-field select {
  width: 100%; min-width: 0; padding: 12px 14px;
  background: var(--dark-input); color: var(--white);
  border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 15px;
}
.modal-field input:focus, .modal-field select:focus { outline: none; border-color: var(--cyan); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-close-btn {
  float: right; background: none; border: none;
  color: var(--text-muted); font-size: 24px; cursor: pointer; padding: 0 4px;
}
.modal-close-btn:hover { color: var(--cyan); }
/* Legacy alias — historically each page styled `.modal` directly. */
.modal { /* same as .modal-content */
  background: var(--dark-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
  width: 100%; max-width: 720px; max-height: 85vh; overflow-y: auto;
}
.modal h2 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }

/* ---- Toast (centered, brand-gold) ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--dark-card); border: 1px solid var(--gold); color: var(--gold);
  padding: 12px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 500; z-index: 300;
  opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 90%; text-align: center; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---- Needs-DB placeholder ---- */
.needs-db {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted); font-size: 14px;
  background: var(--dark-card); border: 1px dashed var(--border);
  border-radius: 12px; margin: 32px auto; max-width: 600px;
}

/* ---- Empty-state ---- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { font-size: 22px; margin-bottom: 8px; color: var(--white); }
.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* ---- Opener-row (shared between events + checklist + ohana lineups) ---- */
.opener-rows { display: flex; flex-direction: column; gap: 6px; }
.opener-row { display: flex; gap: 6px; align-items: center; }
.opener-row input { flex: 1; }
.opener-row .remove-opener {
  background: rgba(255,45,120,0.1); color: var(--pink);
  border: 1px solid transparent; border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer; font-size: 16px; font-weight: 700;
}
.opener-row .remove-opener:hover { border-color: var(--pink); }

/* ---- Split Panel Layout (opt-in: wrap content in .split-layout) ---- */
.split-layout {
  display: block;
}
@media (min-width: 768px) {
  .split-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - 70px);
    align-items: start;
  }
  .split-sidebar {
    border-right: 1px solid var(--border);
    overflow-y: auto;
    height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
  }
}
@media (min-width: 1200px) {
  .split-layout {
    grid-template-columns: 320px 1fr;
  }
}

/* ---- Bottom Tab Bar (phone only) ---- */
.bottom-tabs {
  display: none;
}

/* ---- More Sheet ---- */
.more-sheet-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(4, 21, 47, 0.7);
  z-index: 250;
  align-items: flex-end;
}
.more-sheet-overlay.open { display: flex; }
.more-sheet {
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  width: 100%;
  padding: 0 0 calc(16px + env(safe-area-inset-bottom));
}
.more-sheet::before {
  content: '';
  display: block;
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto;
}
.more-sheet-title {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.more-sheet-link {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  color: var(--white); text-decoration: none;
  font-size: 15px; font-weight: 600;
  min-height: var(--touch-target);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.more-sheet-link:hover { background: rgba(20, 255, 255, 0.08); }
.more-sheet-link-icon { font-size: 22px; }

/* Ohana people list: compact summary + expand-all control are mobile-only.
   Hidden on desktop so the full table renders unchanged. */
.people-table .person-summary { display: none; }
.people-toggle-all { display: none; }

/* ---- Tablet (768–1199px) ---- */
@media (min-width: 768px) and (max-width: 1199px) {
  .container { padding: 20px; }
  .header { padding: 16px 20px; }
}

/* ---- Phone (< 768px) ---- */
@media (max-width: 767px) {
  /* Layout */
  .header { padding: 12px 16px; }
  .header h1 { font-size: 20px; }
  .container { padding: var(--space-md); }
  .form-group { min-width: 100%; }

  /* Push all content above the bottom tab bar */
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* Minimum touch targets */
  .btn { min-height: var(--touch-target); }

  /* Hide hamburger — bottom tabs handle navigation on phone */
  .nav-toggle { display: none !important; }

  /* Toast sits above tab bar */
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

  /* --- Modal → Bottom Sheet --- */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-content, .modal {
    border-radius: 20px 20px 0 0;
    max-height: 75vh;
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-y: auto;
    position: relative;
  }
  /* Drag handle pill */
  .modal-content::before, .modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 8px auto 16px;
    flex-shrink: 0;
  }

  /* --- Table → Card Transform --- */
  .table-wrap { overflow-x: visible; }
  table thead { display: none; }
  table tr {
    display: block;
    background: var(--dark-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 4px 0;
    overflow: hidden;
  }
  table td {
    display: block;
    text-align: right;
    padding: 9px 16px;
    border-bottom: 1px solid rgba(79, 91, 213, 0.1);
    font-size: 13px;
    overflow: hidden;
  }
  table td:last-child { border-bottom: none; }
  table td::before {
    content: attr(data-label);
    float: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.6;
    margin-right: 8px;
  }
  table td::after { content: ''; display: table; clear: both; }
  /* Suppress hover row tint on cards */
  tr:hover td { background: transparent; }

  /* Actions cell: full-width button row at card bottom */
  .table-actions-cell {
    display: flex !important;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 16px 8px;
    border-top: 1px solid rgba(79, 91, 213, 0.1);
    border-bottom: none !important;
  }
  .table-actions-cell::before { display: none !important; }

  /* --- Ohana people list: collapse/expand (scoped to .people-table only) --- */
  /* Show the compact summary line; suppress its data-label pseudo-element. */
  .people-table .person-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    font-weight: 600;
  }
  .people-table .person-summary::before { display: none; }
  .people-table .person-summary .ps-name { flex: 1; }
  .people-table .person-summary .ps-shows { color: var(--text-muted); font-weight: 400; font-size: 12px; }

  /* Collapsed: show only the summary line, hide all detail cells + actions. */
  .people-table tr.is-collapsed > td { display: none; }
  .people-table tr.is-collapsed > td.person-summary { display: flex; }

  /* Expanded: hide the summary line, full card detail cells show as normal. */
  .people-table tr:not(.is-collapsed) > td.person-summary { display: none; }

  /* The name in the expanded card collapses the row when tapped. */
  .people-table .person-name-toggle { cursor: pointer; }

  /* Expand all / collapse all control is visible on mobile. */
  .people-toggle-all { display: inline-flex; }

  /* --- Split Panel: master-detail --- */
  .split-layout { display: block; }
  .split-sidebar { display: block; }
  .split-main { display: none; }
  .split-layout.detail-active .split-sidebar { display: none; }
  .split-layout.detail-active .split-main { display: block; }

  /* --- Bottom Tab Bar --- */
  .bottom-tabs {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(4, 21, 47, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 110;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    min-height: var(--touch-target);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-tab:hover, .bottom-tab.active { color: var(--cyan); }
  .bottom-tab-icon { font-size: 22px; line-height: 1; }
}
