/* ==========================================================================
   Voetbal Hub - Serene & Minimalist Design System
   Clean, Calm, and Readable (Apple / Modern Sports Style)
   ========================================================================== */

:root {
  /* Light Theme (Default - Soft & Calm) */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #f1f5f9;
  
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #059669;
  
  --primary: #059669;
  --primary-light: #ecfdf5;
  --primary-dark: #047857;
  
  --accent-veld: #10b981;
  --accent-zaal: #0284c7;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.08);
  
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Dark Theme (Gentle & Deep Slate) */
[data-theme="dark"] {
  --bg-main: #0b0f17;
  --bg-surface: #111726;
  --bg-card: #151e30;
  --bg-card-hover: #1b263d;
  --bg-input: #1a2336;
  
  --border: rgba(255, 255, 255, 0.09);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-focus: #10b981;
  
  --primary: #10b981;
  --primary-light: rgba(16, 185, 129, 0.15);
  --primary-dark: #059669;
  
  --accent-veld: #10b981;
  --accent-zaal: #38bdf8;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 580px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: relative;
}

/* ==========================================================================
   Zen Minimal Header
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-input);
  border-color: var(--text-dim);
}

/* ==========================================================================
   Collapsible Search Bar
   ========================================================================== */
.search-bar-container {
  padding: 10px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.search-bar-container.hidden {
  display: none !important;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  gap: 8px;
}

.search-icon {
  font-size: 13px;
  color: var(--text-dim);
}

#filter-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--text-main);
}

#filter-search-input::placeholder {
  color: var(--text-dim);
}

.btn-clear-search {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 2px;
}

.btn-clear-search.hidden {
  display: none !important;
}

/* ==========================================================================
   Single-Row Quiet Person Filter (Horizontal scrollable chips)
   ========================================================================== */
.family-bar {
  padding: 12px 18px 10px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.family-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.family-pills::-webkit-scrollbar {
  display: none;
}

.fam-chip {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.fam-chip:hover {
  color: var(--text-main);
  border-color: var(--text-dim);
}

.fam-chip.active {
  background: var(--text-main);
  color: var(--bg-surface);
  border-color: var(--text-main);
}

[data-theme="dark"] .fam-chip.active {
  background: var(--primary);
  color: #0b0f17;
  border-color: var(--primary);
}

/* Sub-pills (Alles / Veld / Zaal toggle when child has both) */
.sub-pills {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.sub-pills.hidden {
  display: none !important;
}

.sub-chip {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-chip.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: rgba(5, 150, 105, 0.3);
}

[data-theme="dark"] .sub-chip.active {
  background: rgba(16, 185, 129, 0.18);
  color: var(--primary);
  border-color: rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   Calm Tabs
   ========================================================================== */
.view-tabs {
  display: flex;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--text-main);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.tab-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-input);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.tab-btn.active .tab-count {
  background: var(--primary-light);
  color: var(--primary-dark);
}

[data-theme="dark"] .tab-btn.active .tab-count {
  background: rgba(16, 185, 129, 0.2);
  color: var(--primary);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 16px 18px 40px;
  background: var(--bg-main);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Loading & Empty States */
.state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Peaceful & Spacious Match Cards
   ========================================================================== */
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.date-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.date-header-clean {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 8px 2px 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-header-clean::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.match-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(5, 150, 105, 0.3);
}

/* Left accent bar (Green for Veld, Blue for Zaal) */
.match-card.card-veld {
  border-left: 3.5px solid var(--accent-veld);
}

.match-card.card-zaal {
  border-left: 3.5px solid var(--accent-zaal);
}

.match-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.match-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.match-time-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.match-sep {
  color: var(--text-dim);
}

.match-kid-text {
  font-weight: 600;
  color: var(--text-muted);
}

.match-type-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.type-veld {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.type-zaal {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
}

[data-theme="dark"] .type-veld {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

[data-theme="dark"] .type-zaal {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
}

.match-side-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

/* Matchup Stack (Clean & Spacious) */
.match-teams-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 9px;
  padding-left: 2px;
}

.match-team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-muted);
}

.match-team-row.my-team-row {
  color: var(--text-main);
  font-weight: 700;
}

.match-team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-vs-divider {
  display: none;
}

.match-venue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-dim);
}

.match-venue-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  max-width: 85%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.match-venue-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.match-route-arrow {
  color: var(--primary);
  font-size: 13px;
}

/* ==========================================================================
   Standings & Results
   ========================================================================== */
.standings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.standings-header {
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.standings-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.standings-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.data-table th {
  padding: 8px 10px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.data-table tr.highlight-row {
  background: var(--primary-light);
  font-weight: 700;
}

[data-theme="dark"] .data-table tr.highlight-row {
  background: rgba(16, 185, 129, 0.15);
}

/* Results & Players */
.results-list {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.result-score {
  font-weight: 700;
  color: var(--primary);
}

.players-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}

.players-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.players-header h4 {
  font-size: 14px;
  font-weight: 700;
}

.players-grid {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.player-name {
  color: var(--text-main);
  display: block;
}

.player-role {
  font-size: 11px;
  color: var(--text-dim);
}

/* ==========================================================================
   Options Menu Sheet Modal
   ========================================================================== */
.menu-sheet {
  max-width: 440px !important;
  border-radius: var(--radius-lg) !important;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: var(--font-family);
  transition: all 0.15s ease;
}

.menu-item:hover {
  background: var(--bg-input);
  border-color: var(--border);
}

.menu-item-icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu-item-text {
  display: flex;
  flex-direction: column;
}

.menu-item-text strong {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 600;
}

.menu-item-text span {
  font-size: 11px;
  color: var(--text-muted);
}

.menu-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.app-version-tag {
  font-size: 11px;
  color: var(--text-dim);
}

/* ==========================================================================
   Modals Base
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 18px;
}

.modal-intro {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.cal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.cal-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.cal-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--border);
}

/* Checklist in Filter Modal */
.team-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.team-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.team-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.team-check-label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

.team-check-label strong {
  color: var(--text-main);
}

.team-check-label span {
  color: var(--text-dim);
  font-size: 11px;
}

/* Family & Team Cal list */
.family-cal-list, .team-cal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.cal-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.cal-btn-group {
  display: flex;
  gap: 6px;
}

.btn-cal-small {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
}

/* Session Modal textarea */
#session-cookie-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-family: monospace;
  font-size: 12px;
  color: var(--text-main);
  resize: vertical;
  margin-top: 6px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

[data-theme="dark"] .toast {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
