/* ============================================
   JagoEN.com — Mobile Fixes & Optimizations
   8-Figure Designer Updates - June 2026
   ============================================ */

/* ─── Critical Mobile Responsive Fixes ─── */
@media (max-width: 480px) {
  /* Fix dialogue boxes on mobile */
  .dialogue-row {
    flex-direction: column !important;
    gap: 0.25rem;
    text-align: left !important;
  }

  .dialogue-speaker {
    min-width: auto;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
  }

  .dialogue-bubble {
    max-width: 100%;
  }

  /* Fix vocab cards */
  .vocab-card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .vocab-card-english {
    word-break: break-word;
    font-size: var(--text-xl) !important;
  }

  /* Ensure proper touch targets (minimum 44px) */
  .quiz-option {
    min-height: 48px !important;
    padding: 1rem !important;
  }

  .btn, .flashcard-btn, .btn-complete {
    min-height: 44px !important;
    padding: 0.75rem 1.25rem !important;
  }

  /* Better readability on small screens */
  .hero-stat-value {
    font-size: var(--text-3xl) !important;
  }

  .hero-stat-label {
    font-size: 0.75rem;
  }

  /* Navbar adjustments for mobile */
  .navbar-streak, .navbar-xp {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }

  /* Better spacing for mobile sections */
  .section {
    padding-block: var(--space-10);
  }

  /* Ensure cards don't get too cramped */
  .glass-card, .lesson-card, .feature-card {
    padding: var(--space-5) !important;
  }

  /* Fix CTA buttons on mobile */
  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 100%;
  }

  /* Better quiz experience on mobile */
  .quiz-question-text {
    font-size: var(--text-lg);
    line-height: 1.6;
  }

  /* Flashcard improvements */
  .flashcard-wrapper {
    height: 280px;
  }

  /* Ensure forms are usable */
  .input, .textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
  }
}

/* ─── Email Capture Modal ─── */
.email-capture-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

.email-capture-overlay.active {
  display: flex;
}

.email-capture-modal {
  background: var(--glass-bg-solid);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: 2.5rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--glass-shadow-lg);
  text-align: center;
  position: relative;
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.email-capture-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.email-capture-close:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
  transform: rotate(90deg);
}

.email-capture-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.email-capture-modal h2 {
  margin-bottom: 0.75rem;
}

.email-capture-modal p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.email-capture-form input[type="email"] {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--glass-border-subtle);
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}

.email-capture-form input[type="email"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.email-capture-skip {
  margin-top: 0.75rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: underline;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.email-capture-skip:hover {
  opacity: 1;
}

/* ─── Social Sharing Cards ─── */
.share-card-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-top: var(--space-6);
}

.share-buttons {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  color: white;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.share-btn-facebook {
  background: #1877f2;
}

.share-btn-twitter {
  background: #1da1f2;
}

.share-btn-whatsapp {
  background: #25d366;
}

.share-btn-download {
  background: var(--gradient-primary);
}

/* ─── Live User Counter ─── */
.live-counter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  animation: fadeInUp 0.6s ease;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* ─── Trust Badges ─── */
.trust-badges {
  display: flex;
  gap: 2rem;
  justify-content: center;
  padding: 2rem 1rem;
  opacity: 0.7;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.trust-badges > div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── FAQ Section ─── */
.faq-section {
  margin-top: var(--space-12);
}

.faq-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  cursor: pointer;
  transition: all 0.2s ease;
}

.faq-item:hover {
  box-shadow: var(--glass-shadow);
  transform: translateY(-2px);
}

.faq-question {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-toggle {
  font-size: 1.5rem;
  color: var(--color-primary);
  transition: transform 0.3s ease;
}

.faq-item.open .faq-toggle {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  color: var(--text-secondary);
  margin-top: 0;
}

.faq-item.open .faq-answer {
  max-height: 500px;
  margin-top: var(--space-3);
}

/* ─── Exit Intent Popup ─── */
.exit-intent-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.exit-intent-overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.exit-intent-content {
  background: var(--glass-bg-solid);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: 3rem 2rem;
  max-width: 550px;
  width: 100%;
  text-align: center;
  box-shadow: var(--glass-shadow-lg);
  animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.exit-intent-content h2 {
  margin-bottom: 1rem;
}

.exit-intent-content p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ─── Referral Card ─── */
.referral-card {
  background: var(--gradient-primary-soft);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-top: var(--space-6);
  text-align: center;
}

.referral-link-box {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
  align-items: stretch;
}

.referral-link-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: white;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  text-align: center;
}

.copy-link-btn {
  padding: var(--space-3) var(--space-5);
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.copy-link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.copy-link-btn.copied {
  background: var(--gradient-success);
}

/* ─── Performance: Loading States ─── */
.skeleton-loader {
  background: linear-gradient(
    90deg,
    rgba(99, 102, 241, 0.06) 25%,
    rgba(99, 102, 241, 0.12) 50%,
    rgba(99, 102, 241, 0.06) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── Improved CTA Hierarchy ─── */
.cta-primary-large {
  font-size: 1.25rem !important;
  padding: 1.25rem 3rem !important;
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.25);
}

.cta-primary-large:hover {
  box-shadow: 0 16px 32px rgba(99, 102, 241, 0.35);
}

.cta-subtext {
  display: block;
  margin-top: 0.5rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── Responsive Image Optimization ─── */
img {
  max-width: 100%;
  height: auto;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ─── Accessibility Improvements ─── */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 100;
}

.skip-to-content:focus {
  top: 0;
}

/* ─── Print Styles ─── */
@media print {
  .navbar, .footer, .mobile-menu,
  .btn, .share-buttons, .toast-container {
    display: none !important;
  }
}
