/* ============================================================
   MUTUALDIVORCE.CO.IN — ENHANCE.CSS
   Version: 1.0 | June 2026
   
   ADDITIVE ONLY — does not override core style.css
   Fixes: Mobile layout, video player, form UX, touch targets
   ============================================================ */


/* ============================================================
   1. GLOBAL MOBILE GUARDS
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-text-size-adjust: 100%;
}

img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

table {
  overflow-x: auto;
  display: block;
  -webkit-overflow-scrolling: touch;
}

/* Minimum touch target size */
button, a, input, select, textarea,
[role="button"] {
  min-height: 44px;
}

/* ============================================================
   2. SKIP LINK — hidden until focused
   ============================================================ */
.skip-link {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  padding: 12px 20px;
  background: #0A2540;
  color: #fff;
  z-index: 9999;
  font-weight: 700;
}


/* ============================================================
   3. STICKY TOP BAR — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .sticky-top-bar {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 6px 12px !important;
    height: auto !important;
    min-height: 48px !important;
    gap: 8px !important;
  }

  .alert-text {
    display: none !important;
  }

  .action-buttons {
    display: flex !important;
    gap: 10px !important;
    width: 100% !important;
    justify-content: center !important;
  }

  .btn-call,
  .btn-wa {
    flex: 1 !important;
    text-align: center !important;
    padding: 10px 8px !important;
    font-size: 0.88rem !important;
    border-radius: 6px !important;
    max-width: 48% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    font-weight: 700 !important;
    min-height: 40px !important;
  }

  :root {
    --sticky-bar-h: 48px;
    --total-offset: 108px;
  }
}


/* ============================================================
   4. MAIN HEADER — MOBILE
   ============================================================ */
.main-header {
  position: sticky;
  top: var(--sticky-bar-h, 48px);
  z-index: 998;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 16px;
  height: 56px;
}

@media (max-width: 900px) {
  .nav-links { display: none !important; }

  .nav-hamburger {
    display: flex !important;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px;
    min-height: 44px;
    min-width: 44px;
    align-items: center;
    justify-content: center;
  }

  .nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #0A2540;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
  }

  .logo {
    font-size: 1.1rem !important;
  }
}


/* ============================================================
   5. MOBILE NAV DRAWER — FULLSCREEN OVERLAY
   ============================================================ */
.mobile-nav {
  display: none !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 9998 !important;
  background: rgba(10, 37, 64, 0.7) !important;
  backdrop-filter: blur(4px);
  padding-top: 104px !important;
  overflow-y: auto !important;
}

.mobile-nav.open {
  display: block !important;
}

/* Inner white card */
.mobile-nav-inner {
  background: #fff;
  margin: 0 16px 32px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0,0,0,0.3);
}

.mobile-nav a {
  display: block !important;
  padding: 16px 20px !important;
  border-bottom: 1px solid #f0f0f0 !important;
  color: #0A2540 !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  background: #fff !important;
  transition: background 0.15s !important;
  min-height: 52px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.mobile-nav a:last-child {
  border-bottom: none !important;
}

.mobile-nav a:active,
.mobile-nav a:hover {
  background: #f5f7fa !important;
}

/* Body scroll lock when menu open */
body.menu-open {
  overflow: hidden !important;
  height: 100% !important;
}


/* ============================================================
   6. HERO SECTION — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .hero-section {
    padding: 20px 0 24px !important;
  }

  .hero-split {
    flex-direction: column !important;
    gap: 24px !important;
  }

  .hero-content {
    width: 100% !important;
    padding: 0 16px !important;
  }

  .hero-content h1 {
    font-size: 1.55rem !important;
    line-height: 1.2 !important;
  }

  .hero-video {
    width: 100% !important;
    padding: 0 16px !important;
    order: 2;
  }

  .hero-trust-strip {
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .trust-pill {
    font-size: 0.78rem !important;
    padding: 4px 10px !important;
  }

  .lead-form-card {
    padding: 20px 16px !important;
    margin: 0 !important;
  }

  .lead-form-card h3 {
    font-size: 1.15rem !important;
  }

  /* Prevent iOS zoom on input focus */
  .lead-form-card input,
  .lead-form-card select,
  .lead-form-card textarea {
    font-size: 16px !important;
  }
}


/* ============================================================
   7. VIDEO PLAYER — CLEAN INLINE HTML5
   ============================================================ */
.video-wrap {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.video-wrap video {
  width: 100%;
  height: auto;
  display: block;
  max-height: 360px;
  object-fit: contain;
  background: #000;
}

.video-caption {
  text-align: center;
  font-size: 0.88rem;
  color: #666;
  margin-top: 8px;
  font-weight: 600;
}

/* Video thumbnail click area */
.video-thumb-wrapper {
  position: relative;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
}

.video-thumb-wrapper img {
  width: 100%;
  display: block;
  border-radius: 10px;
}

.play-btn-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  background: rgba(224, 92, 27, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}

.play-btn-overlay:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(224, 92, 27, 1);
}

.play-btn-overlay svg {
  fill: white;
  margin-left: 4px;
}

/* Video lightbox */
.md-video-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.md-video-overlay.open {
  display: flex;
}

.md-video-box {
  position: relative;
  width: 100%;
  max-width: 840px;
}

.md-video-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 8px;
  min-height: 44px;
  min-width: 44px;
}

.md-video-box video {
  width: 100%;
  border-radius: 10px;
  background: #000;
  max-height: 80vh;
}


/* ============================================================
   8. FORM ENHANCEMENTS
   ============================================================ */

/* Valid field */
.lead-form input.md-valid,
.lead-form select.md-valid {
  border-color: #1b8a5a !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231b8a5a' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* Invalid field */
.lead-form input.md-invalid,
.lead-form select.md-invalid {
  border-color: #d32f2f !important;
  background-color: #fff5f5 !important;
}

/* Error message */
.md-field-error {
  display: block;
  color: #d32f2f;
  font-size: 0.82rem;
  margin-top: -10px;
  margin-bottom: 10px;
  padding-left: 2px;
}

.md-field-error:empty { display: none; }

/* Submit spinner */
.btn-submit.submitting {
  opacity: 0.8;
  cursor: not-allowed;
  pointer-events: none;
}

/* Success message */
.md-form-success {
  background: #e8f5e9;
  border: 1.5px solid #1b8a5a;
  border-radius: 8px;
  padding: 16px 20px;
  color: #1b8a5a;
  font-weight: 600;
  text-align: center;
  margin-top: 12px;
  display: none;
}

.md-form-success.show { display: block; }


/* ============================================================
   9. STICKY BOTTOM BAR — MOBILE
   ============================================================ */
body {
  padding-bottom: 72px;
}

@media (max-width: 768px) {
  .sticky-bottom-bar {
    padding: 8px 12px !important;
  }

  .desktop-text { display: none !important; }
  .desktop-btn-text { display: none !important; }
  .mobile-btn-text { display: inline !important; }

  .btn-bottom-action {
    width: 100% !important;
    padding: 14px !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    display: block !important;
    text-align: center !important;
  }
}


/* ============================================================
   10. FLOATING BUTTONS — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .floating-wa {
    bottom: 82px !important;
    right: 14px !important;
    width: 52px !important;
    height: 52px !important;
    font-size: 24px !important;
  }

  .back-to-top {
    bottom: 144px !important;
    right: 14px !important;
    width: 40px !important;
    height: 40px !important;
  }
}

@media (max-width: 380px) {
  .floating-wa {
    width: 48px !important;
    height: 48px !important;
    font-size: 22px !important;
  }
}


/* ============================================================
   11. GENERAL SECTIONS — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .container,
  .narrow-container {
    padding: 0 16px !important;
  }

  .content-section {
    padding: 32px 0 !important;
  }

  .section-heading h2 {
    font-size: 1.4rem !important;
  }

  .section-heading p {
    font-size: 0.95rem !important;
  }

  .mechanism-grid {
    flex-direction: column !important;
    gap: 16px !important;
  }

  .mechanism-card {
    width: 100% !important;
  }

  .process-timeline::before {
    left: 18px !important;
  }

  .step-number {
    width: 36px !important;
    height: 36px !important;
    font-size: 1rem !important;
    flex-shrink: 0 !important;
  }

  .footer-grid {
    flex-direction: column !important;
    gap: 28px !important;
  }

  .testimonials-grid {
    grid-template-columns: 1fr !important;
  }

  .guide-grid {
    grid-template-columns: 1fr !important;
  }

  .bio-grid {
    flex-direction: column !important;
  }

  .stats-row {
    flex-direction: column !important;
    gap: 12px !important;
  }

  .comparison-table {
    font-size: 0.88rem !important;
  }

  h1 { font-size: clamp(1.4rem, 5vw, 2rem) !important; }
  h2 { font-size: clamp(1.2rem, 4vw, 1.7rem) !important; }
  h3 { font-size: clamp(1rem, 3vw, 1.3rem) !important; }
  p  { font-size: 0.97rem !important; }

  /* PAN India pills */
  .city-pill {
    font-size: 0.78rem !important;
    padding: 4px 10px !important;
  }
}


/* ============================================================
   12. CALCULATOR — MOBILE
   ============================================================ */
@media (max-width: 600px) {
  .calculator-card {
    margin: 0 !important;
  }

  .slider-container {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .range-slider {
    width: 100% !important;
  }

  .slider-value {
    align-self: flex-end !important;
  }

  .result-box {
    padding: 20px 16px !important;
  }
}


/* ============================================================
   13. PAGE HERO — INNER PAGES MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .page-hero {
    padding: 32px 16px !important;
  }

  .page-hero h1 {
    font-size: 1.4rem !important;
  }

  .page-hero .hero-subtext {
    font-size: 0.95rem !important;
  }

  .breadcrumbs {
    font-size: 0.82rem !important;
    flex-wrap: wrap !important;
  }
}


/* ============================================================
   14. BCI MODAL — ENSURE VISIBLE
   ============================================================ */
#bciModal,
.bci-modal,
.bci-overlay {
  z-index: 10000 !important;
}

/* ============================================================
   MOBILE STICKY BAR OVERLAP FIX v3 — June 2026
   Root cause: .sticky-top-bar is position:fixed, overlaps 
   position:sticky .main-header on mobile.
   Fix: push main-header down by actual sticky-bar height.
   ============================================================ */
@media (max-width: 768px) {
  /* Sticky bar on mobile is ~80px (2 lines: text + buttons) */
  .main-header {
    top: 80px !important;
    position: sticky !important;
  }

  /* Ensure body content starts after both bars */
  body {
    padding-top: 0 !important;
  }

  /* Hero needs no extra padding since header is sticky not fixed */
  .hero-section {
    padding-top: 40px !important;
  }
}

@media (max-width: 480px) {
  .main-header {
    top: 85px !important;
  }

  .hero-section {
    padding-top: 32px !important;
  }
}
