/* ================================================
   I'M SPORTS HISTORY - PWA Styles
   Separate file to avoid modifying main style.css
   ================================================ */

/* ---- PWA Install Banner ---- */
.pwa-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #1a1d23 0%, #0D0F12 100%);
  border-top: 1px solid rgba(239, 90, 79, 0.3);
  padding: 12px 16px;
  z-index: 10000;
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.pwa-banner.hidden {
  transform: translateY(100%);
  pointer-events: none;
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.pwa-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  flex-shrink: 0;
}

.pwa-text {
  flex: 1;
  min-width: 0;
}

.pwa-text strong {
  display: block;
  font-size: 14px;
  color: #fff;
  font-weight: 600;
}

.pwa-text span {
  font-size: 12px;
  color: #9ca3af;
}

.pwa-btn {
  background: linear-gradient(135deg, #E8372C 0%, #EF5A4F 100%);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(232, 55, 44, 0.3);
}

.pwa-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(232, 55, 44, 0.4);
}

.pwa-close {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.pwa-close:hover {
  color: #fff;
}

/* ---- iOS Install Modal ---- */
.pwa-ios-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10001;
  opacity: 1;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-ios-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.pwa-ios-modal-content {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.pwa-ios-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  border-radius: 8px;
  transition: all 0.2s ease;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-ios-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.pwa-ios-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  margin: 0 auto 20px;
  box-shadow: 0 10px 30px rgba(232, 55, 44, 0.25);
}

.pwa-ios-modal-content h3 {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.pwa-ios-modal-content > p {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 24px;
  line-height: 1.6;
}

.pwa-ios-steps {
  text-align: left;
  margin-bottom: 24px;
}

.pwa-ios-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.4;
}

.pwa-ios-step:last-child {
  margin-bottom: 0;
}

.pwa-ios-step .step-num {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #E8372C 0%, #EF5A4F 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(232, 55, 44, 0.3);
}

.pwa-ios-step svg {
  flex-shrink: 0;
  color: #60a5fa;
}

.pwa-ios-step strong {
  color: #fff;
  font-weight: 600;
}

.pwa-ios-btn {
  background: linear-gradient(135deg, #E8372C 0%, #C62E23 100%);
  color: #fff;
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(232, 55, 44, 0.35);
}

.pwa-ios-btn:hover {
  background: linear-gradient(135deg, #EF5A4F 0%, #E8372C 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(232, 55, 44, 0.45);
}

/* ---- Apps Page Specific Styles ---- */
.apps-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1a1010 50%, #0D0F12 100%);
}

.apps-hero {
  padding: 120px 0 60px;
  text-align: center;
}

.apps-hero-content {
  max-width: 600px;
  margin: 0 auto;
}

.apps-logo {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  margin: 0 auto 24px;
  box-shadow: 0 10px 40px rgba(239, 90, 79, 0.3);
}

.apps-hero h1 {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}

.apps-hero h1 span {
  background: linear-gradient(135deg, #E8372C 0%, #EF5A4F 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.apps-hero p {
  font-size: 1.1rem;
  color: #9ca3af;
  line-height: 1.7;
}

.apps-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 320px;
  margin: 40px auto;
}

.apps-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
}

.apps-btn-primary {
  background: linear-gradient(135deg, #E8372C 0%, #EF5A4F 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(232, 55, 44, 0.3);
}

.apps-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(232, 55, 44, 0.4);
}

.apps-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.apps-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.apps-btn svg {
  width: 24px;
  height: 24px;
}

/* Features Section */
.apps-features {
  padding: 60px 0;
}

.apps-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.apps-feature {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
}

.apps-feature-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, rgba(232, 55, 44, 0.1) 0%, rgba(239, 90, 79, 0.1) 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #EF5A4F;
}

.apps-feature-icon svg {
  width: 28px;
  height: 28px;
}

.apps-feature h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.apps-feature p {
  font-size: 0.9rem;
  color: #9ca3af;
  line-height: 1.6;
}

/* Instructions Section */
.apps-instructions {
  padding: 60px 0;
  background: rgba(0, 0, 0, 0.2);
}

.apps-instructions h2 {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 40px;
}

.apps-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.apps-tab {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #9ca3af;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.apps-tab:hover {
  background: rgba(255, 255, 255, 0.08);
}

.apps-tab.active {
  background: linear-gradient(135deg, #E8372C 0%, #EF5A4F 100%);
  border-color: transparent;
  color: #fff;
}

.apps-tab-content {
  display: none;
  max-width: 500px;
  margin: 0 auto;
}

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

.apps-step {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  margin-bottom: 12px;
}

.apps-step-num {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #E8372C 0%, #EF5A4F 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.apps-step-text {
  flex: 1;
}

.apps-step-text strong {
  display: block;
  color: #fff;
  margin-bottom: 4px;
}

.apps-step-text span {
  font-size: 0.9rem;
  color: #9ca3af;
}

/* ---- Login Page Install Buttons ---- */
.auth-card .pwa-install-section {
  margin-top: 28px;
  padding-top: 0;
}

.auth-card .pwa-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
  gap: 16px;
}

.auth-card .pwa-divider::before,
.auth-card .pwa-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.auth-card .pwa-divider span {
  color: #94a3b8;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  white-space: nowrap;
}

.auth-card .pwa-install-buttons {
  display: flex;
  gap: 12px;
}

.auth-card .pwa-install-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.auth-card .pwa-install-btn i {
  font-size: 22px;
}

.auth-card .pwa-install-btn span {
  font-size: 13px;
  font-weight: 600;
}

.auth-card .pwa-install-btn.pwa-ios {
  background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.auth-card .pwa-install-btn.pwa-ios:hover {
  background: linear-gradient(145deg, #3a3a3a 0%, #2a2a2a 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.2);
}

.auth-card .pwa-install-btn.pwa-android {
  background: linear-gradient(145deg, #3ddc84 0%, #30c972 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(61, 220, 132, 0.25);
}

.auth-card .pwa-install-btn.pwa-android:hover {
  background: linear-gradient(145deg, #4de894 0%, #3ddc84 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(61, 220, 132, 0.35);
}

.auth-card .pwa-install-hint {
  text-align: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  color: #64748b;
  margin-top: 14px;
  letter-spacing: 0.2px;
}

/* ---- Native App Store Download Buttons ---- */
.app-store-section {
  margin-top: 24px;
  padding-top: 0;
}

.app-store-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
  gap: 16px;
}

.app-store-divider::before,
.app-store-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.app-store-divider span {
  color: #94a3b8;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  white-space: nowrap;
}

.app-store-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.app-store-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 140px;
  justify-content: center;
}

.app-store-btn .store-icon {
  font-size: 28px;
  line-height: 1;
}

.app-store-btn .store-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.app-store-btn .store-text-small {
  font-size: 9px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.app-store-btn .store-text-large {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

/* Apple App Store Button */
.app-store-btn.app-store-apple {
  background: linear-gradient(145deg, #1a1a1a 0%, #000000 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.app-store-btn.app-store-apple:hover {
  background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Google Play Store Button */
.app-store-btn.app-store-google {
  background: linear-gradient(145deg, #1a1a1a 0%, #000000 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.app-store-btn.app-store-google:hover {
  background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.25);
}

.app-store-btn.app-store-google .store-icon {
  background: linear-gradient(135deg, #4285F4 25%, #34A853 25%, #34A853 50%, #FBBC05 50%, #FBBC05 75%, #EA4335 75%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-store-hint {
  text-align: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  color: #64748b;
  margin-top: 14px;
  letter-spacing: 0.2px;
}

.app-store-hint a {
  color: #667eea;
  text-decoration: none;
}

.app-store-hint a:hover {
  text-decoration: underline;
}

/* Coming Soon Badge */
.app-store-btn.coming-soon {
  opacity: 0.6;
  cursor: default;
  position: relative;
}

.app-store-btn.coming-soon::after {
  content: attr(data-coming-soon);
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.app-store-btn.coming-soon:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 640px) {
  .apps-hero {
    padding: 100px 20px 40px;
  }

  .apps-hero h1 {
    font-size: 2rem;
  }

  .apps-tabs {
    flex-direction: column;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
  }

  .pwa-banner-content {
    flex-wrap: wrap;
  }

  .pwa-text {
    order: 1;
    flex: 1;
  }

  .pwa-icon {
    order: 0;
  }

  .pwa-btn {
    order: 2;
    width: 100%;
    margin-top: 8px;
  }

  .pwa-close {
    order: 3;
    position: absolute;
    top: 8px;
    right: 8px;
  }

  .auth-card .pwa-install-buttons {
    flex-direction: column;
  }

  .auth-card .pwa-install-btn {
    padding: 16px;
  }

  .app-store-buttons {
    flex-direction: column;
  }

  .app-store-btn {
    width: 100%;
    min-width: unset;
  }
}

/* ================================================
   MOBILE APP - Keyboard & Capacitor Fixes
   ================================================ */

/* CSS variable for keyboard height */
:root {
  --keyboard-height: 0px;
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

/* When keyboard is open */
body.keyboard-open {
  overflow: hidden;
}

body.keyboard-open .main-content,
body.keyboard-open main,
body.keyboard-open .container {
  padding-bottom: var(--keyboard-height);
}

/* Ensure inputs are visible when keyboard opens */
body.keyboard-open input:focus,
body.keyboard-open textarea:focus,
body.keyboard-open select:focus {
  position: relative;
  z-index: 1000;
}

/* Fix for forms in modals */
body.keyboard-open .modal-content,
body.keyboard-open .auth-card {
  max-height: calc(100vh - var(--keyboard-height) - 100px);
  overflow-y: auto;
}

/* Capacitor native app styles */
html.plt-capacitor,
html.plt-android,
html.plt-ios {
  /* Ensure proper viewport handling */
  height: 100%;
  overflow: hidden;
}

html.plt-capacitor body,
html.plt-android body,
html.plt-ios body {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Safe area padding for notched devices */
html.plt-ios body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Fix white flash on page load */
html.plt-capacitor,
html.plt-android {
  background-color: #1a1a2e;
}

/* Prevent pull-to-refresh on Android */
html.plt-android body {
  overscroll-behavior-y: contain;
}

/* Input focus styles for mobile */
@media (max-width: 768px) {
  input:focus,
  textarea:focus,
  select:focus {
    font-size: 16px !important; /* Prevents iOS zoom */
  }
}
