/* ============================================================
   THE PROFESSOR GIRL — Mobile-First Responsive Stylesheet
   Full coverage: iOS Safari, Android Chrome, Firefox Mobile,
   Samsung Internet, low-end devices
   ============================================================ */

/* ── 1. Viewport & iOS/Android Meta Fixes ────────────────────
   These apply to ALL screen sizes as safe base rules.        */

/* Prevent tap highlight on iOS */
* { -webkit-tap-highlight-color: transparent; }

/* Smooth momentum scrolling on iOS */
html { -webkit-overflow-scrolling: touch; }

/* ── CRITICAL: Fix horizontal swipe black/white strip ──────────
   Occurs when any element exceeds viewport width.
   Applies to ALL devices.                                      */
html, body {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

/* Ensure canvas never overflows */
#particles-canvas {
  max-width: 100%;
  overflow: hidden;
}

/* ── Hero: btn-rose (Contact Us button) ───────────────────────*/
.btn-rose {
  background: linear-gradient(135deg, #E8A598, #D97B6A);
  color: #1A0050;
  font-weight: 700;
  border: none;
  box-shadow: 0 4px 20px rgba(232, 165, 152, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn-rose:hover {
  background: linear-gradient(135deg, #f0b8ac, #e08879);
  box-shadow: 0 8px 30px rgba(232, 165, 152, 0.5);
  transform: translateY(-2px);
}

/* ── Native Contact Form CSS ───────────────────────────────────*/
.native-form {
  background: #fff;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 8px 48px rgba(26, 0, 80, 0.08);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
}

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

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

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1A0050;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.req {
  color: #E8A598;
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid #e2e0f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1A0050;
  background: #fafafa;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: #7C3AED;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
  background: #fff;
}

.form-input::placeholder { color: #aaa; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237C3AED' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Checkbox grid */
.form-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f5f3ff;
  border: 1.5px solid #ede9ff;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #1A0050;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 44px;
  user-select: none;
}

.form-check:hover {
  background: #ede9ff;
  border-color: #7C3AED;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #7C3AED;
  flex-shrink: 0;
  cursor: pointer;
}

.form-check:has(input:checked) {
  background: #7C3AED;
  border-color: #7C3AED;
  color: #fff;
}

/* Submit area */
.form-submit-wrap {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
}

.form-submit-btn {
  min-width: 200px;
  position: relative;
}

.form-submit-btn .btn-loading {
  display: none;
}

.form-submit-btn.loading .btn-text {
  display: none;
}

.form-submit-btn.loading .btn-loading {
  display: inline;
}

.form-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.form-privacy {
  font-size: 0.78rem;
  color: #888;
  margin: 0;
}

/* Form messages */
.form-msg {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 1rem;
}

.form-msg-success {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  color: #166534;
}

.form-msg-error {
  background: #fff1f2;
  border: 1.5px solid #fda4af;
  color: #9f1239;
}

.form-msg-error a {
  color: #7C3AED;
  font-weight: 600;
}

/* enquiry trust badges */
.enquiry-trust {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.enquiry-trust-item {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Fix iOS Safari 100vh bug */
#hero {
  min-height: 100svh; /* svh = small viewport height, ignores browser chrome */
  min-height: -webkit-fill-available;
}

/* Prevent text inflation on landscape phone */
body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Safe-area insets for notch devices (iPhone X+, Android cutouts) */
#navbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
#footer  { padding-bottom: env(safe-area-inset-bottom); }
.whatsapp-btn { bottom: calc(1.5rem + env(safe-area-inset-bottom)); right: calc(1.5rem + env(safe-area-inset-right)); }
.back-to-top  { bottom: calc(1.5rem + env(safe-area-inset-bottom)); right: calc(5rem + env(safe-area-inset-right)); }

/* Touch target minimum 44×44px (Apple HIG / Android guideline) */
.btn, .nav-hamburger, .mobile-nav-links a,
.social-link, .back-to-top, .whatsapp-btn,
.subject-pill, .tutor-tag, .achievement-badge,
.feature-bullet, .plan-feature, .cookie-actions button {
  min-height: 44px;
  min-width: 44px;
}
.btn { display: inline-flex; align-items: center; justify-content: center; }

/* Force hardware acceleration on animated elements */
.hero-card-wrap, .tutor-card, .feature-card,
.blog-card, .pricing-card, .testimonial-card {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}

/* Tutor card CTA: always visible on touch devices
   (hover states don't work on mobile) */
.tutor-card-cta {
  opacity: 1 !important;
  transform: none !important;
}

/* Remove hover transforms on touch — prevents stuck states */
@media (hover: none) {
  .tutor-card:hover,
  .feature-card:hover,
  .blog-card:hover,
  .pricing-card:hover,
  .subject-pill:hover,
  .btn:hover {
    transform: none;
  }
  .hero-card-wrap { animation: none; }
}

/* ── 2. Swiper — Mobile Touch Improvements ───────────────────── */
.swiper-button-prev,
.swiper-button-next {
  width: 44px !important;
  height: 44px !important;
}

/* ═══════════════════════════════════════════════════════════════
   BREAKPOINT: 1280px — Large tablets / small laptops
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  .nav-links a { font-size: .8rem; padding: .5rem .6rem; }
  .hero-inner  { gap: 2rem; }
  .stats-grid  { grid-template-columns: repeat(3, 1fr); }
  .stat-item   { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .stat-item:nth-last-child(-n+3) { border-bottom: none; }
}

/* ═══════════════════════════════════════════════════════════════
   BREAKPOINT: 1024px — Tablet landscape / small desktop
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --section-pad: 80px; }

  /* Nav */
  .nav-links, .nav-cta { display: none; }
  .nav-hamburger { display: flex; }
  .nav-logo span { font-size: 1.1rem; }

  /* Hero: stack vertically */
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 3rem 0 2.5rem;
    gap: 2rem;
  }
  .hero-sub    { margin-left: auto; margin-right: auto; }
  .hero-trust  { justify-content: center; }
  .hero-actions { justify-content: center; }
  .hero-card-wrap { justify-content: center; }
  .live-class-card { max-width: 420px; margin: 0 auto; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .stat-item  { border-right: none; padding: 1.25rem .75rem; }

  /* Features */
  .features-grid { grid-template-columns: repeat(2, 1fr); }

  /* Tutors */
  .tutors-grid { grid-template-columns: repeat(2, 1fr); }

  /* Subjects */
  .steps-flow { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
  .steps-flow::before { display: none; }

  /* Live */
  .live-feature { grid-template-columns: 1fr; gap: 2rem; direction: ltr !important; }
  .live-feature.reverse { direction: ltr; }
  .live-feature.reverse > * { direction: ltr; }

  /* Pricing */
  .pricing-grid { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; }
  .pricing-card.featured { transform: none; }

  /* Blog */
  .blog-grid { grid-template-columns: repeat(2, 1fr); }

  /* Enquiry */
  .enquiry-wrap { grid-template-columns: 1fr; gap: 2.5rem; }
  .form-iframe-wrap { padding-top: 120%; }

  /* Footer */
  .footer-top { grid-template-columns: repeat(2, 1fr); gap: 2rem; }
}

/* ═══════════════════════════════════════════════════════════════
   BREAKPOINT: 768px — Tablet portrait / large phone landscape
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --section-pad: 60px; --nav-h: 64px; }

  /* Container */
  .container { padding: 0 1.25rem; }

  /* Typography */
  .section-title  { font-size: clamp(1.6rem, 5.5vw, 2.2rem); }
  .section-sub    { font-size: 1rem; margin-bottom: 2.5rem; }

  /* Nav logo truncation */
  .nav-logo span  { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Hero */
  .hero-title     { font-size: clamp(1.9rem, 6vw, 2.8rem); }
  .hero-sub       { font-size: .95rem; }
  .hero-actions   { flex-direction: column; align-items: stretch; gap: .75rem; }
  .hero-actions .btn { text-align: center; justify-content: center; width: 100%; }
  .hero-trust     { gap: .75rem; justify-content: center; }
  .trust-badge    { font-size: .75rem; }
  .live-class-card { max-width: 100%; padding: 1.25rem; }

  /* Stats */
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .stat-num    { font-size: 1.8rem; }
  .stat-label  { font-size: .72rem; }
  .stat-item   { padding: 1rem .5rem; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .stat-item:nth-child(even) { border-left: 1px solid rgba(255,255,255,0.06); }
  .stat-item:last-child { border-bottom: none; }

  /* Features — single column */
  .features-grid { grid-template-columns: 1fr; }
  .feature-card  { padding: 1.5rem; }

  /* Tutors — single column */
  .tutors-grid { grid-template-columns: 1fr; }

  /* Steps — single column */
  .steps-flow { grid-template-columns: 1fr; gap: 1rem; }
  .step-item  { padding: 0 0 1.5rem; display: flex; align-items: flex-start; text-align: left; gap: 1rem; }
  .step-num   { width: 52px; height: 52px; font-size: 1.2rem; flex-shrink: 0; margin: 0; }
  .step-icon  { display: none; }

  /* Live classes */
  .live-img-wrap img { height: 220px; }
  .feature-bullets   { gap: .4rem; }

  /* Testimonial card */
  .testimonial-card { padding: 1.5rem; }
  .testi-quote      { font-size: .9rem; }

  /* Pricing */
  .pricing-grid  { grid-template-columns: 1fr; max-width: 100%; }
  .pricing-card  { padding: 2rem 1.5rem; }
  .price-amount  { font-size: 2.5rem; }
  .pricing-toggle { gap: .75rem; }

  /* Blog */
  .blog-grid { grid-template-columns: 1fr; }

  /* Enquiry */
  .enquiry-wrap { grid-template-columns: 1fr; gap: 2rem; }
  .enquiry-text h2 { font-size: clamp(1.5rem, 5vw, 2rem); }
  .form-iframe-wrap { padding-top: 140%; }

  /* Footer */
  .footer-top    { grid-template-columns: 1fr; gap: 2rem; }
  .footer-bottom { flex-direction: column; gap: 1rem; align-items: flex-start; }
  .footer-legal  { flex-wrap: wrap; gap: .75rem; }

  /* Cookie banner */
  .cookie-inner  { flex-direction: column; gap: 1rem; align-items: flex-start; }
  .cookie-actions { flex-direction: row; width: 100%; }
  .cookie-actions .btn { flex: 1; justify-content: center; }

  /* Floating buttons */
  .whatsapp-btn  { bottom: 1rem; right: 1rem; width: 52px; height: 52px; }
  .back-to-top   { bottom: 1rem; right: 5rem; width: 44px; height: 44px; }
}

/* ═══════════════════════════════════════════════════════════════
   BREAKPOINT: 480px — Small phones (SE, Galaxy A series, etc.)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  :root { --section-pad: 48px; --nav-h: 60px; }

  .container { padding: 0 1rem; }

  /* Nav logo — very small */
  .nav-logo span  { font-size: 1rem; max-width: 130px; }
  .nav-logo-icon  { width: 36px; height: 36px; font-size: 1rem; }

  /* Hero */
  .hero-title  { font-size: clamp(1.65rem, 7vw, 2rem); }
  .hero-badge  { font-size: .72rem; padding: .35rem .8rem; }
  .hero-sub    { font-size: .9rem; }
  .trust-badge { font-size: .7rem; }
  .hero-trust  { gap: .5rem; }

  /* Live class card */
  .lc-header   { gap: .75rem; }
  .lc-avatar   { width: 46px; height: 46px; }
  .lc-name     { font-size: .9rem; }
  .lc-subject  { font-size: 1rem; }

  /* Stats */
  .stats-grid  { grid-template-columns: 1fr 1fr; }
  .stat-num    { font-size: 1.6rem; }

  /* Tutor card */
  .tutor-avatar { width: 80px; height: 80px; }
  .tutor-stats  { gap: 1rem; }
  .tutor-tags   { gap: .3rem; }

  /* Steps horizontal layout maintained */
  .step-num   { width: 46px; height: 46px; font-size: 1.1rem; }

  /* Subjects pills — wrap more tightly */
  .subjects-pills { gap: .4rem; }
  .subject-pill   { font-size: .78rem; padding: .35rem .8rem; }

  /* Pricing */
  .pricing-card      { padding: 1.75rem 1.25rem; }
  .price-amount      { font-size: 2.25rem; }
  .pricing-toggle    { flex-wrap: wrap; justify-content: center; gap: .5rem; }
  .annual-badge      { width: 100%; text-align: center; }
  .plan-feature      { font-size: .82rem; }

  /* Blog */
  .blog-img  { height: 180px; }
  .blog-body { padding: 1.25rem; }

  /* Enquiry */
  .form-iframe-wrap { padding-top: 160%; }
  .enquiry-contact  { font-size: .82rem; }

  /* Section typography */
  .section-title { font-size: clamp(1.5rem, 6.5vw, 1.9rem); }
  .section-sub   { font-size: .9rem; margin-bottom: 2rem; }

  /* Footer */
  .footer-logo span { font-size: 1.1rem; }
  .social-links     { gap: .5rem; }
  .social-link      { width: 40px; height: 40px; }
  .footer-links a   { font-size: .85rem; }
}

/* ═══════════════════════════════════════════════════════════════
   BREAKPOINT: 360px — Lowest-spec phones (Budget Android)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
  :root { --section-pad: 40px; --nav-h: 56px; }

  .container { padding: 0 .875rem; }
  .hero-title { font-size: 1.55rem; }
  .hero-badge { display: none; } /* Too tight on 360px */
  .btn-lg     { padding: .9rem 1.5rem; font-size: .95rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .tutor-stats { gap: .6rem; }
  .live-class-card { padding: 1rem; }
  .pricing-card { padding: 1.5rem 1rem; }
  .testimonial-card { padding: 1.25rem; }
  .blog-body  { padding: 1rem; }
}

/* ═══════════════════════════════════════════════════════════════
   CROSS-BROWSER COMPATIBILITY FIXES
   ═══════════════════════════════════════════════════════════════ */

/* Firefox: backdrop-filter fallback */
@supports not (backdrop-filter: blur(1px)) {
  #navbar.scrolled          { background: rgba(8, 0, 24, 0.97); }
  #mobile-nav               { background: rgba(8, 0, 24, 0.99); }
  .live-class-card          { background: rgba(26, 0, 80, 0.92); }
  .testimonial-card         { background: rgba(26, 0, 80, 0.88); }
  .feature-card             { background: rgba(255,255,255,0.08); }
}

/* Firefox: gradient text fallback */
@-moz-document url-prefix() {
  .hero-title .accent {
    -webkit-text-fill-color: unset;
    background: none;
    color: var(--c-accent-2);
  }
}

/* Samsung Internet: flex gap fallback */
@supports not (gap: 1rem) {
  .nav-links    { gap: 0; }
  .nav-links a  { margin: 0 .3rem; }
  .hero-trust   { gap: 0; }
  .trust-badge  { margin: .4rem .5rem; }
  .features-grid .feature-card  { margin: .75rem; }
  .subjects-pills .subject-pill { margin: .3rem; }
}

/* ── iOS Safari scroll rubber-band fix for fixed nav ────────── */
@supports (-webkit-touch-callout: none) {
  #mobile-nav { padding-bottom: env(safe-area-inset-bottom); }
  body { position: relative; }
}

/* ── Reduced motion: disable all animations ────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .hero-card-wrap { animation: none; }
  #particles-canvas { display: none; }
}

/* ── Low data / save-data mode ─────────────────────────────── */
@media (prefers-reduced-data: reduce) {
  .bg-orb         { display: none; }
  #particles-canvas { display: none; }
  .hero-deco-line { display: none; }
}

/* ── Dark mode system preference (phone dark mode) ─────────── */
/* The site is already mostly dark — just refine light sections */
@media (prefers-color-scheme: dark) {
  #tutors   { background: #f8f5ff; }
  #how      { background: #f0ebff; }
  #live     { background: #f8f5ff; }
  #pricing  { background: #f8f5ff; }
  #blog     { background: #f8f5ff; }
  #enquiry  { background: linear-gradient(135deg,#ede5ff 0%,#e0d4ff 100%); }
}

/* ── Print styles ──────────────────────────────────────────── */
@media print {
  #navbar, #mobile-nav, .whatsapp-btn, .back-to-top,
  #cookie-banner, #particles-canvas, .bg-orb { display: none !important; }
  body { background: #fff; color: #000; }
  .hero-title .accent { -webkit-text-fill-color: var(--c-accent); color: var(--c-accent); }
  a::after { content: " (" attr(href) ")"; font-size: .75em; }
  #hero, #stats, #why, #testimonials { background: #f0ebff !important; }
}

/* ── Mobile Nav: ensure full-width on very small screens ────── */
@media (max-width: 768px) {
  #mobile-nav { padding: 1rem 1rem 1.5rem; }
  .mobile-nav-links a {
    font-size: 1rem;
    padding: .75rem 1rem;
    border-radius: var(--radius-md);
    min-height: 48px;
    display: flex;
    align-items: center;
  }
  #mobile-nav .btn {
    min-height: 48px;
    font-size: .95rem;
    padding: .9rem 1.5rem;
    width: 100%;
    text-align: center;
    justify-content: center;
    margin-top: .5rem;
  }
}

/* ── Testimonials Swiper: bigger dots on mobile ─────────────── */
@media (max-width: 768px) {
  .swiper-pagination-bullet       { width: 10px !important; height: 10px !important; }
  .swiper-button-prev,
  .swiper-button-next             { display: none !important; }
  .swiper { padding-bottom: 3.5rem !important; }
}

/* ── Image object-position fix on portrait phones ───────────── */
@media (max-width: 480px) {
  .tutor-avatar img { object-position: center top; }
  .live-img-wrap img { height: 200px; object-fit: cover; }
}

/* ── Fix footer grid on narrow screens ─────────────────────── */
@media (max-width: 768px) {
  .footer-top { grid-template-columns: 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .footer-copy { order: 2; }
  .footer-legal { order: 1; }
}

/* ── Fix scroll progress bar z-index on mobile ─────────────── */
#scroll-progress { z-index: 1001; }

/* ── Form: single column on mobile ─────────────────────────── */
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .native-form {
    padding: 1.25rem;
    border-radius: 16px;
  }

  .form-checkboxes {
    grid-template-columns: 1fr 1fr;
  }

  .form-submit-btn {
    width: 100%;
    min-width: unset;
  }

  .form-submit-wrap {
    align-items: stretch;
  }
}

/* ── Hero: 3 buttons stack neatly on mobile ─────────────────── */
@media (max-width: 640px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .hero-actions .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

/* ── Touch: form inputs get minimum 44px height ─────────────── */
@media (hover: none) {
  .form-input,
  .form-select,
  .form-textarea,
  .form-check,
  .form-submit-btn {
    min-height: 44px;
  }
  /* Remove hover states from form checkboxes */
  .form-check:hover {
    background: #f5f3ff;
    border-color: #ede9ff;
  }
}
