@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&family=Outfit:wght@400;600;800;900&family=Oswald:wght@500;600;700&display=swap');

:root {
  --bg-dark: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-elevated: #FFFFFF;
  --primary-green: #16A34A;
  --primary-green-dark: #15803D;
  --accent-gold: #D97706;
  --accent-blue: #2563EB;
  --danger-red: #DC2626;
  --warning-orange: #EA580C;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-light: #E2E8F0;
  --shadow-main: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --font-family: 'Outfit', 'Noto Sans TC', -apple-system, sans-serif;
}

body.dark-mode {
  --bg-dark: #090D14;
  --bg-card: rgba(22, 27, 34, 0.88);
  --bg-card-hover: rgba(30, 38, 48, 0.95);
  --bg-elevated: #161B22;
  --primary-green: #10B981;
  --primary-green-dark: #047857;
  --accent-gold: #F59E0B;
  --accent-blue: #3B82F6;
  --danger-red: #EF4444;
  --warning-orange: #F97316;
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --border-light: rgba(255, 255, 255, 0.12);
  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

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

body {
  background-color: #E2E8F0;
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
}

.mobile-app-wrapper {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--bg-dark);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: 90px;
}

.header-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.dark-mode .header-bar {
  background: rgba(13, 17, 23, 0.92);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-green);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--primary-green-dark);
  font-weight: 800;
}

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

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  font-size: 0.8rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.role-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
}

.role-admin { background: #FEE2E2; color: #DC2626; border: 1px solid #FCA5A5; }
.role-coach { background: #DBEAFE; color: #1D4ED8; border: 1px solid #93C5FD; }
.role-parent { background: #DCFCE7; color: #15803D; border: 1px solid #86EFAC; }

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.btn-icon:active {
  transform: scale(0.92);
}

.app-container {
  width: 100%;
  padding: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-main);
  transition: transform 0.15s ease;
}

.card:active {
  transform: scale(0.99);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
}

.card-title i {
  color: var(--primary-green);
}

.hero-card {
  background: linear-gradient(135deg, #DCFCE7 0%, #FFFFFF 100%);
  border: 1px solid #86EFAC;
  position: relative;
  overflow: hidden;
}

body.dark-mode .hero-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(13, 17, 23, 0.9) 100%), var(--bg-card);
  border-color: rgba(16, 185, 129, 0.4);
}

.countdown-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.countdown-unit {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  text-align: center;
  flex: 1;
}

.countdown-val {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary-green);
}

.countdown-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 800;
}

.category-pill-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.category-pill-bar::-webkit-scrollbar { display: none; }

.cat-pill {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.cat-pill.active {
  background: var(--primary-green);
  color: white;
  border-color: var(--primary-green);
}

.badge-u12 { background: #F3E8FF; color: #7C3AED; border: 1px solid #DDD6FE; }
.badge-u10 { background: #CFFAFE; color: #0891B2; border: 1px solid #A5F3FC; }
.badge-u8  { background: #FFE4E6; color: #E11D48; border: 1px solid #FECDD3; }
.badge-u6  { background: #FEF3C7; color: #D97706; border: 1px solid #FDE68A; }
.badge-all { background: #E2E8F0; color: #475569; border: 1px solid #CBD5E1; }

/* Interactive Month Calendar Grid Styling (matching football-team-calendar.pages.dev) */
.calendar-grid-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 12px;
  margin-bottom: 14px;
}

.cal-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-month-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--primary-green-dark);
}

.cal-grid-table {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  width: 100%;
}

.cal-head-day {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 6px 2px;
  color: var(--text-muted);
  background: #F1F5F9;
  border-radius: 6px;
}

.cal-head-day.sat { color: var(--warning-orange); background: #FFF7ED; }

.cal-cell {
  aspect-ratio: 1;
  min-height: 48px;
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.cal-cell.other-month {
  opacity: 0.3;
  background: #FAFAFA;
}

.cal-cell.is-selected {
  border-color: var(--primary-green);
  background: #ECFDF5;
  box-shadow: inset 0 0 0 2px var(--primary-green);
}

.cal-cell-num {
  font-family: 'Oswald', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.cal-event-dot-row {
  display: flex;
  gap: 3px;
  align-items: center;
}

.dot-event { width: 6px; height: 6px; border-radius: 50%; }
.dot-offsite { background: var(--warning-orange); }
.dot-match { background: var(--primary-green); }
.dot-train { background: var(--accent-blue); }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px 14px 4px;
  z-index: 99;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 800;
  transition: all 0.15s ease;
  background: none;
  border: none;
  cursor: pointer;
  flex: 1;
}

.nav-item i { font-size: 1.3rem; }
.nav-item.active { color: var(--primary-green); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, #16A34A 0%, #15803D 100%);
  color: #FFFFFF;
}

.btn-secondary {
  background: #F1F5F9;
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: var(--radius-sm); }

.form-group { margin-bottom: 12px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 800; color: var(--text-muted); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 10px 12px; background: #FFFFFF; border: 1px solid #CBD5E1; border-radius: var(--radius-md); color: var(--text-main); font-size: 0.9rem; outline: none; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 800; }
.badge-success { background: #DCFCE7; color: #15803D; border: 1px solid #86EFAC; }
.badge-warning { background: #FFEDD5; color: #C2410C; border: 1px solid #FDBA74; }
.badge-danger { background: #FEE2E2; color: #B91C1C; border: 1px solid #FCA5A5; }
.badge-info { background: #DBEAFE; color: #1D4ED8; border: 1px solid #93C5FD; }

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-container {
  background: #FFFFFF;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-container { transform: translateY(0); }

.player-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.player-card { background: #FFFFFF; border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 12px; text-align: center; position: relative; }
.player-avatar { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; margin: 0 auto 6px auto; border: 2px solid var(--primary-green); }
.player-name { font-size: 0.92rem; font-weight: 900; }

.rollcall-item { display: flex; align-items: center; justify-content: space-between; padding: 10px; background: #F8FAFC; border: 1px solid var(--border-light); border-radius: var(--radius-md); margin-bottom: 8px; }
.btn-status-toggle { padding: 5px 10px; border-radius: var(--radius-sm); border: 1px solid #CBD5E1; background: #FFFFFF; color: var(--text-muted); font-size: 0.75rem; font-weight: 800; }
.btn-status-toggle.active-present { background: var(--primary-green); color: white; border-color: var(--primary-green); }
.btn-status-toggle.active-late { background: var(--warning-orange); color: white; border-color: var(--warning-orange); }
.btn-status-toggle.active-absent { background: var(--danger-red); color: white; border-color: var(--danger-red); }

.toast-container { position: fixed; top: 65px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: 440px; width: 90%; }
.toast { background: #FFFFFF; border: 1px solid #86EFAC; padding: 12px 16px; border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,0.12); display: flex; align-items: flex-start; gap: 10px; }

.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mb-12 { margin-bottom: 12px; }
