/* ============================================================
   Samarth Neuro & Superspeciality Hospital - Mobile Styles
   Comprehensive responsive overrides for all devices.
   ============================================================ */

/* ============================================================
   SAAS NAVBAR — MOBILE FIXES
   ============================================================ */

/* On small screens: make the pill navbar span full width, sit flush to top */
@media (max-width: 768px) {
  .saas-navbar {
    top: 0;
    width: 100%;
    left: 0;
    transform: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .saas-navbar-inner {
    padding: 10px 16px;
  }

  /* Ensure hamburger is always visible */
  .mobile-menu-btn {
    display: flex !important;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    margin-left: auto;
  }

  .mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
  }

  /* Mobile menu dropdown */
  #mobileMenu {
    display: none;
    background: var(--bg-surface, rgba(0, 0, 0, 0.2));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 0 16px;
  }
  #mobileMenu.active {
    display: block;
  }

  #mobileMenu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    color: #e4e4e7;
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition:
      background 0.2s,
      padding-left 0.2s;
  }
  #mobileMenu a:last-child {
    border-bottom: none;
  }
  #mobileMenu a:hover,
  #mobileMenu a:active {
    background: rgba(255, 255, 255, 0.05);
    padding-left: 28px;
  }
  #mobileMenu .mobile-emergency-btn {
    margin: 10px 16px 0;
    display: flex !important;
    justify-content: center;
    padding: 13px 20px !important;
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    color: white !important;
    border-radius: 10px;
    font-weight: 700;
    border-bottom: none !important;
    border: none;
  }

  /* Hide desktop CTA links on mobile */
  .saas-navbar-cta {
    display: none !important;
  }

  /* Body padding to avoid content going under fixed navbar */
  /* (Doesn't apply to pages with saas-hero since it has its own top padding) */
  body:not(:has(.saas-hero)) {
    padding-top: 60px;
  }

  /* Pages with explicit top padding (service pages, etc.) should account for navbar */
  .sp-breadcrumb {
    padding-top: 20px !important;
  }

  /* Reduce large fixed-navbar offsets that were set for desktop fixed navbar */
  .doctor-section[style*="padding-top: 140px"] {
    padding-top: 70px !important;
  }
  .about-section[style*="padding-top: 120px"] {
    padding-top: 70px !important;
  }
  .services-section[style*="padding-top: 60px"],
  .services-section[style*="padding-top:60px"] {
    padding-top: 40px !important;
  }
}

@media (max-width: 480px) {
  .saas-navbar-inner {
    padding: 8px 12px;
  }
  .saas-logo img {
    height: 34px !important;
  }
}

/* ============================================================
   HERO SECTION — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .saas-hero {
    padding: 72px 16px 40px;
    min-height: 100svh;
  }
  .saas-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  .saas-desc {
    font-size: 1rem;
  }
  .saas-actions {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  .saas-btn-primary,
  .saas-btn-secondary {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .saas-badge {
    font-size: 12px;
  }
}

/* ============================================================
   STATS BANNER — MOBILE
   ============================================================ */
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px;
  }
  .stat-card .number {
    font-size: 2rem;
  }
  .stat-card .label {
    font-size: 0.78rem;
    letter-spacing: 1px;
  }
}

/* ============================================================
   ABOUT SECTION — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr !important;
    gap: 32px;
  }
  .about-img-main img {
    height: 280px;
  }
  .about-img-secondary {
    display: none;
  }
  .experience-badge {
    width: 88px;
    height: 88px;
    top: 12px;
    left: 12px;
  }
  .experience-badge .years {
    font-size: 1.5rem;
  }
  .about-features {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .feature-item {
    padding: 12px;
  }
}

@media (max-width: 420px) {
  .about-features {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   SERVICES PAGE HERO — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .services-page-hero {
    padding: 80px 0 40px !important;
  }
  .services-page-hero h1 {
    font-size: clamp(1.7rem, 6vw, 2.2rem) !important;
  }
  .services-page-hero p {
    font-size: 0.95rem !important;
  }
}

/* ============================================================
   SERVICE CARDS — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .services-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  .service-card {
    /* Padding handled by .card-body */
  }
  /* Responsive marquee adjustments */
  .marquee-container {
    padding: 10px 0;
    -webkit-mask-image: linear-gradient(
      to right,
      transparent,
      black 8%,
      black 92%,
      transparent
    );
    mask-image: linear-gradient(
      to right,
      transparent,
      black 8%,
      black 92%,
      transparent
    );
  }
  .marquee-grid {
    --marquee-gap: 16px;
    animation-duration: 60s; /* slightly faster for smaller screens */
  }
  .marquee-grid > * {
    width: 280px;
  }
}

/* ============================================================
   DOCTOR SECTION — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .doctor-grid {
    grid-template-columns: 1fr !important;
    gap: 28px;
  }
  .doctor-image-main img {
    aspect-ratio: 1 / 1.1;
    height: auto;
    object-position: center top;
  }
  .doctor-image-main::after {
    height: 120px;
  }
  .qualification-badge {
    right: 10px;
    font-size: 0.72rem;
    padding: 8px 14px;
  }
  .doctor-secondary-card {
    flex-direction: column !important;
    text-align: center;
    padding: 24px 20px;
    gap: 20px;
  }
  .doctor-secondary-action {
    margin-left: 0 !important;
    width: 100%;
  }
  .doctor-secondary-action .saas-btn-white {
    width: 100%;
    justify-content: center;
    display: flex;
  }
  .doctor-secondary-info .section-tag {
    margin: 0 auto 12px;
  }
}

@media (max-width: 480px) {
  .doctor-image-main img {
    height: 300px;
  }
}

/* ============================================================
   DIAGNOSTICS GRID — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .diagnostics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  .diagnostic-card {
    padding: 20px 12px;
  }
  .diagnostic-icon {
    font-size: 1.8rem;
  }
  .diagnostic-card h3 {
    font-size: 0.9rem;
  }
  .diagnostic-card p {
    font-size: 0.78rem;
  }
}

/* ============================================================
   WHY CHOOSE US — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .why-grid {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }
  .why-image-area {
    display: none;
  }
  .why-item {
    padding: 16px;
    gap: 12px;
  }
  .why-item-icon {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
}

/* ============================================================
   TESTIMONIALS — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .testimonials-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  .testimonial-card {
    padding: 22px 18px;
  }
  .testimonial-text {
    font-size: 0.87rem;
  }
}

/* Swipeable on small phones */
@media (max-width: 540px) {
  .testimonials-grid {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 16px;
    padding-bottom: 12px;
    scrollbar-width: none;
  }
  .testimonials-grid::-webkit-scrollbar {
    display: none;
  }
  .testimonial-card {
    min-width: 82vw;
    scroll-snap-align: center;
    flex-shrink: 0;
  }
}

/* ============================================================
   APPOINTMENT / CONTACT SECTION — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .appointment-grid {
    grid-template-columns: 1fr !important;
    gap: 32px;
  }
  .appointment-form {
    padding: 24px 18px;
  }
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0;
  }
  .contact-detail {
    gap: 12px;
  }
  .contact-detail-icon {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  /* Emergency CTA box — stack vertically on mobile */
  .contact-emergency-cta {
    flex-direction: column !important;
    text-align: center;
  }
}

/* ============================================================
   MAP SECTION — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .map-layout {
    grid-template-columns: 1fr !important;
    border-radius: 16px;
  }
  .map-info-panel {
    border-right: none !important;
    border-bottom: 1px solid var(--border-color);
    padding: 28px 20px;
  }
  .map-container {
    min-height: 280px;
  }
  .map-container iframe {
    height: 280px;
  }
}

/* ============================================================
   FOOTER — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .footer {
    padding: 48px 0 0;
  }
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px;
    margin-bottom: 32px;
  }
  .footer-desc {
    max-width: 100%;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .footer-bottom-links {
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
  }
}

/* ============================================================
   FLOATING ACTION BUTTONS — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .emergency-float {
    bottom: 16px;
    right: 14px;
    gap: 10px;
  }
  .float-btn {
    padding: 10px 16px;
    font-size: 0.82rem;
    gap: 8px;
  }
  .float-btn span.icon {
    font-size: 1rem;
  }
  .scroll-top {
    bottom: 20px;
    right: 68px;
    width: 40px;
    height: 40px;
    font-size: 0.88rem;
  }
}

@media (max-width: 420px) {
  .emergency-float {
    bottom: 12px;
    right: 10px;
  }
  .float-btn {
    padding: 9px 13px;
    font-size: 0.78rem;
  }
  /* Stack float buttons vertically on tiny phones */
  .float-btn .float-label {
    display: none; /* hide text, show only icons */
  }
  .scroll-top {
    right: 58px;
    width: 36px;
    height: 36px;
  }
}

/* ============================================================
   SERVICE DETAIL PAGES — Additional overrides
   (Main responsive rules are in service-page.css)
   ============================================================ */

/* Ensure the list item button in the symptoms section is full-width on mobile */
@media (max-width: 768px) {
  .sp-text-col .saas-btn-primary {
    display: flex !important;
    width: 100%;
    justify-content: center;
    max-width: 300px;
  }

  /* Smooth FAQ opening animation */
  .sp-faq-item[open] .sp-faq-a {
    animation: fadeInDown 0.2s ease;
  }

  /* Section tags centered on mobile */
  .sp-section .section-tag {
    margin: 0 auto 12px !important;
    text-align: center;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   GALLERY — MOBILE (disable absolute masonry, use grid)
   ============================================================ */
@media (max-width: 768px) {
  .masonry-gallery-container {
    position: static !important;
    height: auto !important;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .masonry-item {
    position: static !important;
    transform: none !important; /* Disables JS translate */
    width: 100% !important;
    height: 180px !important;
    border-radius: 10px;
  }
  .masonry-item-title {
    opacity: 1;
  }
}

@media (max-width: 420px) {
  .masonry-gallery-container {
    grid-template-columns: 1fr;
  }
  .masonry-item {
    height: 200px !important;
  }
}

/* ============================================================
   DOCTORS PAGE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .doctors-grid,
  [class*="doctors-grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   ANNOUNCEMENT BAR — MOBILE
   ============================================================ */
@media (max-width: 600px) {
  .announcement-bar {
    font-size: 0.72rem;
    padding: 7px 12px;
    line-height: 1.4;
  }
}

/* ============================================================
   TOUCH UX — Prevent hover-only effects on touch devices
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  .service-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
  .service-card:active {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
  }
  .diagnostic-card:hover {
    transform: none;
  }
  .diagnostic-card:active {
    transform: translateY(-4px);
  }
  .testimonial-card:hover {
    transform: none;
  }
  .why-item:hover {
    transform: none;
  }
  .feature-item:hover {
    transform: none;
  }
  .sp-why-item:hover {
    transform: none;
  }
  .sp-step:hover {
    box-shadow: none;
  }
  .btn-primary:hover,
  .btn-accent:hover {
    transform: none;
  }
  /* Ensure floating cards don't wobble on scroll */
  .floating-info-card {
    animation: none !important;
  }
}

/* ============================================================
   GENERAL OVERFLOW PROTECTION
   ============================================================ */
html,
body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Minimum tap target sizes */
@media (max-width: 768px) {
  a,
  button {
    min-height: 44px;
  }
  .nav-links a,
  .footer-links a,
  .saas-nav-links a {
    min-height: unset;
  }
  /* Smooth iOS scroll */
  html,
  body {
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================================
   SMALL TABLETS (≤900px)
   ============================================================ */
@media (max-width: 900px) {
  .saas-navbar {
    top: 0;
    width: 100%;
    left: 0;
    transform: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
  }
  body:not(:has(.saas-hero)) {
    padding-top: 60px;
  }
  .doctor-grid {
    grid-template-columns: 1fr !important;
  }
  .why-grid {
    grid-template-columns: 1fr !important;
  }
  .about-grid {
    grid-template-columns: 1fr !important;
  }
  .appointment-grid {
    grid-template-columns: 1fr !important;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .diagnostics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .testimonials-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .saas-navbar-cta {
    display: none !important;
  }
  .mobile-menu-btn {
    display: flex !important;
  }
}

/* ============================================================
   VERY SMALL PHONES (≤360px)
   ============================================================ */
@media (max-width: 360px) {
  .container {
    padding: 0 12px;
  }
  .saas-title {
    font-size: 1.7rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px;
  }
  .diagnostics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .service-card {
    /* Padding handled by .card-body */
  }
  .float-btn {
    padding: 8px 11px;
    font-size: 0.74rem;
  }
  .footer-grid {
    grid-template-columns: 1fr !important;
  }
}
