/* HOMECARE mobile and tablet refinements. Loaded after the legacy page stylesheet. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 8rem;
}

body {
  min-width: 320px;
  overflow-x: clip;
}

img,
video,
canvas,
svg {
  max-width: 100%;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid rgba(26, 183, 68, .65);
  outline-offset: 2px;
}

#serviceBilingualHighlights .service-expert-head {
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  text-align: center !important;
}

#serviceBilingualHighlights .service-expert-copy {
  text-align: left !important;
}

#serviceBilingualHighlights .service-expert-title,
#serviceBilingualHighlights .service-expert-subtitle {
  text-align: left !important;
}

#serviceBilingualHighlights .service-expert-cta {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: .25rem !important;
  font-size: 1rem !important;
  text-align: center !important;
  white-space: normal !important;
}

@media (max-width: 767px) {
  html { scroll-padding-top: 7rem; }

  #hcHeaderLoginDrawer {
    justify-content: center !important;
  }

  #hcHeaderLoginDrawer .hc-login-panel {
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    padding-left: max(18px, env(safe-area-inset-left)) !important;
    padding-right: max(18px, env(safe-area-inset-right)) !important;
    box-sizing: border-box !important;
  }

  #hcHeaderLoginDrawer .hc-otp-boxes {
    width: 100% !important;
    justify-content: space-between !important;
    gap: clamp(6px, 2vw, 10px) !important;
  }

  #hcHeaderLoginDrawer .hc-otp-boxes input {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: 1 1 0 !important;
    box-sizing: border-box !important;
  }

  #homecareTopUtilityBar {
    min-height: 34px;
    overflow: hidden;
  }

  header > .max-w-7xl {
    padding-left: max(12px, env(safe-area-inset-left)) !important;
    padding-right: max(12px, env(safe-area-inset-right)) !important;
  }

  header > .max-w-7xl > .homecare-mobile-brand {
    min-width: 0 !important;
    gap: 9px !important;
  }

  .homecare-mobile-brand > .relative {
    width: 42px !important;
    height: 42px !important;
    flex: 0 0 42px !important;
  }

  .homecare-brand-text {
    max-width: 36vw;
    white-space: nowrap;
    font-size: clamp(1rem, 4.4vw, 1.3rem) !important;
  }

  /* Keep every control in the navbar's primary flex row. */
  header > .max-w-7xl > div:last-child {
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 5px !important;
    min-width: 0 !important;
    margin-left: auto !important;
  }

  /* The nav toggle in this row controls the sidebar; avoid a second toggle by the logo. */
  header .homecare-mobile-header-menu { display: none !important; }

  header > .max-w-7xl > div:last-child .mobile-header-city {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: min(27vw, 122px) !important;
    min-width: 0 !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    gap: 5px !important;
    order: 1 !important;
    font-size: .78rem !important;
    background: #F2F6F3 !important;
    border-color: #1AB744 !important;
    color: #334155 !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-city .fa-location-dot {
    color: #1AB744 !important;
    flex: 0 0 auto !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-city span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  header > .max-w-7xl > div:last-child .mobile-header-cart {
    display: inline-flex !important;
    position: relative !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 0 !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 9px !important;
    gap: 5px !important;
    order: 2 !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-cart .fa-basket-shopping {
    font-size: 1.1rem !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-cart-label {
    display: inline !important;
    white-space: nowrap !important;
    font-size: .74rem !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-cart #headerCartCount {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    width: 18px !important;
    height: 18px !important;
    border: 1px solid #fff !important;
    font-size: .62rem !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-nav-trigger {
    display: inline-flex !important;
    flex: 0 0 42px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    order: 3 !important;
  }

  /* This wrapper now contains only the off-canvas sidebar. */
  #mobileHeaderActions {
    position: static !important;
    display: block !important;
    width: 0 !important;
    height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    border: 0 !important;
  }

  #mobileHeaderActions > .mobile-sidebar-style-spacer {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #heroSliderBox {
    width: 100%;
    min-width: 0;
    scroll-margin-top: 8rem;
  }

  #tab-home,
  #tab-repair,
  #tab-account,
  #homecareQuickServicesPage,
  #homecarePaymentPage,
  #checkoutModal {
    min-width: 0;
    max-width: 100%;
  }

  #tab-home > section,
  #tab-repair > section,
  #tab-account > section,
  #homecareQuickServicesPage > section {
    max-width: 100%;
    background: #f2f6f3;
  }

  #servicesCatalogContainer,
  #serviceDynamicContent,
  #ordersListContainer,
  #homecareCartPageItems {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #servicesCatalogContainer ~ aside.lg\:col-span-4 {
    position: static !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #servicesCatalogContainer ~ aside.lg\:col-span-4 #cartItemsList {
    max-height: min(42vh, 360px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  #checkoutModal.homecare-checkout-page,
  #homecarePaymentPage {
    padding-left: max(12px, env(safe-area-inset-left)) !important;
    padding-right: max(12px, env(safe-area-inset-right)) !important;
  }

  #homecareCheckoutPageCard,
  #homecarePaymentPage .payment-page-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  #checkoutModal input,
  #checkoutModal select,
  #checkoutModal textarea,
  #homecarePaymentPage input,
  #homecarePaymentPage select,
  #homecarePaymentPage textarea,
  #homecareAddressManager input,
  #homecareAddressManager select,
  #homecareAddressManager textarea,
  #homecareAddressPicker input,
  #homecareAddressPicker select,
  #homecareAddressPicker textarea {
    max-width: 100%;
    font-size: 16px !important;
  }

  #checkoutModal button,
  #homecarePaymentPage button,
  #homecareAddressManager button,
  #homecareAddressPicker button {
    max-width: 100%;
    overflow-wrap: anywhere;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  #accountOrdersSection #ordersListContainer .grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #accountOrdersSection #ordersListContainer button,
  #accountAddressSection button,
  #completedServiceComplaintPanel button {
    min-height: 44px;
  }

  #homecareCartPage {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
  }

  #homecareCartPage > div {
    width: 100%;
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #homecareAddressManager .manager-card,
  #homecareAddressPicker .picker-card,
  #hcHeaderLoginDrawer .hc-login-panel {
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  #homecareFooter {
    margin-top: 2.5rem !important;
    padding-bottom: env(safe-area-inset-bottom);
  }

  #serviceBilingualHighlights .service-expert-head {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 16px 12px !important;
    text-align: left !important;
  }

  #serviceBilingualHighlights .service-expert-copy {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    text-align: left !important;
  }

  #serviceBilingualHighlights .service-expert-title,
  #serviceBilingualHighlights .service-expert-subtitle {
    text-align: left !important;
  }

  #serviceBilingualHighlights .service-expert-cta {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 1 42% !important;
    width: auto !important;
    max-width: 42% !important;
    min-height: 48px !important;
    padding: 8px 10px !important;
    border-radius: .25rem !important;
    font-size: 1rem !important;
    text-align: center !important;
  }
}
@media (max-width: 380px) {
  .homecare-mobile-brand > .relative {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }

  .homecare-brand-text {
    max-width: 29vw !important;
    font-size: .95rem !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-city {
    max-width: 66px !important;
    padding: 0 5px !important;
    font-size: .7rem !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-cart,
  header > .max-w-7xl > div:last-child .mobile-header-nav-trigger {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    flex-basis: 38px !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-cart {
    padding: 0 !important;
  }

  header > .max-w-7xl > div:last-child .mobile-header-cart-label {
    display: none !important;
  }
}

@media (min-width: 768px) {
  #mobileHeaderActions { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Final mobile layout: one shared gutter between every service card, including later rows. */
@media (max-width: 767px) {
  #quickServicesPrimaryGrid,
  #additionalQuickServices {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    column-gap: .75rem !important;
    row-gap: .75rem !important;
    align-items: stretch !important;
  }

  #quickServicesPrimaryGrid > *,
  #additionalQuickServices > * {
    width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  /* Keep the single navbar menu control before the logo; hide the old right-side copy. */
  header #homecareMobileHeaderMenu {
    display: inline-flex !important;
    flex: 0 0 2rem !important;
    width: 2rem !important;
    height: 2.25rem !important;
    align-items: center !important;
    justify-content: center !important;
    order: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #0f172a !important;
    box-shadow: none !important;
  }
  header > .max-w-7xl > div:last-child > .mobile-header-nav-trigger {
    display: none !important;
  }

  /* Match the desktop city tab: pale base, orange pin, green/white hover. */
  header .mobile-header-city {
    background: #F2F6F3 !important;
    border-color: #1AB744 !important;
    color: #334155 !important;
  }
  header .mobile-header-city .fa-location-dot { color: #1AB744 !important; }
  header .mobile-header-city:hover,
  header .mobile-header-city:focus-visible {
    background: #1ab744 !important;
    border-color: #1ab744 !important;
    color: #fff !important;
  }
  header .mobile-header-city:hover .fa-location-dot,
  header .mobile-header-city:focus-visible .fa-location-dot,
  header .mobile-header-city:hover #headerSelectedCity,
  header .mobile-header-city:focus-visible #headerSelectedCity { color:#1ab744 !important; }
}

/* Mobile-only finishing refinements requested for service grid, header and drawer. */
@media (max-width: 767px) {
  /* Keep partial final service rows aligned to the exact same 3-column grid gutter. */
  #quickServicesPrimaryGrid,
  #additionalQuickServices {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: 1fr !important;
    column-gap: 12px !important;
    row-gap: 12px !important;
    justify-items: stretch !important;
    align-items: stretch !important;
  }
  #quickServicesPrimaryGrid > *,
  #additionalQuickServices > * {
    justify-self: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  #additionalQuickServices > #viewMoreServicesBox.quick-services-view-more-at-end {
    justify-self: stretch !important;
    margin-inline: 0 !important;
  }

  /* Remove the brand mark and wordmark from the mobile header; retain the menu toggle. */
  header > .max-w-7xl > .homecare-mobile-brand {
    width: 2rem !important;
    min-width: 2rem !important;
    max-width: 2rem !important;
    flex: 0 0 2rem !important;
    gap: 0 !important;
  }
  header > .max-w-7xl > .homecare-mobile-brand > .relative,
  header > .max-w-7xl > .homecare-mobile-brand > div:not(.relative) {
    display: none !important;
  }

  /* Keep the cart quantity badge inside the button and vertically centered. */
  header > .max-w-7xl > div:last-child > .mobile-header-cart #headerCartCount {
    position: static !important;
    inset: auto !important;
    top: auto;
    right: auto;
    transform: none !important;
    display: inline-flex !important;
    flex: 0 0 18px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    margin: 0 0 0 6px !important;
    border: 1px solid #1AB744 !important;
    border-radius: 50% !important;
    background: #F2F6F3 !important;
    color: #1AB744 !important;
    font-size: .75rem !important;
    line-height: 1 !important;
  }

  /* Match the desktop city selector colors, overriding older mobile-only green defaults. */
  header > .max-w-7xl > div:last-child > button.header-action-tab.mobile-header-city[onclick="openCityLocationModal()"] {
    background: #fff !important;
    background-color: #fff !important;
    border-color: #1AB744 !important;
    color: #334155 !important;
  }
  header > .max-w-7xl > div:last-child > button.header-action-tab.mobile-header-city[onclick="openCityLocationModal()"] .fa-location-dot {
    color: #1AB744 !important;
  }
  header > .max-w-7xl > div:last-child > button.header-action-tab.mobile-header-city[onclick="openCityLocationModal()"]:hover,
  header > .max-w-7xl > div:last-child > button.header-action-tab.mobile-header-city[onclick="openCityLocationModal()"]:focus-visible {
    background: #fff !important;
    border-color: #1ab744 !important;
    color: #1ab744 !important;
  }
  header > .max-w-7xl > div:last-child > button.header-action-tab.mobile-header-city[onclick="openCityLocationModal()"]:hover *,
  header > .max-w-7xl > div:last-child > button.header-action-tab.mobile-header-city[onclick="openCityLocationModal()"]:focus-visible * {
    color: #fff !important;
  }

  /* 15% narrower than the current 84vw / 340px drawer. */
  #mobileNavMenu {
    width: min(71.4vw, 289px) !important;
    max-width: 289px !important;
  }
}



/* Mobile final row breathing room and linked compact navbar logo. */
.homecare-mobile-logo-link,
.homecare-mobile-logo-image { display: none; }
@media (max-width: 767px) {
  /* Reset the extra top margin, then apply it to only the actual final grid row. */
  #additionalQuickServices > * { margin-top: 0 !important; }
  #additionalQuickServices:has(> :last-child:nth-child(3n + 1)) > :last-child,
  #additionalQuickServices:has(> :last-child:nth-child(3n + 2)) > :nth-last-child(-n + 2),
  #additionalQuickServices:has(> :last-child:nth-child(3n)) > :nth-last-child(-n + 3) {
    margin-top: 3rem !important;
  }

  header > .max-w-7xl > .homecare-mobile-brand {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 0 1 auto !important;
    gap: .5rem !important;
  }
  header > .max-w-7xl > .homecare-mobile-brand .homecare-mobile-logo-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex: 0 1 auto !important;
    width: clamp(88px, 26vw, 132px) !important;
    max-width: 132px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  header > .max-w-7xl > .homecare-mobile-brand .homecare-mobile-logo-image {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: 44px !important;
    object-fit: contain !important;
    object-position: left center !important;
  }
}

/* Permanent HOMECARE navbar branding and phone color. */
.homecare-top-phone,
.homecare-top-phone:visited { color: #1ab744 !important; }
.homecare-logo-frame {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.homecare-permanent-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.homecare-brand-text,
.homecare-brand-text span { color: #404040 !important; }
@media (max-width: 767px) {
  header > .max-w-7xl > .homecare-mobile-brand {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 0 1 auto !important;
    gap: 8px !important;
  }
  header > .max-w-7xl > .homecare-mobile-brand > .homecare-logo-frame {
    display: flex !important;
    width: 42px !important;
    height: 42px !important;
    flex: 0 0 42px !important;
  }
  header > .max-w-7xl > .homecare-mobile-brand > div:not(.homecare-logo-frame) {
    display: block !important;
  }
  header .homecare-brand-text {
    display: block !important;
    max-width: 30vw !important;
    white-space: nowrap !important;
    font-size: clamp(.95rem, 4vw, 1.2rem) !important;
  }
  header .homecare-mobile-header-menu {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 40px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #18212d !important;
    font-size: 21px !important;
    flex: 0 0 34px !important;
  }
  header > .max-w-7xl > div:last-child > .mobile-header-nav-trigger { display: none !important; }

  #homecareTopUtilityBar > .max-w-7xl { position: relative !important; }
  #homecareTopUtilityBar > .max-w-7xl > .flex:first-child { padding-right: 112px !important; }
  #homecareTopUtilityBar .top-utility-actions {
    display: flex !important;
    position: absolute !important;
    right: 4px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    gap: 0 !important;
    z-index: 4 !important;
  }
  #homecareTopUtilityBar .top-utility-actions > a[aria-label="Join as Service Partner"],
  #homecareTopUtilityBar .top-utility-actions > span { display: none !important; }
  #homecareTopUtilityBar .homecare-top-phone {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    color: #1ab744 !important;
    font-size: .68rem !important;
    white-space: nowrap !important;
  }
}
@media (max-width: 380px) {
  header > .max-w-7xl > .homecare-mobile-brand { gap: 4px !important; }
  header > .max-w-7xl > .homecare-mobile-brand > .homecare-permanent-logo-link .homecare-logo-frame {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }
  header .homecare-brand-text { max-width: 26vw !important; font-size: .85rem !important; }
  header .homecare-mobile-header-menu { width: 30px !important; flex-basis: 30px !important; }
}

/* Mobile booking slots: show four dates and three time windows per row. */
@media (max-width: 767px) {
  #modalStep-3 .homecare-day-strip-shell {
    display: flex !important;
    align-items: stretch !important;
    gap: 4px !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  #modalStep-3 .homecare-day-strip-shell > .homecare-day-scroll-arrow {
    flex: 0 0 24px !important;
    width: 24px !important;
    min-width: 24px !important;
  }
  #modalStep-3 .homecare-day-strip-shell > .flex.gap-2.overflow-x-auto {
    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-behavior: smooth !important;
    scrollbar-width: none !important;
    overscroll-behavior-x: contain !important;
  }
  #modalStep-3 .homecare-day-strip-shell > .flex.gap-2.overflow-x-auto::-webkit-scrollbar {
    display: none !important;
  }
  #modalStep-3 .homecare-day-strip-shell .day-slot-btn {
    flex: 0 0 calc((100% - 1rem) / 3) !important;
    width: calc((100% - 1rem) / 3) !important;
    min-width: 0 !important;
    padding: .5rem .1rem !important;
  }
  #modalStep-3 .grid.grid-cols-3.gap-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;gap: 0.75rem;
  }
}

