/* AHProfi configurator v543
   Start red, mobile catalogue rail indicator, compact landscape footer/cart. */

/* Main start modal: use the project red consistently. */
html.ahp-layout-v497 #startScreen .start-title-brand {
  color: #c11015 !important;
}
html.ahp-layout-v497 #startScreen .start-card .btn-primary {
  background: #c11015 !important;
  border-color: #c11015 !important;
  color: #fff !important;
}
@media (hover:hover) {
  html.ahp-layout-v497 #startScreen .start-card .btn-primary:hover {
    background: #a80e12 !important;
    border-color: #a80e12 !important;
  }
}

/* iOS hides native horizontal scrollbars until the user starts scrolling.
   Keep a stable 5px rail under the product cards and show its red thumb only
   when the category really overflows horizontally. */
html.ahp-layout-v497 #editorScreen .ahp-product-rail-indicator {
  display: none;
}
@media (max-width:639px) and (orientation:portrait) {
  html.ahp-layout-v497 #editorScreen #productList.product-list {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  html.ahp-layout-v497 #editorScreen #productList.product-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  html.ahp-layout-v497 #editorScreen .ahp-product-rail-indicator {
    display: block !important;
    position: relative !important;
    flex: 0 0 5px !important;
    width: calc(100% - 4px) !important;
    height: 5px !important;
    min-height: 5px !important;
    max-height: 5px !important;
    margin: 0 2px !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 999px !important;
    background: transparent !important;
  }
  html.ahp-layout-v497 #editorScreen .ahp-product-rail-thumb {
    position: absolute !important;
    top: 1px !important;
    left: 0 !important;
    height: 3px !important;
    border-radius: 999px !important;
    background: #c11015 !important;
    opacity: 0 !important;
    transition: opacity .12s ease, transform .12s ease, width .12s ease !important;
    will-change: transform,width !important;
  }
  html.ahp-layout-v497 #editorScreen .ahp-product-rail-indicator.is-active .ahp-product-rail-thumb {
    opacity: 1 !important;
  }
}

/* Mobile landscape: the fixed footer must be only a thin status strip. */
@media (max-width:999px) and (orientation:landscape) and (max-height:620px) {
  :root {
    --ahp-footer-height: 14px;
  }
  html.ahp-layout-v497 body .app-footer {
    height: 14px !important;
    min-height: 14px !important;
    max-height: 14px !important;
    padding: 0 4px !important;
    font-size: 8px !important;
    line-height: 14px !important;
  }

  /* Cart modal: USP header and totals footer stay compact; the item list gets
     all remaining height and is the only vertically scrolling section. */
  html.ahp-layout-v497 #editorHeader #topSummaryDropdown.top-summary-dropdown,
  html.ahp-layout-v497 #startHeader #startTopSummaryDropdown.top-summary-dropdown {
    top: calc(var(--ahp-viewport-top,0px) + var(--ahp-header-height) + 2px) !important;
    right: max(4px,env(safe-area-inset-right,0px)) !important;
    left: max(4px,env(safe-area-inset-left,0px)) !important;
    width: auto !important;
    max-width: none !important;
    height: calc(var(--ahp-app-height) - var(--ahp-header-height) - var(--ahp-footer-height) - 4px) !important;
    max-height: calc(var(--ahp-app-height) - var(--ahp-header-height) - var(--ahp-footer-height) - 4px) !important;
    padding: 5px 8px 5px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  html.ahp-layout-v497 #editorHeader #topSummaryDropdown.hidden,
  html.ahp-layout-v497 #startHeader #startTopSummaryDropdown.hidden {
    display: none !important;
  }

  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-close {
    width: 28px !important;
    height: 28px !important;
    top: 4px !important;
    right: 5px !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .summary-promotions {
    display: grid !important;
    grid-template-columns: repeat(4,minmax(0,1fr)) !important;
    grid-template-rows: 38px !important;
    flex: 0 0 38px !important;
    min-height: 38px !important;
    height: 38px !important;
    gap: 3px !important;
    padding: 0 31px 0 0 !important;
    margin: 0 0 2px !important;
    overflow: hidden !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .summary-promotion,
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .summary-promotion.is-earned {
    min-height: 38px !important;
    height: 38px !important;
    padding: 2px 4px !important;
    grid-template-rows: minmax(20px,auto) 12px !important;
    gap: 0 !important;
    overflow: hidden !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .summary-promotion:not(.summary-promotion--shipping):not(.summary-promotion--discount) {
    grid-template-rows: 1fr !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) :is(.summary-benefit-main,.summary-discount-head) {
    grid-template-columns: 19px minmax(0,1fr) 12px !important;
    gap: 4px !important;
    align-items: center !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) :is(.summary-promotion-icon,.summary-promotion.is-earned .summary-promotion-icon) {
    width: 18px !important;
    height: 18px !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .summary-promotion-icon .promotion-usp-image {
    width: auto !important;
    height: 17px !important;
    max-width: 19px !important;
    max-height: 17px !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) :is(.summary-benefit-main > strong,.summary-discount-head > strong) {
    font-size: 10px !important;
    line-height: 1.05 !important;
    white-space: normal !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .summary-benefit-check {
    width: 12px !important;
    height: 12px !important;
    font-size: 10px !important;
    margin: 0 !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .summary-benefit-progress,
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) :is(.summary-benefit-progress .promo-progress,.summary-benefit-progress .promo-discount-track) {
    height: 11px !important;
    margin: 0 !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) :is(.summary-benefit-progress .promo-progress::before,.summary-benefit-progress .promo-progress-fill,.summary-benefit-progress--discount .promo-discount-track-base,.summary-benefit-progress--discount .promo-discount-track-fill-first,.summary-benefit-progress--discount .promo-discount-track-fill-next) {
    top: 0 !important;
    height: 3px !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .summary-benefit-progress--discount .promo-discount-track-label {
    top: 5px !important;
    font-size: 8px !important;
    line-height: 1 !important;
  }

  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-area {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
    min-height: 0 !important;
    padding-top: 1px !important;
    overflow: hidden !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-section-heading {
    flex: 0 0 auto !important;
    padding: 1px 2px 2px !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-section-heading strong {
    font-size: 12px !important;
    line-height: 1.05 !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-head {
    flex: 0 0 19px !important;
    min-height: 19px !important;
    height: 19px !important;
    padding: 2px 0 !important;
    margin: 0 !important;
    font-size: 9px !important;
    line-height: 1 !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-scroll {
    flex: 1 1 0 !important;
    min-height: 48px !important;
    max-height: none !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 0 3px 2px !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-row {
    padding: 4px 0 !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-main strong,
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-price strong,
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-qty {
    font-size: 10px !important;
    line-height: 1.05 !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-main small {
    font-size: 8.5px !important;
    line-height: 1.05 !important;
  }

  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-footer {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    align-items: end !important;
    flex: 0 0 auto !important;
    gap: 8px !important;
    padding: 3px 1px 0 !important;
    margin: 0 !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-totals {
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    column-gap: 12px !important;
    row-gap: 0 !important;
    min-width: 0 !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-footer .top-summary-cart-total,
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-footer .top-summary-cart-total.final {
    margin: 0 !important;
    padding: 1px 0 !important;
    border: 0 !important;
    font-size: 9.5px !important;
    line-height: 1.05 !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-footer .top-summary-cart-total :is(span,strong),
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-footer .top-summary-cart-total.final :is(span,strong) {
    font-size: inherit !important;
    line-height: inherit !important;
    white-space: nowrap !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-cart-footer .top-summary-cart-cta {
    grid-column: 2 !important;
    grid-row: 1 / span 2 !important;
    align-self: center !important;
    width: auto !important;
    min-width: 94px !important;
    min-height: 30px !important;
    height: 30px !important;
    margin: 0 !important;
    padding: 4px 10px !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }
}

/* ===== v544: product rail below product cards + aligned cart totals ===== */

/* Portrait mobile catalogue: force the visual sequence explicitly so the
   overflow indicator always sits under the product cards, never above the
   category icons. */
@media (max-width:639px) and (orientation:portrait) {
  html.ahp-layout-v497 #editorScreen .catalog-panel > .editor-promo-bar { order: 1 !important; }
  html.ahp-layout-v497 #editorScreen .catalog-panel > .corner-insert-panel { order: 2 !important; }
  html.ahp-layout-v497 #editorScreen .catalog-panel > .catalog-head { order: 3 !important; }
  html.ahp-layout-v497 #editorScreen .catalog-panel > .category-tabs { order: 4 !important; }
  html.ahp-layout-v497 #editorScreen .catalog-panel > #productList.product-list { order: 5 !important; }
  html.ahp-layout-v497 #editorScreen .catalog-panel > .ahp-product-rail-indicator { order: 6 !important; }
}

/* Landscape mobile cart: keep all price rows on one left-aligned vertical
   axis. The CTA remains in the right column. */
@media (max-width:999px) and (orientation:landscape) and (max-height:620px) {
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-totals {
    grid-template-columns: minmax(0,1fr) !important;
    grid-auto-flow: row !important;
    align-content: end !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-totals .top-summary-cart-total,
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-totals .top-summary-cart-total.final {
    grid-column: 1 !important;
    width: 100% !important;
  }
  html.ahp-layout-v497 :is(#topSummaryDropdown,#startTopSummaryDropdown) .top-summary-totals .top-summary-cart-total.final {
    margin-top: 0 !important;
  }
}
