/**
 * Homepage mobile / tablet layout fixes (index.html)
 */

#animsition-box {
  overflow-x: hidden;
  max-width: 100vw;
}

/*
 * Homepage only (not portal shells): restore reference layout —
 * clear space above logo (no clipping), nav vertically centered vs logo,
 * neutralize negative margins + hero overflow clip from legacy CSS.
 */
/* Shell tint matches hero top — removes 1px “seam” / contrast line under the browser edge */
#animsition-box.animsition-box:not(.portal-app-shell) {
  margin-top: 0 !important;
  padding-top: 0 !important;
  background-color: #fffdf6 !important;
}

#animsition-box:not(.portal-app-shell) > .hero-section {
  overflow: visible !important;
  margin-top: 0 !important;
  padding-top: max(12px, calc(env(safe-area-inset-top, 0px) + 10px)) !important;
  border-top: none !important;
  outline: none !important;
}

/*
 * Header: compact toolbar — tall logo + stretch-centered nav was forcing huge empty bands
 * above/below “Home / Dashboard…”. Tighter bar padding + shorter logo + tighter link padding.
 * Logo still bridges onto the yellow hero (half / half).
 */
.hero-section .header {
  --hero-logo-h: 104px;
  --hero-logo-bridge-lift: 14px;
  /* Room for gradient chips (active/hover use taller padding) */
  padding-top: 14px !important;
  padding-bottom: 14px !important;
  overflow: visible !important;
  border: none !important;
  outline: none !important;
  /* Shadow only downward — avoids a hairline artefact along the top edge */
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06) !important;
}

.hero-section .header .container {
  position: relative !important;
}

.hero-section .header .logo-container {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.hero-section .header .logo-img {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

@media (min-width: 768px) {
  /*
   * Toolbar height must NOT follow the tall logo (that centered nav in a ~104px band).
   * Logo is taken out of the flex row; row height ≈ nav only. Logo stays overlapped on hero.
   *
   * CRITICAL: style.css uses #navigation > ul > li > a { padding: 18px 15px } — beats plain
   * .navigation … selectors. Overrides MUST include #navigation + .hero-section.header.
   */
  .hero-section .header .row {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-wrap: wrap !important;
    row-gap: 6px !important;
    min-height: 0 !important;
    padding-left: clamp(104px, 19vw, 220px) !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .hero-section .header .col-md-3,
  .hero-section .header .col-sm-6.col-xs-6:first-child {
    position: absolute !important;
    left: 15px !important;
    bottom: 2px !important;
    width: auto !important;
    flex: 0 0 auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding-left: 0 !important;
    display: block !important;
    z-index: 1003 !important;
  }

  .hero-section .header .logo-container {
    position: relative !important;
    transform: translateY(calc(var(--hero-logo-h) / 2 - var(--hero-logo-bridge-lift, 0px))) !important;
  }

  .hero-section .header .col-md-9,
  .hero-section .header .col-sm-12 {
    flex: 1 1 auto !important;
    max-width: none !important;
    width: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    align-self: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .hero-section .header .navigation.pull-right,
  .hero-section .header #navigation:not(.small-screen) {
    display: flex !important;
    align-items: center !important;
    float: none !important;
    width: 100% !important;
    justify-content: flex-end !important;
    padding-right: clamp(4px, 1.5vw, 16px) !important;
    margin: 0 !important;
  }

  .hero-section .header #navigation:not(.small-screen) > ul {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .hero-section .header #navigation:not(.small-screen) > ul > li {
    float: none !important;
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
  }

  /* Default pills — roomy; pink gradient chip needs extra air vs cramped 8px */
  .hero-section .header #navigation:not(.small-screen) > ul > li > a {
    padding: 10px 18px !important;
    line-height: 1.35 !important;
    font-size: 15px !important;
  }

  /* Hover + active “chip”: match child-friendly spacious pill look */
  .hero-section .header #navigation:not(.small-screen) > ul > li > a:hover {
    padding: 12px 22px !important;
  }

  .hero-section .header #navigation:not(.small-screen) > ul > li.active > a {
    padding: 12px 22px !important;
  }

  .hero-section .header #navigation:not(.small-screen) > ul > li.profile-menu > a {
    padding: 6px 10px !important;
  }

  .hero-section .header #navigation:not(.small-screen) > ul > li > a:hover,
  .hero-section .header #navigation:not(.small-screen) > ul > li.active > a {
    transform: none !important;
  }
}

@media (max-width: 767px) {
  .hero-section .header {
    --hero-logo-h: 56px;
    --hero-logo-bridge-lift: 8px;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  .hero-section .header .row {
    align-items: center !important;
  }

  .hero-section .header .col-md-3,
  .hero-section .header .col-sm-6.col-xs-6:first-child {
    align-items: center !important;
  }

  .hero-section .header .logo-container {
    transform: translateY(calc(var(--hero-logo-h) / 2 - var(--hero-logo-bridge-lift, 0px)));
  }

  .hero-section .header #navigation.small-screen {
    float: none;
    width: 100%;
  }
}

/* Phones: avoid tall overlap crowding stacked nav */
@media (max-width: 575px) {
  .hero-section .header .logo-container {
    transform: none;
  }
}

.hero-cta-row .btn-white {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Hero --- */
.hero-caption-tuning {
  margin-top: -70px;
}

.hero-main-img {
  width: 100%;
  margin: 0;
  margin-top: -300px;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 8px 20px rgba(255, 215, 0, 0.5)) contrast(1.1) brightness(1.05);
}

/* Hero logo — prominent again; nav stays compact via tighter link padding below */
.hero-section .logo-container .logo-img,
.hero-section .logo-link .logo-img,
.hero-section .logo-img.hero-logo {
  height: 104px !important;
  max-height: 104px !important;
  max-width: min(300px, 72vw) !important;
}

@media (max-width: 991px) {
  .hero-caption-tuning {
    margin-top: -24px !important;
  }

  .hero-main-img {
    margin-top: -140px !important;
  }

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

  .hero-section .hero-title {
    font-size: clamp(28px, 7vw, 40px) !important;
    line-height: 1.2 !important;
  }

  .hero-section .hero-text {
    font-size: 11px !important;
    letter-spacing: 2px !important;
    margin-bottom: 18px !important;
  }
}

@media (max-width: 576px) {
  .hero-caption-tuning {
    margin-top: 0 !important;
  }

  .hero-main-img {
    margin-top: -48px !important;
  }

  .hero-section .logo-container .logo-img,
  .hero-section .logo-link .logo-img,
  .hero-section .logo-img.hero-logo {
    height: 56px !important;
    max-height: 56px !important;
  }

  .hero-section .hero-caption .btn-white {
    min-width: 0 !important;
    width: 100%;
    max-width: 320px;
  }
}

/* --- Doctor grid --- */
.doctors-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

@media (max-width: 767px) {
  .doctors-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-left: 0;
    padding-right: 0;
  }
}

/* --- Doctor filters --- */
.doctor-filters-wrap {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.doctor-filters-bar select {
  flex: 1 1 auto;
  min-width: 0 !important;
}

@media (max-width: 575px) {
  .doctor-filters-bar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .doctor-filters-bar select,
  .doctor-filters-bar #clear-filters {
    width: 100% !important;
  }

  .doctor-filters-bar #clear-filters {
    margin-left: 0 !important;
  }
}

/* --- About --- */
@media (max-width: 991px) {
  .about-home-row {
    flex-direction: column !important;
  }

  #about .col-lg-5 img {
    width: 100% !important;
    max-width: 100% !important;
  }

  #about h1 {
    font-size: clamp(28px, 6vw, 42px) !important;
  }
}

/* --- Services strip (5 cards) --- */
@media (max-width: 1199px) {
  .services-home-row {
    flex-wrap: wrap !important;
    justify-content: center !important;
  }

  .services-home-row > [class*="col-"] {
    flex: 1 1 calc(33.333% - 12px) !important;
    min-width: 160px !important;
  }
}

@media (max-width: 767px) {
  .services-home-row > [class*="col-"] {
    flex: 1 1 calc(50% - 8px) !important;
    max-width: 360px;
  }
}

@media (max-width: 575px) {
  .services-home-row > [class*="col-"] {
    flex: 1 1 100% !important;
    max-width: 440px;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .services-home-row .service-block {
    min-height: 0 !important;
  }
}

/* --- Focus areas orbit → stack --- */
@media (max-width: 991px) {
  .focus-areas-section .focus-areas-container {
    height: auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 16px 12px 40px !important;
  }

  .focus-areas-section .center-circle {
    position: relative !important;
    margin: 0 auto 24px !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    width: 160px !important;
    height: 160px !important;
  }

  .focus-areas-section .focus-card-orbit {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 0 auto 16px !important;
    width: 100%;
    max-width: 300px;
  }

  .focus-areas-section .focus-card-flip {
    width: 100% !important;
    max-width: 280px !important;
    margin: 0 auto !important;
    height: 240px !important;
  }

  .focus-areas-section .emoji-icon {
    font-size: 72px !important;
  }

  .focus-areas-section .focus-title {
    font-size: 18px !important;
  }

  .focus-areas-section .focus-description {
    font-size: 14px !important;
  }
}

/* --- Offers carousel --- */
@media (max-width: 576px) {
  .offers-slider-wrapper {
    padding: 24px 48px !important;
  }

  .offer-slide {
    padding: 32px 18px !important;
  }

  .offer-slide h2 {
    font-size: 24px !important;
  }
}

/* --- Packages row: keep 4 in one row on desktop (matches inline flex-wrap: nowrap). Wrap only on smaller screens. --- */
@media (max-width: 991px) {
  .packages-home-row {
    flex-wrap: wrap !important;
    justify-content: center !important;
  }

  .packages-home-row > div[class*="col-"] {
    flex: 1 1 100% !important;
    max-width: 420px !important;
    min-width: 0 !important;
  }
}

/* --- Doctor cards: long names --- */
@media (max-width: 400px) {
  .pro-doc-name {
    white-space: normal !important;
    font-size: 17px !important;
  }

  .pro-doc-top {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
  }

  .pro-doc-info {
    align-items: center !important;
  }

  .pro-doc-name-row {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
}

/* --- Sections padding --- */
@media (max-width: 767px) {
  #doctor-booking .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  #doctor-booking .section-title h1 {
    font-size: clamp(26px, 6vw, 38px) !important;
  }

  #packages .section-title h1 {
    font-size: clamp(26px, 6vw, 36px) !important;
  }

}

/* --- Contact section --- */
@media (max-width: 767px) {
  #contact-form {
    height: auto !important;
    min-height: auto !important;
    padding: 48px 12px !important;
    align-items: flex-start !important;
  }

  #contact-form .form-container {
    padding: 28px 20px !important;
    max-width: 100% !important;
  }
}

/* --- Testimonials --- */
@media (max-width: 575px) {
  .testimonial-card {
    flex: 0 0 min(300px, 88vw) !important;
    min-width: min(300px, 88vw) !important;
    max-width: min(300px, 88vw) !important;
  }
}

/* --- Focus areas heading --- */
@media (max-width: 767px) {
  .focus-areas-section .section-title h1 {
    font-size: clamp(24px, 5.5vw, 38px) !important;
    line-height: 1.25 !important;
  }

  .focus-areas-section {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }
}

/* --- Packages (classic centered container width, stable card gaps) --- */
#packages .packages-shell {
  max-width: 1400px !important;
}

#packages .packages-home-row {
  gap: 28px !important;
  padding-left: 15px !important;
  padding-right: 15px !important;
}

/* Hero primary CTAs — centered row */
.hero-cta-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* --- AI assistant FAB (safe area on phones) --- */
#ai-fab {
  bottom: max(14px, env(safe-area-inset-bottom, 0px)) !important;
  right: max(14px, env(safe-area-inset-right, 0px)) !important;
}

/* --- Top bar --- */
@media (max-width: 575px) {
  .top-bar .mail-text {
    font-size: 12px;
    text-align: center;
    margin-bottom: 4px;
  }

  .top-bar .row > div {
    text-align: center !important;
  }
}
