/* CDISHOP - isolated mobile storefront navigation. Desktop is unchanged. */
.cdi-app-bottom-nav{display:none}
@media(max-width:767.98px){
  body{padding-bottom:calc(70px + env(safe-area-inset-bottom,0px))!important}
  .cdi-app-bottom-nav{display:flex;position:fixed;bottom:0;left:0;right:0;z-index:1040;min-height:66px;padding:5px 4px calc(5px + env(safe-area-inset-bottom,0px));background:#fff;border-top:1px solid #dce6ef;box-shadow:0 -5px 20px rgba(9,35,64,.10);align-items:stretch;justify-content:space-around}
  .cdi-app-bottom-nav .cdi-app-tab{appearance:none;border:0;background:transparent;min-width:0;flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:5px 1px;color:#526277!important;text-decoration:none!important;font:600 10px/1.2 Arial,sans-serif;cursor:pointer}
  .cdi-app-bottom-nav .cdi-app-tab>i,.cdi-app-icon-wrap>i{font-size:21px;line-height:24px}
  .cdi-app-bottom-nav .cdi-app-tab.is-active{color:#0867bc!important}
  .cdi-app-bottom-nav .cdi-app-tab:focus-visible{outline:2px solid #0867bc;outline-offset:-3px;border-radius:9px}
  .cdi-app-icon-wrap{position:relative;display:inline-flex}
  .cdi-app-cart-count:not(:empty){position:absolute;top:-7px;right:-11px;background:#e82942;color:#fff;border-radius:15px;min-width:16px;height:16px;padding:2px;font-size:10px;line-height:12px;text-align:center}
  /* Keep checkout dialogs and expanded menus above the navigation. */
  body.cdi-mobile-menu-open .cdi-app-bottom-nav{visibility:hidden}
  .modal.show{z-index:1060}
  .modal-backdrop.show{z-index:1050}
  /* The existing storefront search remains in its original position near the top. */
}
@media(min-width:768px){.cdi-app-bottom-nav{display:none!important}}

/* Phase 2: mobile-only visual refinement, existing business logic unchanged. */
.cdi-mobile-quick-categories{display:none}
@media(max-width:767.98px){
  body.cdi-home-page,body.cdi-home-page .cdishop-home{overflow-x:clip}
  .cdi-mobile-topbar{min-height:50px!important;padding-top:4px!important;padding-bottom:4px!important}
  .cdi-mobile-topbar .cdi-mobile-brand img{max-height:35px!important}
  #product-search-form-mobile{margin:0!important;background:#fff;border-radius:12px!important;box-shadow:0 2px 8px rgba(8,44,88,.09)}
  #product-search-form-mobile input{min-width:0!important;font-size:13px!important;padding:10px!important}
  #product-search-form-mobile .btn-primary{padding:8px 14px!important}
  .cdi-mobile-quick-categories{display:flex;gap:13px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;padding:10px 12px 14px;margin:0 0 8px;scrollbar-width:none;background:#f4f8ff}
  .cdi-mobile-quick-categories::-webkit-scrollbar{display:none}
  .cdi-mobile-quick-categories a{flex:0 0 76px;display:flex;align-items:center;flex-direction:column;gap:5px;color:#163b63;text-align:center;text-decoration:none;font-size:11px;font-weight:700;line-height:1.2;scroll-snap-align:start;overflow-wrap:anywhere}
  .cdi-quick-category-icon{display:grid;place-items:center;width:48px;height:48px;background:#fff;border:1px solid #e1e9f2;border-radius:50%;color:#0867bc;box-shadow:0 2px 6px rgba(0,42,92,.07);font-size:21px}
  .cdishop-home .cd-hero-wrap{gap:9px!important}
  .cdishop-home #cdishopHero,.cdishop-home .cd-hero{border-radius:12px!important;overflow:hidden}
  .cdishop-home #cdishopHero .carousel-item .cd-hero-link>img{display:block;width:100%;height:auto!important;max-height:220px;object-fit:contain!important}
  .cdishop-home .cd-solutions-card{min-height:0!important;padding:13px!important}
  .cdishop-home .cd-solutions-card h2{font-size:20px!important;line-height:1.2!important}
  .cdishop-home .cd-solutions-description{font-size:12px!important;margin-bottom:8px!important}
  .cdishop-home .cd-benefits{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px!important;margin:10px 0!important}
  .cdishop-home .cd-benefits>a{padding:10px 7px!important;gap:7px!important;border-radius:10px!important}
  .cdishop-home .cd-benefits>a i{font-size:19px!important}
  .cdishop-home .cd-benefits>a b{font-size:11px!important}
  .cdishop-home .cd-benefits>a small{font-size:10px!important}
  .cdishop-home .cd-section-heading h2{font-size:20px!important}
  .cdishop-home .cd-rated-carousel{gap:0!important}
  .cdishop-home .cd-rated-arrow{display:none!important}
  .cdishop-home .cd-rated-viewport{width:100%!important;padding:3px 0 10px!important}
  .cdishop-home .cd-rated-track{gap:8px!important}
  .cdishop-home .cd-rated-track .cd-product-card{flex:0 0 calc((100% - 8px)/2)!important;min-width:0!important}
  .cdishop-home .cd-product-card .cd-product-body{padding:9px!important}
  .cdishop-home .cd-product-card h3{font-size:12px!important;line-height:1.35!important}
  .cdishop-home .cd-product-card .cd-product-price{font-size:15px!important}
  .cdishop-home .cd-product-card .cd-add-cart{font-size:11px!important;padding:8px 5px!important}
  .cdishop-home .cdi-offer-track{gap:8px!important}
  .cdishop-home .cdi-offer-card{min-width:0!important}
  .cdishop-home .cd-brands-section{margin-top:20px!important;padding-top:16px!important}
  .cdi-app-bottom-nav{z-index:1040}
}
@media(max-width:380px){.cdi-mobile-quick-categories a{flex-basis:68px}.cdishop-home .cd-product-card .cd-product-body{padding:7px!important}}

/* Phase 3 - compact mobile merchandising. No desktop or checkout rules. */
@media(max-width:767.98px){
  .cdi-mobile-quick-categories{gap:8px;padding:10px 9px 12px;margin-bottom:4px}
  .cdi-mobile-quick-categories a{flex:0 0 78px;gap:6px;font-size:10px;line-height:1.25;overflow-wrap:normal;word-break:normal}
  .cdi-mobile-quick-categories a>span:last-child{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;min-height:25px;max-width:100%}
  .cdi-quick-category-icon{width:44px;height:44px;font-size:20px}
  /* Banner images are often very wide: remove oversized dark letterboxing. */
  .cdishop-home #cdishopHero,.cdishop-home #cdishopHero .carousel-inner,.cdishop-home #cdishopHero .carousel-item,
  .cdishop-home #cdishopHero .cd-hero-link{min-height:0!important;height:auto!important}
  .cdishop-home #cdishopHero .carousel-item .cd-hero-link>img{height:auto!important;max-height:none!important;aspect-ratio:auto!important;object-fit:contain!important}
  .cdishop-home #cdishopHero .carousel-indicators{margin-bottom:3px}
  .cdishop-home .cd-hero-wrap{margin-bottom:9px!important}
  .cdishop-home .cd-solutions-card{padding:11px!important}
  .cdishop-home .cd-solutions-card h2{font-size:18px!important}
  .cdishop-home .cd-benefits{margin:7px 0!important}
  .cdishop-home .cd-rated-section{margin-top:18px!important}
  .cdishop-home .cd-rated-track .cd-product-card{flex:0 0 calc((100% - 8px)/2)!important}
  .cdishop-home .cd-product-card img{max-width:100%}
  .cdishop-home .cdi-offer-card{flex:0 0 47%!important}
  /* Floating assistance must not obscure the permanent navigation. */
  body.cdi-home-page .cdi-chat-launcher,body.cdi-home-page .cdi-chat-bubble{bottom:calc(84px + env(safe-area-inset-bottom,0px))!important}
}

/* Phase 4: match carousel box to actual banner aspect ratio, without cropping. */
@media(max-width:767.98px){
  .cdishop-home #cdishopHero{
    height:var(--cdi-mobile-hero-height,auto)!important;
    min-height:0!important;
    aspect-ratio:auto!important;
    overflow:hidden!important;
    background:transparent!important;
  }
  .cdishop-home #cdishopHero .carousel-inner,
  .cdishop-home #cdishopHero .carousel-item,
  .cdishop-home #cdishopHero .cd-hero-link{
    height:100%!important;
    min-height:0!important;
    aspect-ratio:auto!important;
  }
  .cdishop-home #cdishopHero .carousel-item .cd-hero-link>img{
    width:100%!important;
    height:auto!important;
    max-height:none!important;
    padding:0!important;
    margin:0!important;
    object-fit:contain!important;
  }
  .cdishop-home .cd-hero-wrap{display:block!important}
  .cdishop-home .cd-solutions-card{margin:12px 0!important}
  .cdishop-home .cdi-special-offers{margin:12px 0!important}
  .cdishop-home .cdi-offer-card{flex:0 0 calc((100% - 9px)/2)!important}
  .cdishop-home .cdi-offer-title h2{font-size:16px!important}
}

/* Phase 5: isolate the mobile hero from desktop fixed-height/grid rules. */
@media (max-width:767.98px) {
  body.cdi-home-page .cdishop-home .cd-hero-wrap {
    display:block!important; height:auto!important; min-height:0!important;
    grid-template-columns:none!important; align-items:start!important;
  }
  body.cdi-home-page .cdishop-home #cdishopHero {
    display:block!important; width:100%!important;
    height:var(--cdi-mobile-hero-height,auto)!important;
    min-height:0!important; max-height:none!important;
    padding:0!important; margin:0!important;
    aspect-ratio:auto!important; background:#102746!important;
  }
  body.cdi-home-page .cdishop-home #cdishopHero .carousel-inner,
  body.cdi-home-page .cdishop-home #cdishopHero .carousel-item,
  body.cdi-home-page .cdishop-home #cdishopHero .cd-hero-link {
    height:100%!important; min-height:0!important; max-height:100%!important;
    padding:0!important; margin:0!important;
  }
  body.cdi-home-page .cdishop-home #cdishopHero .cd-hero-link {
    display:block!important; position:relative!important;
  }
  body.cdi-home-page .cdishop-home #cdishopHero .carousel-item img {
    display:block!important; width:100%!important; height:100%!important;
    max-width:100%!important; max-height:100%!important;
    object-fit:contain!important; object-position:center!important;
  }
  body.cdi-home-page .cdishop-home .cdi-offer-track {
    display:grid!important; grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important; overflow:visible!important; padding:2px 0 10px!important;
    scroll-snap-type:none!important;
  }
  body.cdi-home-page .cdishop-home .cdi-offer-card {
    flex:none!important; width:auto!important; min-width:0!important;
  }
  body.cdi-home-page .cdishop-home .cdi-offer-media {aspect-ratio:1/1!important}
  body.cdi-home-page .cdishop-home .cdi-offer-name {font-size:12px!important}
  body.cdi-home-page .cdishop-home .cdi-offer-price strong {font-size:16px!important}
  body.cdi-home-page .cdi-chat-launcher,
  body.cdi-home-page .cdi-chat-bubble {
    bottom:calc(88px + env(safe-area-inset-bottom,0px))!important;
    right:12px!important;
  }
}

/* Fase 6: carruseles independientes para relámpago y liquidación. */
body.cdi-home-page .cdishop-home .cdi-offer-track {
  display:flex!important; grid-template-columns:none!important; gap:12px!important;
  overflow-x:auto!important; overflow-y:hidden!important;
  scroll-snap-type:x mandatory!important; scroll-behavior:smooth;
  overscroll-behavior-x:contain; scrollbar-width:none;
  padding:3px 2px 14px!important; align-items:stretch;
}
body.cdi-home-page .cdishop-home .cdi-offer-track::-webkit-scrollbar {display:none}
body.cdi-home-page .cdishop-home .cdi-offer-card {
  flex:0 0 clamp(178px,18%,220px)!important; width:auto!important;
  scroll-snap-align:start; min-width:0!important;
}
body.cdi-home-page .cdishop-home .cdi-offer-heading-actions {display:flex;align-items:center;gap:8px}
body.cdi-home-page .cdishop-home .cdi-offer-nav {
  display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;
  padding:0;border:1px solid #d6e1ef;border-radius:50%;background:#fff;
  color:#14539b;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,.06);
}
body.cdi-home-page .cdishop-home .cdi-offer-nav:disabled {opacity:.3;cursor:default}
body.cdi-home-page .cdishop-home .cdi-offer-nav:focus-visible {outline:3px solid #1d75dd;outline-offset:2px}
body.cdi-home-page .cdishop-home .cdi-offer-no-overflow .cdi-offer-nav {display:none}
@media(max-width:767.98px) {
  body.cdi-home-page .cdishop-home #cdishopHero {display:none!important}
  body.cdi-home-page .cdishop-home .cd-hero-wrap {display:none!important}
  body.cdi-home-page .cdishop-home .cd-solutions-card {
    display:block!important;position:relative!important;width:100%!important;
    margin:12px 0!important;
  }
  body.cdi-home-page .cdishop-home .cdi-offer-track {
    display:flex!important;grid-template-columns:none!important;gap:10px!important;
    overflow-x:auto!important;scroll-snap-type:x mandatory!important;
    padding:2px 1px 12px!important;
  }
  body.cdi-home-page .cdishop-home .cdi-offer-card {
    flex:0 0 calc((100% - 10px)/2)!important;width:auto!important;
  }
  body.cdi-home-page .cdishop-home .cdi-offer-title h2 {font-size:16px!important}
  body.cdi-home-page .cdishop-home .cdi-offer-nav {width:30px;height:30px}
}
@media(prefers-reduced-motion:reduce) {
  body.cdi-home-page .cdishop-home .cdi-offer-track {scroll-behavior:auto}
}

/* CDISHOP: carruseles de promociones automáticos, sin flechas visibles. */
.cdishop-home .cdi-offer-heading-actions .cdi-offer-nav{display:none!important}
.cdishop-home .cdi-offer-track{display:flex!important;flex-wrap:nowrap!important;overflow-x:auto!important;scroll-snap-type:x proximity;scrollbar-width:none;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
.cdishop-home .cdi-offer-track::-webkit-scrollbar{display:none}
.cdishop-home .cdi-offer-track>.cdi-offer-card{flex:0 0 190px;scroll-snap-align:start}
@media(max-width:767.98px){
  .cdishop-home .cd-hero-wrap #cdishopHero{display:none!important}
  .cdishop-home .cd-hero-wrap{display:none!important}
  .cdishop-home .cdi-offer-track>.cdi-offer-card{flex:0 0 calc((100% - 9px)/2);max-width:calc((100% - 9px)/2)}
}
@media(prefers-reduced-motion:reduce){.cdishop-home .cdi-offer-track{scroll-behavior:auto!important}}

/* FASE 6 - Presentación móvil inspirada en el diseño de referencia.
   Sólo estilos: conserva controles, búsqueda, categorías, carrito y chat existentes. */
@media (max-width:767.98px){
  .cdi-mobile-menu-shell .cdi-mobile-topbar{
    background:#ffe500!important;background-image:none!important;
    box-shadow:0 2px 8px rgba(0,0,0,.12)!important;
    min-height:58px!important;gap:7px!important;padding:6px 10px!important;
  }
  .cdi-mobile-menu-shell .cdi-mobile-menu-trigger{
    order:-2!important;min-width:38px!important;width:38px!important;height:40px!important;
    min-height:40px!important;padding:0!important;background:transparent!important;
    border:0!important;box-shadow:none!important;border-radius:8px!important;
    color:#182331!important;font-size:23px!important;
  }
  .cdi-mobile-menu-shell .cdi-mobile-menu-trigger span{display:none!important}
  .cdi-mobile-menu-shell .cdi-mobile-brand{order:-1!important;flex:1 1 auto!important;min-width:0!important;max-width:none!important}
  .cdi-mobile-menu-shell .cdi-mobile-brand img{max-width:155px!important;max-height:40px!important;filter:none!important}
  .cdi-mobile-menu-shell .cdi-mobile-header-actions{order:1!important;gap:3px!important;flex:0 0 auto!important}
  .cdi-mobile-menu-shell .cdi-mobile-header-action{width:34px!important;min-width:34px!important}
  .cdi-mobile-menu-shell .cdi-mobile-header-action-bubble{
    width:34px!important;height:36px!important;background:transparent!important;
    border:0!important;box-shadow:none!important;color:#182331!important;
  }
  .cdi-mobile-menu-shell .cdi-mobile-header-action-bubble i{color:#182331!important}
  .cdi-mobile-menu-shell .cdi-mobile-menu-panel{background:#fff!important}
  .cdi-mobile-menu-shell .cdi-mobile-menu-header{
    background:#ffe500!important;background-image:none!important;color:#17212e!important;
    padding:17px 16px!important;
  }
  .cdi-mobile-menu-shell .cdi-mobile-menu-header-copy small,
  .cdi-mobile-menu-shell .cdi-mobile-menu-header-copy strong{color:#17212e!important}
  .cdi-mobile-menu-shell .cdi-mobile-menu-close{color:#17212e!important}
  .cdi-mobile-menu-shell .cdi-mobile-category-nav{background:#fff!important}
  .cdi-mobile-menu-shell .cdi-mobile-category-row>a,
  .cdi-mobile-menu-shell .cdi-mobile-category-all{color:#202a36!important}
  .cdi-mobile-menu-shell .cdi-mobile-category-icon{color:#1767bc!important}
  .cdi-mobile-menu-shell .cdi-mobile-subcategory-toggle,
  .cdi-mobile-menu-shell .cdi-mobile-grandchild-toggle{background:#fff7c6!important;color:#624d00!important}
  #product-search-form-mobile{border:1px solid #d9dee5!important;border-radius:13px!important;box-shadow:0 2px 8px rgba(0,0,0,.08)!important}
  .cdi-mobile-quick-categories{background:#fff9dc!important}
  .cdi-app-bottom-nav{box-shadow:0 -3px 15px rgba(0,0,0,.09)!important}
}
@media(max-width:380px){
  .cdi-mobile-menu-shell .cdi-mobile-topbar{gap:3px!important;padding-left:6px!important;padding-right:6px!important}
  .cdi-mobile-menu-shell .cdi-mobile-brand img{max-width:125px!important}
  .cdi-mobile-menu-shell .cdi-mobile-header-action{width:30px!important;min-width:30px!important}
  .cdi-mobile-menu-shell .cdi-mobile-header-action-bubble{width:30px!important}
}
