/* COSMOSKIN final UAT stabilization patch — 2026-06-29
   Targeted fixes only: auth toggles, premium search animation, cart drawer visibility,
   all products filter natural scroll, checkout coupon/trust spacing, account polish. */

/* Auth password visibility: keep button clickable after modal re-render/overlays */
.password-wrap,
.cs-auth-field--password,
.cs-auth-password-field,
#accountModal .password-wrap {
  position: relative !important;
}
.password-wrap input[type="password"],
.password-wrap input[type="text"],
#accountModal input[type="password"],
#accountModal input[data-password-field] {
  padding-right: 88px !important;
}
.password-toggle,
[data-toggle-password] {
  pointer-events: auto !important;
  user-select: none !important;
  cursor: pointer !important;
  z-index: 50 !important;
}
#accountModal .password-toggle,
#accountModal [data-toggle-password] {
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  min-width: 62px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(23,23,23,.12) !important;
  border-radius: 999px !important;
  background: rgba(255,253,248,.94) !important;
  color: #171717 !important;
  font-size: 11px !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
  line-height: 1 !important;
}
#accountModal .password-toggle:hover,
#accountModal [data-toggle-password]:hover {
  background: #171717 !important;
  color: #fffaf1 !important;
}

/* Premium smooth expanding desktop search: no display none/block jump */
@media (min-width: 1024px) {
  .site-search-form:not(.site-search-form--mobile) {
    flex: 0 0 54px !important;
    width: 54px !important;
    max-width: 54px !important;
    min-width: 54px !important;
    overflow: visible !important;
    transform-origin: right center !important;
    transition: flex-basis 250ms ease-out, width 250ms ease-out, max-width 250ms ease-out, opacity 250ms ease-out, transform 250ms ease-out !important;
  }
  .site-search-form:not(.site-search-form--mobile):hover,
  .site-search-form:not(.site-search-form--mobile):focus-within,
  .site-search-form:not(.site-search-form--mobile).is-search-active {
    flex-basis: min(330px, 28vw) !important;
    width: min(330px, 28vw) !important;
    max-width: min(330px, 28vw) !important;
  }
  .site-search-form:not(.site-search-form--mobile) .site-search {
    width: 100% !important;
    min-width: 54px !important;
    justify-content: flex-end !important;
    overflow: hidden !important;
    transition: border-color 250ms ease-out, background 250ms ease-out, box-shadow 250ms ease-out, transform 250ms ease-out !important;
  }
  .site-search-form:not(.site-search-form--mobile) .site-search-input {
    display: block !important;
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: 0 !important;
    min-width: 0 !important;
    opacity: 0 !important;
    transform: translateX(10px) !important;
    pointer-events: none !important;
    visibility: visible !important;
    transition: max-width 250ms ease-out, opacity 200ms ease-out, transform 250ms ease-out !important;
  }
  .site-search-form:not(.site-search-form--mobile):hover .site-search-input,
  .site-search-form:not(.site-search-form--mobile):focus-within .site-search-input,
  .site-search-form:not(.site-search-form--mobile).is-search-active .site-search-input {
    max-width: 240px !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
    pointer-events: auto !important;
  }
  .site-search-form:not(.site-search-form--mobile) .site-search-clear {
    display: inline-flex !important;
    opacity: 0 !important;
    transform: translateX(6px) scale(.96) !important;
    pointer-events: none !important;
    transition: opacity 200ms ease-out, transform 250ms ease-out !important;
  }
  .site-search-form:not(.site-search-form--mobile):hover .site-search-clear,
  .site-search-form:not(.site-search-form--mobile):focus-within .site-search-clear,
  .site-search-form:not(.site-search-form--mobile).is-search-active .site-search-clear {
    opacity: 1 !important;
    transform: translateX(0) scale(1) !important;
    pointer-events: auto !important;
  }
}

/* All products desktop filter: natural page scroll, no internal scrollbar */
@media (min-width: 961px) {
  .cs-ap-sidebar {
    position: static !important;
    top: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    overflow-y: visible !important;
    scrollbar-width: auto !important;
    align-self: start !important;
  }
  .cs-ap-sidebar__body,
  .cs-ap-filter-body,
  .cs-ap-filters,
  .cs-filter-panel {
    max-height: none !important;
    overflow: visible !important;
    overflow-y: visible !important;
  }
  .cs-ap-sidebar::-webkit-scrollbar,
  .cs-ap-sidebar__body::-webkit-scrollbar,
  .cs-filter-panel::-webkit-scrollbar {
    display: none !important;
  }
}

/* Cart drawer: cart items first, recommendations below, no clipped first product */
/* UX3 2026-07-11: scoped to the non-premium drawer — the UX3 layer in phase6-commerce.css owns .cart-drawer-premium layout (the 42vh/22vh caps here caused clipped rows). */
#cartDrawer:not(.cart-drawer-premium) {
  height: 100dvh !important;
  max-height: 100dvh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
#cartDrawer:not(.cart-drawer-premium) .drawer-head {
  flex: 0 0 auto !important;
  position: relative !important;
  z-index: 3 !important;
  background: #fffdf8 !important;
}
#cartDrawer:not(.cart-drawer-premium) #cartItems,
#cartDrawer:not(.cart-drawer-premium) .cart-items {
  order: 1 !important;
  flex: 0 1 auto !important;
  min-height: 96px !important;
  max-height: min(42vh, 392px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-top: 6px !important;
  padding-bottom: 12px !important;
  scroll-padding-top: 0 !important;
}
#cartDrawer:not(.cart-drawer-premium) #cartItems > *:first-child,
#cartDrawer:not(.cart-drawer-premium) .cart-items > *:first-child {
  margin-top: 0 !important;
}
#cartDrawer:not(.cart-drawer-premium) #phase6CartRecommendations {
  order: 2 !important;
  flex: 0 0 auto !important;
  margin-top: 10px !important;
  max-height: min(22vh, 220px) !important;
  overflow: hidden !important;
}
#cartDrawer:not(.cart-drawer-premium) .cart-summary {
  order: 3 !important;
  flex: 0 0 auto !important;
  position: relative !important;
  bottom: auto !important;
  margin-top: 10px !important;
}
#cartDrawer:not(.cart-drawer-premium).cart-drawer--filled .cart-items:empty::before {
  content: 'Sepet ürünleri yükleniyor…';
  display: block;
  padding: 18px;
  border: 1px solid rgba(23,23,23,.08);
  border-radius: 18px;
  background: #fffaf2;
  color: #6d665c;
}

/* Checkout coupon and trust spacing */
.cs-checkout-discount-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  gap: 8px !important;
  align-items: center !important;
}
.cs-checkout-coupon-clear {
  min-height: 40px !important;
  padding: 0 14px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(23,23,23,.12) !important;
  background: #fffaf2 !important;
  color: #6a5542 !important;
  font-size: 12px !important;
  letter-spacing: .05em !important;
}
.cs-checkout-coupon-applied,
.cs-checkout-coupon-hint {
  margin: 8px 0 0 !important;
  color: #6c5a48 !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}
.cs-checkout-trust-strip,
.checkout-trust-strip,
.checkout-premium-page .trust-strip,
.checkout-premium-page .footer-trustbar {
  margin-top: 30px !important;
  margin-bottom: 20px !important;
  transform: translateY(8px) !important;
}

/* Account premium polish and unclipped order/coupon rows */
.cs-nav-icon {
  background: linear-gradient(135deg, rgba(246,237,224,.96), rgba(255,250,242,.98)) !important;
  color: #9a7040 !important;
  border: 1px solid rgba(154,112,64,.18) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.65) !important;
}
.cs-nav-icon svg,
.cs-stat-icon svg,
.cs-coupon-details svg {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.55 !important;
}
.cs-coupon-code strong {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  letter-spacing: .16em !important;
  font-variant-numeric: tabular-nums !important;
}
.cs-coupon-tabs .cs-tabstrip button {
  cursor: pointer !important;
}
.cs-coupon-tab-panel[hidden] {
  display: none !important;
}
.cs-coupon-table {
  display: grid !important;
  gap: 10px !important;
}
.cs-coupon-row {
  display: grid !important;
  grid-template-columns: minmax(124px, .8fr) minmax(180px, 1.45fr) minmax(126px, .9fr) minmax(126px, .9fr) minmax(80px, auto) auto !important;
  gap: 12px !important;
  align-items: center !important;
  min-width: 0 !important;
  padding: 14px !important;
  border: 1px solid rgba(23,23,23,.08) !important;
  border-radius: 18px !important;
  background: #fffdf8 !important;
}
.cs-coupon-row > * {
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
}
.cs-order-list,
.cs-order-card,
.cs-order-card * {
  min-width: 0 !important;
}
.cs-order-card {
  overflow: visible !important;
}
.cs-order-side,
.cs-order-meta,
.cs-order-shipping,
.cs-order-status-line {
  overflow: visible !important;
  white-space: normal !important;
  word-break: break-word !important;
}
@media (max-width: 760px) {
  .cs-coupon-row {
    grid-template-columns: 1fr !important;
  }
  .cs-checkout-discount-row {
    grid-template-columns: 1fr !important;
  }
}

/* UAT v3 hotfix — keep collapsed desktop search icon visible.
   Root cause: the hidden clear button still occupied width in the 54px collapsed form,
   squeezing/clipping the magnifier icon. Collapse clear button dimensions until active. */
@media (min-width: 1024px) {
  .site-search-form:not(.site-search-form--mobile) .site-search {
    justify-content: flex-start !important;
    gap: 9px !important;
  }
  .site-search-form:not(.site-search-form--mobile) .site-search-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 18px !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    opacity: 1 !important;
    visibility: visible !important;
    color: #6b6056 !important;
    transform: none !important;
  }
  .site-search-form:not(.site-search-form--mobile) .site-search-icon svg {
    display: block !important;
    width: 17px !important;
    height: 17px !important;
    stroke: currentColor !important;
  }
  .site-search-form:not(.site-search-form--mobile) .site-search-clear {
    max-width: 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    border-width: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }
  .site-search-form:not(.site-search-form--mobile):hover .site-search-clear,
  .site-search-form:not(.site-search-form--mobile):focus-within .site-search-clear,
  .site-search-form:not(.site-search-form--mobile).is-search-active .site-search-clear {
    width: auto !important;
    max-width: 44px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    border-width: 1px !important;
  }
}


/* UAT v5 hotfix — normalize desktop search trigger size/spacing to match account/favorites/cart tools.
   Root cause: the overlay search trigger kept a wider 48px/44px box and extra spacing,
   so it looked larger than the other circular tools and left an uneven gap before the account icon. */
@media (min-width: 1024px) {
  .header .site-search-form:not(.site-search-form--mobile) {
    flex: 0 0 42px !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    margin-left: 0 !important;
    margin-right: 8px !important;
    position: relative !important;
    z-index: 70 !important;
  }
  .header .site-search-form:not(.site-search-form--mobile) .site-search {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    padding: 0 11px !important;
    border-radius: 999px !important;
    box-sizing: border-box !important;
    justify-content: center !important;
    gap: 0 !important;
  }
  .header .site-search-form:not(.site-search-form--mobile):hover .site-search,
  .header .site-search-form:not(.site-search-form--mobile):focus-within .site-search,
  .header .site-search-form:not(.site-search-form--mobile).is-search-active .site-search {
    width: min(300px, calc(100vw - 760px)) !important;
    min-width: 238px !important;
    padding: 0 12px 0 14px !important;
    justify-content: flex-start !important;
    gap: 10px !important;
  }
  .header .site-search-form:not(.site-search-form--mobile) .site-search-icon {
    flex: 0 0 20px !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
  }
  .header .site-search-form:not(.site-search-form--mobile) .site-search-icon svg {
    width: 19px !important;
    height: 19px !important;
  }
  .header-tools {
    gap: 8px !important;
    align-items: center !important;
  }
  .header-tools .tool-btn,
  .header-tools > a.btn,
  .header-tools > button {
    width: 42px !important;
    height: 42px !important;
  }
}


/* UAT v6 hotfix — move desktop search back next to account/favorites/cart and normalize icon color.
   Root cause: v5 removed the auto push on the desktop search form, so the trigger stayed in the nav flow
   and drifted left after the support link. Restore margin-left:auto so it sits at the far right of the nav shell,
   immediately before the tool cluster, and make the magnifier color match the other header icons. */
@media (min-width: 1024px) {
  .header .nav-shell {
    justify-content: flex-start !important;
  }
  .header .site-search-form:not(.site-search-form--mobile) {
    margin-left: auto !important;
    margin-right: 0 !important;
    flex: 0 0 42px !important;
    width: 42px !important;
    min-width: 42px !important;
  }
  .header .site-search-form:not(.site-search-form--mobile) .site-search,
  .header .site-search-form:not(.site-search-form--mobile) .site-search-icon {
    color: #1a1510 !important;
  }
  .header .site-search-form:not(.site-search-form--mobile) .site-search-icon svg path,
  .header .site-search-form:not(.site-search-form--mobile) .site-search-icon svg circle,
  .header .site-search-form:not(.site-search-form--mobile) .site-search-icon svg line {
    stroke: currentColor !important;
  }
  .header .site-search-form:not(.site-search-form--mobile):hover .site-search,
  .header .site-search-form:not(.site-search-form--mobile):focus-within .site-search,
  .header .site-search-form:not(.site-search-form--mobile).is-search-active .site-search {
    width: min(300px, calc(100vw - 760px)) !important;
    min-width: 238px !important;
  }
}


/* UAT v7 hotfix — search animation timing only.
   Keeps the v6 structure/position exactly the same; only slows the hover/focus expansion
   to a premium 260ms ease-out rhythm. */
@media (min-width: 1024px) {
  .header .site-search-form:not(.site-search-form--mobile) .site-search {
    transition:
      width 260ms ease-out,
      min-width 260ms ease-out,
      box-shadow 260ms ease-out,
      border-color 220ms ease-out,
      background-color 220ms ease-out !important;
    will-change: width, min-width, box-shadow;
  }
  .header .site-search-form:not(.site-search-form--mobile) .site-search-input {
    transition:
      opacity 210ms ease-out 45ms,
      transform 260ms ease-out !important;
  }
  .header .site-search-form:not(.site-search-form--mobile) .site-search-clear {
    transition:
      opacity 190ms ease-out 55ms,
      width 230ms ease-out,
      max-width 230ms ease-out,
      padding 230ms ease-out !important;
  }
}
