:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --accent-blue: #2563eb;
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.25);
  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.15);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239, 68, 68, 0.15);
  --accent-yellow: #eab308;
  --accent-yellow-bg: rgba(234, 179, 8, 0.15);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

#app-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
  padding-top: var(--safe-top);
  background: radial-gradient(circle at 50% 0%, #172554 0%, #0a0f1d 45%);
}

/* Native Pull-to-refresh Indicator */
#ptr-indicator {
  position: absolute;
  top: var(--safe-top);
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--accent-gold);
  font-size: 0.85rem;
  font-weight: 600;
  transform: translateY(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2000;
  background: rgba(10, 15, 29, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

#ptr-indicator.active {
  transform: translateY(0);
}

.ptr-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(245, 158, 11, 0.25);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

#ptr-indicator.refreshing .ptr-spinner {
  display: block;
}

#ptr-indicator.refreshing .ptr-arrow {
  display: none;
}

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

/* App Header */
.app-header {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
}

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

.brand-logo-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d4ed8 0%, #f59e0b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-logo-badge svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title span {
  font-size: 0.65rem;
  font-weight: 700;
  background: #f59e0b;
  color: #000;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

.header-player-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.player-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
}

/* Persistent Onboarding Banner Warning */
.onboarding-alert-banner {
  background: linear-gradient(90deg, #b45309 0%, #d97706 100%);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.35);
  animation: bannerPulse 2.5s ease infinite;
}

@keyframes bannerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.92; }
}

.onboarding-alert-banner .badge {
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
}

/* Main Content Area */
.main-viewport {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: calc(85px + var(--safe-bottom));
}

/* Persistent Login Overlay */
#login-modal {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(10, 15, 29, 0.98) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999 !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}

#login-modal.hidden {
  display: none !important;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  width: 100%;
  max-width: 380px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.login-logo {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #1d4ed8 0%, #f59e0b 100%);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.login-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.login-input-group {
  margin-bottom: 16px;
  text-align: left;
}

.login-input-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.login-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  color: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.1em;
  outline: none;
}

.login-input:focus {
  border-color: var(--accent-gold);
}

.demo-logins {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.demo-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

/* Matchday Card */
.fixture-card {
  background: linear-gradient(145deg, #1e293b 0%, #141f33 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.fixture-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b 0%, #2563eb 100%);
}

.match-countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.match-teams {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.25;
}

.match-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-item {
  background: rgba(10, 15, 29, 0.5);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.detail-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.jersey-badge {
  background: #fef08a;
  color: #854d0e;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
}

.venue-directions-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.4);
  color: #60a5fa;
  padding: 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

/* 1-Tap RSVP Section */
.rsvp-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 18px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
}

.rsvp-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 14px;
}

.status-playing {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}

.status-out {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
}

.status-late {
  background: var(--accent-yellow-bg);
  color: var(--accent-yellow);
  border: 1px solid var(--accent-yellow);
}

.rsvp-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.rsvp-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.rsvp-btn:active {
  transform: scale(0.96);
}

.rsvp-btn .emoji-icon {
  font-size: 1.6rem;
}

.rsvp-btn .btn-text {
  font-size: 0.8rem;
  font-weight: 700;
}

.rsvp-btn.selected-playing {
  background: var(--accent-green-bg);
  border-color: var(--accent-green);
  color: #fff;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.rsvp-btn.selected-out {
  background: var(--accent-red-bg);
  border-color: var(--accent-red);
  color: #fff;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.rsvp-btn.selected-late {
  background: var(--accent-yellow-bg);
  border-color: var(--accent-yellow);
  color: #fff;
  box-shadow: 0 4px 16px rgba(234, 179, 8, 0.3);
}

/* Squad Roster & Availability Status */
.squad-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 18px;
}

.squad-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.squad-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 0.85rem;
}

.squad-player-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jersey-num {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #334155;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.player-name {
  font-weight: 600;
}

.squad-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

/* WhatsApp Replacement: Announcements Feed */
.channel-feed-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.announcement-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.announcement-card.urgent {
  border-color: rgba(245, 158, 11, 0.6);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, #1e293b 100%);
}

.announcement-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.announcement-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.author-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

.author-meta {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.announcement-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.channel-tag {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.announcement-body {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #e2e8f0;
  margin-bottom: 12px;
}

.announcement-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.like-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Onboarding Interactive Checklist View */
.checklist-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 18px;
}

.checklist-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s ease;
}

.checklist-step:active {
  background: #1e293b;
}

.step-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-checkbox.done {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #000;
  font-weight: 800;
  font-size: 0.8rem;
}

.step-content {
  flex: 1;
}

.step-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.step-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.step-action-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #60a5fa;
}

/* Modal Bottom Sheets (for Onboarding actions) */
.bottom-sheet {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 2500;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.bottom-sheet.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet-content {
  background: var(--bg-card);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  border-top: 1px solid var(--border-color);
  max-height: 85vh;
  overflow-y: auto;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.sheet-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.sheet-close {
  background: #334155;
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 700;
  cursor: pointer;
}

/* Tab Bar Navigation */
.app-nav-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10, 15, 29, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  position: relative;
}

.nav-tab.active {
  color: var(--accent-gold);
}

.nav-tab svg {
  width: 22px;
  height: 22px;
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

/* Primary Button */
.btn-primary-action {
  background: linear-gradient(135deg, var(--accent-blue) 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  margin-top: 12px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

/* Google Sign-In & Firebase Auth Styles */
.btn-google-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: #ffffff;
  color: #1f2937;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  margin-top: 14px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-google-auth:active {
  transform: scale(0.98);
  background: #f3f4f6;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-divider span {
  padding: 0 10px;
}

.staff-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid #f59e0b;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.hidden {
  display: none !important;
}
