/* ==========================================================================
   N SQUARE DENTAL CLINIC - Master Responsive & Mobile Stylesheet
   Covers: 320px, 360px, 375px, 390px, 414px, 480px, 768px, 820px, 1024px, 1280px, 1440px+
   ========================================================================== */

/* Global Reset & Overflow Protection */
html, body {
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100vw;
  overflow-x: hidden;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  position: relative;
}

/* Image & Media Fluidity */
img, video, iframe, svg, canvas {
  max-width: 100%;
  height: auto;
}

iframe {
  width: 100% !important;
}

/* Touch Target Standards */
a, button, input, select, textarea {
  touch-action: manipulation;
}

/* Table Responsiveness Wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   1. Laptop & Large Screen Adjustments (1024px - 1439px)
   -------------------------------------------------------------------------- */
@media (max-width: 1439.98px) {
  .hero-heading {
    font-size: clamp(2.25rem, 4vw, 3.5rem);
  }
}

/* --------------------------------------------------------------------------
   2. Tablet & Mobile Navigation Breakpoint (< 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1023.98px) {
  /* Header Adjustments */
  header.sticky {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  
  /* Prevent Header Text Wrap */
  header .leading-tight {
    white-space: nowrap;
  }

  /* Grid Stack Defaults */
  .grid-cols-12 > div {
    grid-column: span 12 / span 12;
  }

  /* Section Spacing */
  section {
    padding-top: 3.5rem !important;
    padding-bottom: 3.5rem !important;
  }

  /* Responsive Typography Scaling */
  h1, .text-5xl, .text-6xl, .text-4xl {
    font-size: clamp(1.85rem, 5vw, 2.75rem) !important;
    line-height: 1.2 !important;
  }

  h2, .text-3xl {
    font-size: clamp(1.5rem, 4vw, 2rem) !important;
    line-height: 1.25 !important;
  }

  h3, .text-2xl {
    font-size: clamp(1.25rem, 3.5vw, 1.5rem) !important;
  }

  /* Mobile Drawer Positioning */
  #mobile-menu-drawer {
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Before/After Image Slider Container */
  .before-after-container {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* --------------------------------------------------------------------------
   3. Tablet Specific (768px - 1023px)
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .grid-cols-2-md {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .grid-cols-3-md {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* --------------------------------------------------------------------------
   4. Mobile Devices (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  /* Prevent Sticky Bottom Bar from Overlapping Footer Content inside dark footer */
  footer {
    padding-bottom: 80px;
  }

  /* Full Width Buttons on Mobile */
  .btn-mobile-full {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }

  /* Mobile Grid Stack */
  .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-6 {
    grid-template-columns: 1fr !important;
  }

  /* Padding Adjustments */
  .px-4-mobile {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .p-6-mobile {
    padding: 1.25rem !important;
  }

  /* Floating Dock Adjustments */
  .fixed.right-3 {
    right: 0.5rem !important;
  }

  .w-14.h-14, .w-16.h-16 {
    width: 2.75rem !important;
    height: 2.75rem !important;
  }
  
  /* Mobile Button Stacking in general containers */
  .hero-btn-wrapper, .sticky-cta-buttons {
    flex-direction: column !important;
    width: 100% !important;
    gap: 12px !important;
  }
  
  /* Feature cards & Content alignment fix */
  .feature-card, .ed-card {
    word-break: break-word;
    overflow: hidden;
  }
  
  /* Mobile Sticky Booking Bar */
  .fixed.bottom-0 {
    flex-direction: column !important;
    gap: 10px !important;
    padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
  }
  .fixed.bottom-0 > a, 
  .fixed.bottom-0 > button {
    width: 100% !important;
    flex: none !important;
  }

  /* Modal Dialog Center Fix */
  #booking-modal > div {
    max-width: 94vw !important;
    margin: 1rem auto !important;
    padding: 1.25rem !important;
  }

  /* Google Map Container Fix */
  .map-embed-container {
    height: 350px !important;
  }
}

/* Google Map Container Global Rule */
.map-embed-container {
  height: 500px;
  width: 100%;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
}

.map-embed-container iframe {
  width: 100% !important;
  height: 100% !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  border: 0 !important;
}

/* --------------------------------------------------------------------------
   5. Small Mobile Devices (320px - 479px)
   -------------------------------------------------------------------------- */
@media (max-width: 479.98px) {
  /* Extra Small Devices (320px, 360px, 375px) Typography */
  body {
    font-size: 13.5px !important;
  }

  h1, .text-4xl, .text-5xl {
    font-size: 1.65rem !important;
  }

  h2, .text-3xl {
    font-size: 1.35rem !important;
  }

  .text-xs {
    font-size: 11px !important;
  }

  /* Floating Widgets Small Screen Offset */
  .fixed.right-3 {
    bottom: 5rem !important;
    top: auto !important;
    transform: none !important;
  }

  /* Input fields padding */
  input, select, textarea {
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
    font-size: 13px !important;
  }

  /* Sticky Mobile Bar Safe Area */
  .fixed.bottom-0 {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom)) !important;
  }
}

/* --------------------------------------------------------------------------
   Doctor Image Interactive Grayscale Reveal (All Devices)
   -------------------------------------------------------------------------- */
#expert-dentists .ed-frame-outer,
#expert-dentists .ed-frame-inner {
  cursor: pointer;
}

#expert-dentists .ed-frame-inner img,
#expert-dentists img.ed-doctor-img {
  filter: grayscale(100%);
  transition: filter 0.4s ease, transform 0.4s ease;
  cursor: pointer;
  will-change: filter, transform;
}

#expert-dentists .ed-frame-outer.is-revealed .ed-frame-inner img,
#expert-dentists .ed-frame-inner.is-revealed img,
#expert-dentists .ed-card.is-revealed .ed-frame-inner img,
#expert-dentists img.is-revealed {
  filter: grayscale(0%) !important;
  transform: scale(1.02);
}

#expert-dentists .ed-reveal-hint {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#expert-dentists .ed-frame-outer.is-revealed .ed-reveal-hint,
#expert-dentists .ed-frame-inner.is-revealed .ed-reveal-hint,
#expert-dentists .ed-card.is-revealed .ed-reveal-hint {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(6px);
}
