/* CeraVe PT — mobile-first overrides para o tema Shopify (homepage/produto/coleções).
   Aplica-se em CIMA do theme.css. Foco: mobile (<900px). */

/* === MOBILE SPACING FIXES — padding seguro em todos os elementos === */
@media (max-width: 899px) {
  html, body { overflow-x: hidden !important; }
  .container, .page-width,
  .shopify-section > .container,
  .shopify-section > .page-width { padding-left: 16px !important; padding-right: 16px !important; }
  .header__wrapper { padding-left: 12px !important; padding-right: 12px !important; gap: 8px; }
  .shopify-section + .shopify-section { margin-top: 12px !important; }
  .product-list, .product-grid { gap: 10px !important; padding: 0 !important; }
  product-card .product-card__info { padding: 8px 8px 10px !important; }
  product-gallery, .product-gallery { padding: 0 !important; }
  /* PDP mobile: força layout flex column flat — elimina reserved space do safe-sticky/grid theme */
  safe-sticky.product-info, .product-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 14px 16px !important;
    margin: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    --product-info-block-spacing: 0 !important;
  }
  .product-info > *, .product-info > * + * {
    margin: 0 !important;
    margin-block: 0 !important;
    padding-block: 0 !important;
    min-height: 0 !important;
  }
  .product-info__price, .product-info__price > *, .product-info__price * {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
  }
  .product-info__price .rating-with-text { display: flex !important; flex-wrap: wrap !important; align-items: center !important; gap: 10px !important; }
  .product-info__variant-picker { display: none !important; }
  size-chart-modal, #size-chart-modal { display: none !important; }
  /* Subir o bloco quantidade+botão (sem alterar gap entre eles) */
  .product-info__quantity-selector { padding-top: 0 !important; margin-top: -8px !important; margin-bottom: 18px !important; }
  .product-info__buy-buttons, buy-buttons { margin-top: 6px !important; margin-bottom: 12px !important; }
  /* Cards extras (ficam abaixo do buy-button) */
  .cv-bundle { margin-top: 14px !important; }
  .cv-faq, .cv-inci, .cv-reviews-section { margin-top: 18px !important; }
  .shopify-section--featured-collection .product-list { gap: 10px !important; }
  .shopify-section--featured-collection .container { padding: 16px !important; }
  .section-header { padding: 0 16px 12px !important; }
  /* Custom CV blocks: respeitar margem lateral */
  .cv-rating-row, .cv-urgency, .cv-shipping-bar, .cv-bundle, .cv-faq, .cv-inci, .cv-reviews-section {
    margin-left: 16px !important;
    margin-right: 16px !important;
  }
  .cv-reviews-section { padding: 18px !important; }
  .cv-pay-block, .cerave-pay-block { margin: 12px 16px !important; }
  .cv-hero__inner { padding: 0 16px !important; }
  img { max-width: 100%; height: auto; }
}

/* Telemóveis pequenos (<360px) */
@media (max-width: 359px) {
  .container, .page-width { padding-left: 12px !important; padding-right: 12px !important; }
  .header__wrapper { padding-left: 8px !important; padding-right: 8px !important; }
  .cv-rating-row, .cv-urgency, .cv-shipping-bar, .cv-bundle, .cv-faq, .cv-inci, .cv-reviews-section {
    margin-left: 12px !important; margin-right: 12px !important;
  }
}

/* === HEADER ICONS — alinhamento e tamanhos consistentes === */
.header__icon-list svg.icon { width: 22px; height: 22px; }

/* Esconde qualquer cart-count nativo do Shopify (estamos a usar o nosso .cerave-cart-pill) */
.header__cart-count, cart-count.count-bubble { display: none !important; }

/* Header wrapper: garante alinhamento vertical centrado das 3 colunas */
.header__wrapper, .header-inner, .header__main-nav, .header__secondary-nav {
  align-items: center !important;
}
.header__icon-list {
  display: flex !important;
  align-items: center !important;
  gap: 4px;
  height: 44px;
}
.header__main-nav { justify-self: start !important; }
.header__secondary-nav { justify-self: end !important; }

/* Logo central — altura consistente */
.header__logo { display: flex !important; align-items: center !important; justify-content: center !important; margin: 0; }
.header__logo a { display: inline-flex !important; align-items: center !important; }
.header__logo-image { height: 40px !important; width: auto !important; max-width: 100%; }

/* Search e Cart anchors — mesma área de toque 44×44 */
.cerave-search-link, .cerave-cart-link {
  width: 44px !important;
  height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  transition: background .15s !important;
}
.cerave-search-link:hover, .cerave-cart-link:hover { background: #e8f3fb !important; }
.cerave-search-link svg, .cerave-cart-link svg {
  width: 22px !important;
  height: 22px !important;
  display: block;
}

/* Mobile: header padding consistente */
@media (max-width: 899px) {
  .header__logo-image { height: 36px !important; }
  .shopify-section--header .container, .shopify-section--header .page-width { padding-left: 12px !important; padding-right: 12px !important; }
}


/* Hard reset overflow */
html, body { overflow-x: hidden !important; max-width: 100vw; }
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
img, video, iframe { max-width: 100%; height: auto; }

/* Inputs nunca pequenos no iOS para evitar zoom no focus */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="search"], input[type="password"], textarea, select {
  font-size: 16px !important;
}

/* Áreas de toque mín. 44px */
button, .button, [role="button"], a.button, input[type="submit"], input[type="button"] {
  min-height: 44px;
  touch-action: manipulation;
}

/* Mobile (<900px) — onde o utilizador realmente está */
@media (max-width: 899px) {
  /* Reduzir paddings dos sections */
  .section, section.section { padding-left: 0 !important; padding-right: 0 !important; }
  .container, .page-width, .shopify-section { padding-left: 12px !important; padding-right: 12px !important; max-width: 100vw !important; }

  /* Cabeçalho mais compacto */
  .header, .shopify-section--header { padding-top: 8px !important; padding-bottom: 8px !important; }
  .header__heading-logo, .header__logo, .logo { max-height: 40px !important; width: auto !important; }
  .header__inline-menu, .header__icons { gap: 8px !important; }

  /* Tipografia mobile */
  h1, .h1 { font-size: clamp(22px, 6vw, 28px) !important; line-height: 1.2 !important; }
  h2, .h2 { font-size: clamp(18px, 5vw, 22px) !important; line-height: 1.25 !important; }
  h3, .h3 { font-size: clamp(16px, 4.5vw, 18px) !important; line-height: 1.3 !important; }
  body { font-size: 15px !important; line-height: 1.5; }

  /* Product grid: 2 colunas no mobile */
  .product-list, .grid--products, .collection .product-list,
  ul.product-grid, .product-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 0 !important;
  }
  .product-list > *, .product-grid > * { min-width: 0; }

  /* Cards de produto */
  product-card, .product-card { width: 100% !important; min-width: 0 !important; }
  .product-card__figure { aspect-ratio: 1; overflow: hidden; }
  .product-card__image, .product-card img { width: 100% !important; height: 100% !important; object-fit: cover; }
  .product-card__title, .product-card__title a { font-size: 13px !important; line-height: 1.3 !important; }
  .product-card sale-price, .product-card .price { font-size: 14px !important; font-weight: 700 !important; }
  .product-card compare-at-price { font-size: 12px !important; }

  /* Quick-buy button mais compacto */
  .product-card__quick-buy .button { padding: 8px 12px !important; font-size: 12px !important; min-height: 36px !important; }

  /* Página de produto */
  .product-info { padding: 14px 12px !important; }
  .product-info__title { font-size: clamp(20px, 5.5vw, 26px) !important; line-height: 1.25 !important; word-wrap: break-word; }
  .product-info__price { margin: 12px 0 !important; }
  sale-price.text-on-sale, sale-price.text-lg { font-size: 26px !important; font-weight: 800 !important; color: #b8420f !important; }
  compare-at-price.line-through { font-size: 16px !important; opacity: .7; margin-left: 8px; }
  .badge--on-sale { font-size: 13px !important; padding: 4px 10px !important; }

  /* Galeria do produto: full-width sem padding lateral, swipe */
  product-gallery, .product-gallery { padding: 0 !important; }
  .product-gallery__media-list { gap: 4px !important; }

  /* Quantity selector touch-friendly */
  quantity-selector .quantity-selector__button { width: 40px !important; height: 40px !important; }
  quantity-selector .quantity-selector__input { font-size: 16px !important; min-width: 40px !important; }

  /* Botão Add-to-cart full-width e grande */
  .product-info__buttons, product-form { display: block !important; }
  .product-info__buttons .button, product-form button[type="submit"], .product-form__submit {
    width: 100% !important;
    padding: 16px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    min-height: 52px !important;
    border-radius: 10px !important;
    margin: 8px 0 !important;
  }

  /* Drawer/menu lateral: ocupa quase toda a tela */
  .drawer, drawer-element { max-width: 92vw !important; }

  /* Recommended/featured collection scroll horizontal */
  .shopify-section--featured-collection .product-list,
  .shopify-section--featured-collection .grid--products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Footer compacto */
  .footer__content-top, .footer__columns { grid-template-columns: 1fr !important; gap: 16px !important; padding: 20px 12px !important; }

  /* Anúncios/Banner principal */
  .announcement-bar, .topbar { font-size: 12px !important; padding: 8px 10px !important; }

  /* Imagens hero não cortar visivelmente */
  .image-banner, .hero, .shopify-section--image-banner img { max-height: 60vh !important; object-fit: cover !important; }

  /* Accordion/details na página de produto */
  details summary { padding: 12px 0 !important; font-size: 14px !important; min-height: 44px; }
  .product-info__accordion summary { font-size: 15px !important; }

  /* Modais full-screen no mobile */
  modal-element[open], dialog[open] { width: 100% !important; max-width: 100vw !important; height: 100dvh !important; max-height: 100dvh !important; }

  /* Spacing geral entre sections */
  .shopify-section + .shopify-section { margin-top: 8px !important; }

  /* Navigation drawer link items maiores para tocar */
  .navigation-drawer a, .navigation a { padding: 14px 16px !important; min-height: 48px !important; display: flex !important; align-items: center; }
}

/* Telemóveis muito pequenos (<360px) */
@media (max-width: 359px) {
  body { font-size: 14px !important; }
  .product-list, .product-grid { grid-template-columns: 1fr !important; }
}

/* Sticky add-to-cart bar no fundo do produto (mobile only) */
@media (max-width: 899px) {
  .product-info { padding-bottom: 120px !important; }
  body.product-page::after,
  .shopify-section--main-product::after { content: ''; }
}
