/* ==========================================================================
   Design System & Modern Sports Theme (Ultra-Premium & Dynamic)
   ========================================================================== */
:root {
  /* Brand Core Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.25);
  
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-subtle: #f8fafc;

  /* 4 Distinct Team Color Schemes */
  /* 1. Men (Electric Royal Blue & Cyan) */
  --men-color: #2563eb;
  --men-light: #dbeafe;
  --men-dark: #1e3a8a;
  --men-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  --men-glow: rgba(37, 99, 235, 0.2);

  /* 2. Kathoey (Pride Rainbow & Magenta Violet) */
  --kathoey-color: #a855f7;
  --kathoey-light: #f3e8ff;
  --kathoey-dark: #6b21a8;
  --kathoey-gradient: linear-gradient(135deg, #7e22ce 0%, #ec4899 50%, #f59e0b 100%);
  --kathoey-glow: rgba(168, 85, 247, 0.2);

  /* 3. Tom (Neon Emerald & Cyber Teal) */
  --tom-color: #0d9488;
  --tom-light: #ccfbf1;
  --tom-dark: #115e59;
  --tom-gradient: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  --tom-glow: rgba(13, 148, 136, 0.2);

  /* 4. Women (Vibrant Crimson & Coral Rose) */
  --women-color: #f43f5e;
  --women-light: #ffe4e6;
  --women-dark: #9f1239;
  --women-gradient: linear-gradient(135deg, #be123c 0%, #fb7185 100%);
  --women-glow: rgba(244, 63, 94, 0.2);

  /* Status Colors */
  --status-open: #10b981;
  --status-open-bg: #ecfdf5;
  --status-warning: #f59e0b;
  --status-warning-bg: #fffbeb;
  --status-full: #ef4444;
  --status-full-bg: #fef2f2;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 12px -2px rgba(15, 23, 42, 0.08), 0 3px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 14px 24px -4px rgba(15, 23, 42, 0.1), 0 8px 12px -4px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 24px 38px -6px rgba(15, 23, 42, 0.12), 0 12px 16px -6px rgba(15, 23, 42, 0.06);

  /* Radius & Transitions */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.04) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
}

a {
  text-decoration: none;
  color: inherit;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

.container {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Canvas Confetti */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* ==========================================================================
   Hero Header (Energetic Sports Theme)
   ========================================================================== */
.hero-header {
  background: linear-gradient(135deg, #090d16 0%, #111c30 40%, #1e3a8a 100%);
  color: #ffffff;
  padding: 3.5rem 0 4rem;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.hero-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.12) 1.5px, transparent 1.5px),
    radial-gradient(circle at 20% 80%, rgba(236, 72, 153, 0.18) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.22) 0%, transparent 40%);
  background-size: 28px 28px, 100% 100%, 100% 100%;
  pointer-events: none;
}

.header-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 1.25rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 500;
  color: #f1f5f9;
  margin-bottom: 1.2rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.badge-pill i {
  color: #fbbf24;
}

.main-title {
  font-size: clamp(2.2rem, 4.5vw + 1rem, 3.6rem);
  letter-spacing: -0.5px;
  margin-bottom: 0.85rem;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  background: linear-gradient(180deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.15rem;
  font-weight: 300;
  color: #cbd5e1;
  max-width: 820px;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.subtitle strong {
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.quick-nav {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.btn-nav.primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-nav.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.6);
}

.btn-nav.secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
}

.btn-nav.secondary:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-2px);
}

.btn-nav.outline {
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
}

.btn-nav.outline:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-nav.admin-active {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   Main Layout & Section Headers
   ========================================================================== */
.main-content {
  padding-top: 2.25rem;
  padding-bottom: 5rem;
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}

.section-title-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.section-heading {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #0f172a;
}

.section-heading i {
  color: var(--primary);
}

.status-indicators-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.sheet-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  background: #ffffff;
  color: #64748b;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sheet-sync-indicator:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.sheet-sync-indicator.connected {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.sheet-sync-indicator.syncing {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
  background: #ffffff;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.pulse-dot {
  width: 9px;
  height: 9px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-dot-anim 1.8s infinite;
}

@keyframes pulse-dot-anim {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ==========================================================================
   Section 1: 4 Team Quota Cards (Vibrant Sports Badges)
   ========================================================================== */
.quota-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
  gap: 1.35rem;
}

.quota-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  position: relative;
  overflow: hidden;
}

.quota-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* Top team color stripe */
.quota-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
}

.quota-card.team-men::before { background: var(--men-gradient); }
.quota-card.team-kathoey::before { background: var(--kathoey-gradient); }
.quota-card.team-tom::before { background: var(--tom-gradient); }
.quota-card.team-women::before { background: var(--women-gradient); }

.quota-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.team-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.team-men .team-icon { background: var(--men-light); color: var(--men-color); }
.team-kathoey .team-icon { background: var(--kathoey-light); color: var(--kathoey-color); }
.team-tom .team-icon { background: var(--tom-light); color: var(--tom-color); }
.team-women .team-icon { background: var(--women-light); color: var(--women-color); }

.team-meta {
  flex-grow: 1;
}

.team-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: block;
}

.team-name {
  font-size: 1.2rem;
  color: #1e293b;
  margin: 0;
}

/* Status Badges */
.status-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  align-self: flex-start;
  white-space: nowrap;
}

.status-badge.status-open {
  background: var(--status-open-bg);
  color: var(--status-open);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.status-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.status-full {
  background: var(--status-full-bg);
  color: var(--status-full);
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-weight: 800;
}

.quota-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.stat-number .current-count {
  font-family: 'Kanit', sans-serif;
  font-size: 2.4rem;
  font-weight: 800;
  color: #0f172a;
}

.stat-number .max-count {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-left: 2px;
}

.remaining-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
}

.remaining-text.full-text {
  color: var(--status-full);
  font-weight: 800;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background-color: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.team-men .progress-bar-fill { background: var(--men-gradient); }
.team-kathoey .progress-bar-fill { background: var(--kathoey-gradient); }
.team-tom .progress-bar-fill { background: var(--tom-gradient); }
.team-women .progress-bar-fill { background: var(--women-gradient); }

.quota-card.is-full .progress-bar-fill {
  background: var(--status-full) !important;
}

/* ==========================================================================
   Cards General & Form Card
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.header-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.card-title {
  font-size: 1.55rem;
  color: #0f172a;
}

.card-desc {
  font-size: 0.98rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ==========================================================================
   Registration Form Elements
   ========================================================================== */
.reg-form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.98rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.form-label.required::after {
  content: " *";
  color: #ef4444;
  font-weight: 800;
}

.form-label i {
  color: var(--primary);
  margin-right: 0.35rem;
}

/* Team Radio Select Cards */
.team-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.team-radio-option {
  position: relative;
  cursor: pointer;
  display: block;
}

.team-radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card-content {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  padding: 1.1rem 1.25rem;
  background: #ffffff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.team-radio-option:hover .radio-card-content {
  border-color: #94a3b8;
  background-color: #f8fafc;
  transform: translateY(-2px);
}

.team-radio-option input[type="radio"]:checked + .radio-card-content {
  border-color: var(--primary);
  background-color: #f0f7ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), var(--shadow-md);
}

.radio-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.men-color { background: var(--men-light); color: var(--men-color); }
.kathoey-color { background: var(--kathoey-light); color: var(--kathoey-color); }
.tom-color { background: var(--tom-light); color: var(--tom-color); }
.women-color { background: var(--women-light); color: var(--women-color); }

.radio-details {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.radio-details .team-title {
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: #1e293b;
}

.radio-quota-tag {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Disabled & Full State in Form */
.full-overlay-text {
  display: none;
  font-size: 0.82rem;
  font-weight: 700;
  color: #ef4444;
  background: #fee2e2;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.team-radio-option.is-full {
  cursor: not-allowed;
  opacity: 0.65;
}

.team-radio-option.is-full .radio-card-content {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.team-radio-option.is-full .radio-quota-tag {
  display: none;
}

.team-radio-option.is-full .full-overlay-text {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Inputs & Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.35rem;
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-control {
  width: 100%;
  padding: 0.85rem 1.1rem;
  font-size: 1rem;
  color: #1e293b;
  background-color: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.form-control::placeholder {
  color: #94a3b8;
}

select.form-control {
  cursor: pointer;
}

.error-feedback {
  display: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: #ef4444;
  margin-top: 0.4rem;
}

.has-error .form-control {
  border-color: #ef4444 !important;
  background-color: #fffaf0;
}

.has-error .error-feedback {
  display: block;
}

/* Form Action Buttons */
.form-action-area {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.9rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.btn-primary-submit {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  flex-grow: 1;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.btn-primary-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
}

.btn-secondary-reset {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid var(--border-color);
}

.btn-secondary-reset:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* ==========================================================================
   Section 3: Instant Roster Display
   ========================================================================== */
.roster-header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.35rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
}

.roster-title-block {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
}

.roster-icon {
  background: #ecfdf5;
  color: #059669;
}

.roster-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: #94a3b8;
  font-size: 0.95rem;
}

.search-box {
  padding: 0.7rem 2.4rem 0.7rem 2.4rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  outline: none;
  min-width: 250px;
  transition: all var(--transition-fast);
}

.search-box:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  min-width: 290px;
}

.clear-search-btn {
  position: absolute;
  right: 0.85rem;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.25rem;
}

.clear-search-btn:hover {
  color: #475569;
}

.export-actions {
  display: flex;
  gap: 0.55rem;
}

.btn-outline-action {
  background: #ffffff;
  color: #334155;
  border: 1.5px solid var(--border-color);
  font-size: 0.92rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn-outline-action:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Tabs Bar */
.team-tab-bar {
  display: flex;
  gap: 0.6rem;
  margin: 1.75rem 0 1.75rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
}

.team-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.25rem;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.team-tab:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.team-tab.active {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.team-tab.tab-men.active { background: var(--men-color); box-shadow: 0 4px 12px var(--men-glow); }
.team-tab.tab-kathoey.active { background: var(--kathoey-color); box-shadow: 0 4px 12px var(--kathoey-glow); }
.team-tab.tab-tom.active { background: var(--tom-color); box-shadow: 0 4px 12px var(--tom-glow); }
.team-tab.tab-women.active { background: var(--women-color); box-shadow: 0 4px 12px var(--women-glow); }

/* Roster Block per Team */
.roster-view-container {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.team-roster-block {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.team-block-header {
  padding: 1.15rem 1.4rem;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.team-block-header.men-bg { background: var(--men-gradient); }
.team-block-header.kathoey-bg { background: var(--kathoey-gradient); }
.team-block-header.tom-bg { background: var(--tom-gradient); }
.team-block-header.women-bg { background: var(--women-gradient); }

.team-title-flex {
  display: flex;
  align-items: center;
  gap: 0.95rem;
}

.team-big-icon {
  font-size: 1.6rem;
}

.roster-team-name {
  font-size: 1.25rem;
  color: #ffffff;
  margin: 0;
}

.roster-sub-info {
  font-size: 0.88rem;
  opacity: 0.92;
}

.team-quota-pill {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Roster Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.roster-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.roster-table td {
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border-color);
  color: #1e293b;
  vertical-align: middle;
}

.roster-table tbody tr:hover {
  background-color: #f8fafc;
}

.player-rank {
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  display: inline-block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  background: #eff6ff;
  border-radius: 50%;
}

.player-name-text {
  font-weight: 600;
  color: #0f172a;
}

.badge-nickname {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: #f1f5f9;
  border-radius: 6px;
  font-weight: 600;
  color: #334155;
}

.player-jersey-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: #f1f5f9;
  border-radius: 6px;
  font-weight: 800;
  font-family: 'Kanit', sans-serif;
  color: #1e293b;
  border: 1px solid var(--border-color);
}

.role-badge {
  display: inline-block;
  font-size: 0.82rem;
  color: #475569;
  background: #f1f5f9;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.time-stamp {
  font-size: 0.85rem;
  color: #64748b;
  white-space: nowrap;
}

.btn-delete-player {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.btn-delete-player:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* Empty State (Friendly Design) */
.empty-state {
  padding: 2.75rem 1.5rem;
  text-align: center;
  color: #94a3b8;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: #fafafa;
}

/* ==========================================================================
   Section 4: Organizer Tools (Admin Mode Protected)
   ========================================================================== */
.admin-icon {
  background: #fff7ed;
  color: #ea580c;
}

.admin-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.35rem;
}

.admin-action-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.4rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  gap: 1.1rem;
}

.admin-action-item.sheet-highlight {
  border: 2px solid #a7f3d0 !important;
  background: #f0fdf4 !important;
}

.action-info h4 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
  color: #1e293b;
}

.action-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.action-btn-group {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-sheet {
  background: #10b981;
  color: #ffffff;
  font-size: 0.95rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
}

.btn-sheet:hover {
  background: #059669;
}

.btn-warning {
  background: #f59e0b;
  color: #ffffff;
}
.btn-warning:hover {
  background: #d97706;
}

.btn-danger {
  background: #ef4444;
  color: #ffffff;
}
.btn-danger:hover {
  background: #dc2626;
}

/* Admin Mode Hidden Rules */
body:not(.is-admin-mode) .admin-section {
  display: none !important;
}

body:not(.is-admin-mode) .admin-only-action {
  display: none !important;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.main-footer {
  background: #090d16;
  color: #94a3b8;
  padding: 2.5rem 0;
  text-align: center;
  font-size: 0.92rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.main-footer strong {
  color: #ffffff;
}

.footer-note {
  font-size: 0.85rem;
  margin-top: 0.35rem;
  color: #64748b;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  width: 100%;
  max-width: 490px;
  box-shadow: var(--shadow-xl);
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.modal-dialog-wide {
  max-width: 580px;
}

.modal-backdrop.show .modal-dialog {
  transform: scale(1);
}

.modal-icon-header {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 1.35rem;
}

.modal-icon-header.success { background: #ecfdf5; color: #10b981; }
.modal-icon-header.error { background: #fef2f2; color: #ef4444; }
.modal-icon-header.warning { background: #fffbeb; color: #f59e0b; }
.modal-icon-header.sheet-icon-hd { background: #ecfdf5; color: #10b981; }

.modal-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

.modal-desc {
  font-size: 0.98rem;
  color: var(--text-muted);
  margin-bottom: 1.35rem;
}

.modal-summary-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  text-align: left;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.modal-summary-box .row-item {
  display: flex;
  justify-content: space-between;
}

.modal-summary-box .item-label {
  color: var(--text-muted);
}

.modal-summary-box .item-val {
  font-weight: 600;
  color: #0f172a;
}

.modal-actions-two {
  display: flex;
  gap: 0.85rem;
}

.modal-actions-two .btn {
  flex: 1;
}

.sheet-connection-status {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.sheet-connection-status.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.sheet-connection-status.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.input-hint {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 0.4rem;
  display: block;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #0f172a;
  color: #ffffff;
  padding: 0.95rem 1.35rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.95rem;
  animation: toast-slide-in 0.3s ease forwards;
  max-width: 400px;
}

.toast.toast-success { border-left: 4px solid #10b981; }
.toast.toast-error { border-left: 4px solid #ef4444; }
.toast.toast-warning { border-left: 4px solid #f59e0b; }

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 640px) {
  .hero-header { padding: 2.5rem 0 2.75rem; }
  .card { padding: 1.35rem; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .hide-mobile { display: none; }
  .search-box { width: 100%; min-width: 100%; }
  .search-input-wrap { width: 100%; }
  .export-actions { width: 100%; }
  .export-actions .btn { flex: 1; }
  .toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
}

/* ==========================================================================
   Print Stylesheet (@media print)
   ========================================================================== */
@media print {
  body { background: #ffffff !important; color: #000000 !important; }
  .hero-header, .quick-nav, .quota-section, .register-section, .admin-section,
  .roster-controls, .team-tab-bar, .no-print, .btn-delete-player, .modal-backdrop,
  .toast-container, #confettiCanvas, .main-footer {
    display: none !important;
  }
  .card { border: none !important; box-shadow: none !important; padding: 0 !important; }
  .roster-card { border: none !important; box-shadow: none !important; }
  .team-roster-block { break-inside: avoid; margin-bottom: 2rem; border: 1px solid #000000 !important; }
  .team-block-header { background: #e2e8f0 !important; color: #000000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .roster-team-name { color: #000000 !important; }
  .team-quota-pill { background: #cbd5e1 !important; color: #000000 !important; }
  .roster-table th, .roster-table td { border: 1px solid #94a3b8 !important; color: #000000 !important; padding: 6px 8px !important; }
}
