/* ==========================================================================
   Ballpark Announcer — Premium Dark Mode Theme
   ========================================================================== */

/* Modern CSS Reset & Variable Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand Colors */
  --brand-navy: #12264B;
  --brand-red: #CF2530;
  --brand-red-hover: #E03540;
  --brand-burgundy: #871E35;
  --brand-green: #208D59;
  --brand-green-glow: rgba(32, 141, 89, 0.15);
  --brand-blue: #3b82f6;
  --brand-blue-glow: rgba(59, 130, 246, 0.15);

  /* Theme Colors (Premium Dark Mode) */
  --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #111827 50%, #070a10 100%);
  --card-bg: rgba(17, 24, 39, 0.7);
  --card-header-bg: rgba(31, 41, 55, 0.35);
  --card-border: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(7, 10, 19, 0.45);
  --input-border: rgba(255, 255, 255, 0.12);
  --input-focus-border: #3b82f6;
  --input-focus-glow: rgba(59, 130, 246, 0.25);
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-success: #34d399;
  --text-error: #f87171;

  /* Font Families */
  --font-sans: 'DM Sans', sans-serif;
  --font-condensed: 'Barlow Condensed', sans-serif;
}

/* Base Body Styling */
body {
  font-family: var(--font-sans);
  background: #070a0f;
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  overflow-x: hidden;
  padding-top: 60px;
  padding-bottom: 60px;
}

/* Wrapper Layout */
.wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 20px 60px;
  animation: pageFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header & Logo Section */
.header {
  text-align: center;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.logo-wrap {
  display: inline-block;
  animation: floatIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.3s ease;
}

.logo-wrap:hover {
  transform: scale(1.05) rotate(2deg);
}

.logo-wrap img {
  width: 140px;
  height: auto;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}

@keyframes floatIn {
  from { transform: translateY(-20px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Pills & Badges */
.team-pill, .trial-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-family: var(--font-condensed);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 24px;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.team-pill {
  background: linear-gradient(135deg, var(--brand-navy) 0%, #1e3a8a 100%);
}

.team-pill::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  background-image: url('/Baseball.png');
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

.trial-pill {
  background: linear-gradient(135deg, var(--brand-green) 0%, #065f46 100%);
}

.trial-pill::before {
  content: '★';
  font-size: 14px;
  color: #fbbf24;
  text-shadow: 0 0 4px rgba(251, 191, 36, 0.6);
}

.team-banner {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 4px;
}

.team-banner span {
  color: var(--text-success);
  font-weight: 600;
}

/* Main Form Card */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
}

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

.card-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.card-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.player-name {
  font-family: var(--font-condensed);
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.5px;
  margin-top: 8px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.price-badge {
  text-align: right;
  flex-shrink: 0;
}

.price-badge .amount {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.price-badge .per {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 140px;
  line-height: 1.3;
}

.card-body {
  padding: 28px;
}

/* Info Rows & Callouts */
.info-row, .trial-row {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 24px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.02);
}

.info-icon {
  font-size: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.info-text strong, .trial-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-success);
}

.info-text span, .trial-text span {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
  line-height: 1.5;
}

/* Trial Row Customization */
.trial-row {
  margin: 22px 0;
}

.trial-mascot {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25));
}

/* Form Fields */
.field {
  margin-bottom: 20px;
  position: relative;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

input {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: var(--font-sans);
  color: #fff;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

input::placeholder {
  color: #4b5563;
}

input:focus {
  border-color: var(--input-focus-border);
  background: rgba(17, 24, 39, 0.9);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 4px var(--input-focus-glow);
}

.hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
  font-weight: 500;
}

/* Password Visibility Toggle */
.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 50px;
}

.toggle-pw {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  padding: 6px;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-pw:hover {
  color: #fff;
  transform: translateY(-50%) scale(1.1);
}

/* Modern Browser Form Validation Feedback */
input:user-invalid {
  border-color: var(--text-error);
  background-color: rgba(248, 113, 113, 0.05);
}

input:user-invalid:focus {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(248, 113, 113, 0.15);
}

input:user-valid:not(:placeholder-shown) {
  border-color: var(--text-success);
}

/* Submit Button Component */
.btn {
  width: 100%;
  background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-burgundy) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 18px;
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(207, 37, 48, 0.4), inset 0 1px 1px rgba(255,255,255,0.2);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: all 0.6s ease;
}

.btn:hover {
  background: linear-gradient(135deg, var(--brand-red-hover) 0%, var(--brand-red) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(207, 37, 48, 0.5), inset 0 1px 1px rgba(255,255,255,0.3);
}

.btn:hover::after {
  left: 100%;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(207, 37, 48, 0.4);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* Spinner Animation */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

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

/* Error/Success Messages */
.error-msg {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-error);
  margin-top: 16px;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: none;
  line-height: 1.5;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Success & State Screens */
.success-state {
  display: none;
  text-align: center;
  padding: 24px 0 12px;
  animation: pageFadeIn 0.5s ease;
}

.success-icon {
  font-size: 64px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(52, 211, 153, 0.3));
  animation: pulseSuccess 2s infinite;
}

@keyframes pulseSuccess {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.success-state h3 {
  font-family: var(--font-condensed);
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.5px;
}

.success-state p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.6;
}

.open-app-btn {
  display: inline-block;
  margin-top: 24px;
  background: linear-gradient(135deg, var(--brand-navy) 0%, #1e40af 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px 36px;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.3);
  transition: all 0.2s ease;
}

.open-app-btn:hover {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* Token & Critical Errors */
.token-error {
  display: none;
  text-align: center;
  padding: 30px 10px;
  animation: pageFadeIn 0.5s ease;
}

.token-error-icon {
  font-size: 56px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(239, 68, 68, 0.3));
}

.token-error h3 {
  font-family: var(--font-condensed);
  font-size: 28px;
  font-weight: 900;
  color: var(--text-error);
  letter-spacing: 0.5px;
}

.token-error p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.6;
}

/* Layout Utilities & Dividers */
.divider {
  height: 1px;
  background: var(--card-border);
  margin: 24px 0;
}

/* Trust Indicators */
.trust {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.trust-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-success);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--text-success);
}

/* Legal text block */
.legal {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 18px;
  line-height: 1.8;
}

.legal a {
  color: var(--brand-red);
  text-decoration: underline;
  font-weight: 600;
  transition: color 0.2s;
}

.legal a:hover {
  color: var(--brand-red-hover);
}

.legal strong {
  color: #fff;
  font-weight: 600;
}

/* COPPA / Minor Consent Section */
#coppaSection {
  background: rgba(30, 41, 59, 0.4);
  border: 1.5px solid var(--card-border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
}

#coppaSection label {
  text-transform: none;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
  letter-spacing: 0;
}

#coppaSection label a {
  color: var(--brand-red);
  text-decoration: underline;
}

#coppaSection input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
  accent-color: var(--brand-red);
  cursor: pointer;
}

/* Responsive Media Queries */
@media (max-width: 480px) {
  .logo-wrap img {
    width: 110px;
  }
  .wrap {
    padding: 12px 12px 48px;
  }
  .card-body {
    padding: 20px;
  }
  .card-header {
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .price-badge {
    text-align: left;
  }
  .price-badge .per {
    max-width: none;
  }
  .info-row, .trial-row {
    padding: 14px;
  }
  .trial-mascot {
    width: 48px;
    height: 48px;
  }
}

/* Custom Country Selector & Phone Input Layout */
.phone-container-wrapper {
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  width: 100%;
}

.phone-container-wrapper:focus-within {
  border-color: var(--input-focus-border);
  background: rgba(17, 24, 39, 0.9);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 4px var(--input-focus-glow);
}

.country-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 12px 14px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  user-select: none;
  cursor: pointer;
  flex-shrink: 0;
}

.country-selector .flag {
  font-size: 18px;
  line-height: 1;
}

.country-selector .prefix {
  font-family: var(--font-sans);
}

.country-selector .chevron {
  font-size: 8px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.phone-container-wrapper .separator-line {
  width: 1px;
  height: 24px;
  background-color: var(--card-border);
  flex-shrink: 0;
}

.phone-container-wrapper input {
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  padding: 14px 16px !important;
  margin: 0 !important;
  width: 100% !important;
}

.phone-container-wrapper input:focus {
  outline: none !important;
}

/* Validation styling using :has() for the wrapper border */
.phone-container-wrapper:has(input:user-invalid) {
  border-color: var(--text-error) !important;
  background-color: rgba(248, 113, 113, 0.05) !important;
}

.phone-container-wrapper:has(input:user-valid:not(:placeholder-shown)) {
  border-color: var(--text-success) !important;
}
