/* Storefront upgrade 2026-09: performance, mobile ergonomics and shared UI. */
:root {
  --storefront-bottom-safe: calc(92px + env(safe-area-inset-bottom, 0px));
  --storefront-focus: #38bdf8;
}

.web-ai { position: fixed; left: 22px; bottom: 22px; z-index: 1200; font-family: inherit; }
.web-ai-launch { position: relative; border: 0; border-radius: 18px; padding: 13px 18px; background: linear-gradient(135deg,#7c3aed,#2563eb); color: #fff; font: 800 .9rem inherit; box-shadow: 0 16px 40px rgba(37,99,235,.35); cursor: pointer; display: flex; gap: 9px; align-items: center; }
.web-ai-pulse { position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 5px rgba(52,211,153,.16); }
.web-ai-panel { width: min(390px,calc(100vw - 24px)); height: min(610px,calc(100dvh - 90px)); background: rgba(10,16,34,.97); border: 1px solid rgba(255,255,255,.12); border-radius: 25px; box-shadow: 0 25px 80px rgba(0,0,0,.5); overflow: hidden; display: flex; flex-direction: column; backdrop-filter: blur(20px); }
.web-ai-panel[hidden], .web-ai[hidden], .web-ai-launch[hidden] { display: none !important; }
.web-ai-panel header { display: flex; justify-content: space-between; align-items: center; padding: 17px 19px; border-bottom: 1px solid rgba(255,255,255,.08); background: linear-gradient(135deg,rgba(124,58,237,.2),rgba(37,99,235,.15)); }
.web-ai-panel header strong, .web-ai-panel header small { display: block; }
.web-ai-panel header small { color: #94a3b8; font-size: .72rem; margin-top: 4px; }
.web-ai-panel header button { border: 0; background: rgba(255,255,255,.07); color: #fff; width: 34px; height: 34px; border-radius: 10px; cursor: pointer; }
.web-ai-messages { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.web-ai-msg { max-width: 88%; padding: 11px 13px; border-radius: 15px; line-height: 1.75; font-size: .86rem; white-space: pre-wrap; }
.web-ai-msg.bot { background: rgba(255,255,255,.07); color: #dbeafe; align-self: flex-start; }
.web-ai-msg.user { background: linear-gradient(135deg,#7c3aed,#2563eb); color: #fff; align-self: flex-end; }
.web-ai-msg img { max-width: 100%; border-radius: 10px; margin-top: 8px; }
.web-ai-msg a { color: #93c5fd; font-weight: 800; }
.web-ai-quick { padding: 0 14px 10px; display: flex; gap: 6px; overflow: auto; }
.web-ai-quick button { white-space: nowrap; border: 1px solid rgba(139,92,246,.3); background: rgba(139,92,246,.1); color: #c4b5fd; border-radius: 999px; padding: 7px 10px; font: 700 .7rem inherit; cursor: pointer; }
.web-ai-panel form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.web-ai-panel input { flex: 1; min-width: 0; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05); color: #fff; border-radius: 13px; padding: 11px; outline: none; }
.web-ai-panel form button { width: 43px; border: 0; border-radius: 12px; background: #7c3aed; color: #fff; cursor: pointer; }
.web-ai-feedback { display: flex; gap: 5px; margin-top: 7px; }
.web-ai-feedback button { border: 0; border-radius: 7px; background: rgba(255,255,255,.07); color: #94a3b8; cursor: pointer; padding: 4px 7px; }

.catalog-search-form {
  display: flex !important;
  direction: rtl;
  align-items: stretch;
  gap: 8px;
  box-sizing: border-box;
  position: sticky;
  top: 12px;
  z-index: 100;
  width: 100%;
  max-width: none;
  padding: 6px !important;
  margin-bottom: 1.35rem;
  border: 1px solid rgba(56, 189, 248, .2);
  border-radius: 21px;
  background: color-mix(in srgb, var(--bg-secondary, #071b30) 88%, transparent);
  box-shadow: 0 14px 36px rgba(2, 12, 27, .16);
  backdrop-filter: blur(14px);
}

.catalog-search-field {
  position: relative;
  flex: 0 1 calc(75% - 4px);
  width: calc(75% - 4px);
  min-width: 0;
  box-sizing: border-box;
}

.catalog-search-field .smart-search-input {
  width: 100% !important;
  height: 58px;
  padding: 13px 52px 13px 48px !important;
  text-align: right;
}

.catalog-search-field .smart-search-icon {
  position: absolute !important;
  top: 50% !important;
  right: 18px !important;
  left: auto !important;
  z-index: 2;
  transform: translateY(-50%) !important;
}

.catalog-search-submit,
.catalog-search-clear {
  min-height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 800 .86rem inherit;
  cursor: pointer;
}

.catalog-search-submit {
  flex: 0 1 calc(25% - 4px);
  width: calc(25% - 4px);
  min-width: 0;
  min-height: 58px;
  box-sizing: border-box;
  gap: 8px;
  padding: 8px 16px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: var(--accent-primary, #0284c7);
}

.catalog-search-clear {
  width: 42px;
  color: var(--text-primary, #eaf4ff);
  text-decoration: none;
  border: 1px solid rgba(148, 163, 184, .24);
  background: rgba(15, 23, 42, .34);
}

.catalog-unified-card {
  content-visibility: auto;
  contain-intrinsic-size: 320px;
}

.catalog-unified-title,
.seo-product__products strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.catalog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px auto 10px;
  padding: 12px;
  max-width: 760px;
}

.catalog-pagination__pages {
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
}

.catalog-pagination a {
  min-width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 12px;
  background: rgba(15, 23, 42, .48);
  color: var(--text-primary, #fff);
  text-decoration: none;
  font-weight: 850;
}

.catalog-pagination a:hover,
.catalog-pagination a:focus-visible,
.catalog-pagination a.is-current {
  border-color: var(--accent-primary, #38bdf8);
  background: color-mix(in srgb, var(--accent-primary, #0284c7) 24%, rgba(15, 23, 42, .75));
  outline: none;
}

.catalog-pagination a.is-current {
  pointer-events: none;
}

.storefront-mobile-nav a:focus-visible,
.catalog-search-submit:focus-visible,
.catalog-search-clear:focus-visible,
.seo-product__actions a:focus-visible,
.seo-product__actions button:focus-visible {
  outline: 3px solid var(--storefront-focus);
  outline-offset: 3px;
}

@media (max-width: 1024px) {
  body.storefront-v2 {
    padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .page-header {
    min-height: 188px !important;
    padding: 74px 18px 24px !important;
    margin-bottom: 18px !important;
  }

  .page-header h1,
  .page-header--image h1 {
    max-width: 100%;
    font-size: clamp(1.65rem, 7vw, 2.2rem) !important;
    line-height: 1.24 !important;
    overflow-wrap: anywhere;
  }

  .back-btn-premium {
    max-width: calc(100% - 32px);
    overflow: hidden;
  }

  .back-btn-premium span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .catalog-search-form {
    top: 8px;
    gap: 8px;
    padding: 6px !important;
    margin-bottom: 1rem !important;
  }

  .catalog-search-submit {
    width: calc(25% - 4px);
  }

  .catalog-pagination {
    justify-content: space-between;
    gap: 8px;
    padding-inline: 0;
  }

  .catalog-pagination__edge {
    font-size: .75rem;
    padding-inline: 10px;
  }

  .catalog-pagination__pages a:not(.is-current) {
    display: none;
  }

  .catalog-pagination__pages a.is-current {
    display: inline-flex;
  }

  .web-ai {
    left: 14px !important;
    bottom: var(--storefront-bottom-safe) !important;
  }

  .web-ai-launch {
    width: 50px;
    height: 50px;
    padding: 0 !important;
    border-radius: 16px !important;
    justify-content: center;
  }

  .web-ai-launch span:not(.web-ai-pulse) {
    display: none !important;
  }

  body.storefront-catalog-page .social-floating-btn,
  body.storefront-product-page .social-floating-btn {
    display: none !important;
  }

  .seo-product__hero {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
    padding: 18px !important;
  }

  .seo-product__copy {
    order: 1;
    min-width: 0;
  }

  .seo-product__media {
    order: 2;
    width: min(100%, 240px) !important;
    max-width: 240px !important;
    margin: 0 auto !important;
  }

  .seo-product__media img {
    object-fit: contain !important;
  }

  .seo-product h1 {
    font-size: clamp(1.42rem, 6.2vw, 2rem) !important;
    line-height: 1.45 !important;
    overflow-wrap: anywhere;
  }

  .seo-product__copy > p:not(.seo-product__eyebrow) {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
  }

  .seo-product__actions {
    position: sticky;
    bottom: var(--storefront-bottom-safe);
    z-index: 80;
    padding: 9px;
    border: 1px solid rgba(56, 189, 248, .22);
    border-radius: 14px;
    background: rgba(5, 20, 38, .94);
    backdrop-filter: blur(14px);
  }

  .seo-product__actions button {
    flex: 1 1 160px;
    min-height: 48px;
  }
}

@media (max-width: 640px) {
  .catalog-search-submit {
    min-height: 54px;
    padding-inline: 10px;
    gap: 6px;
  }

  .catalog-search-submit i {
    font-size: .82rem;
  }

  .catalog-search-field .smart-search-icon {
    right: 16px !important;
  }
}

@media (max-width: 420px) {
  .catalog-unified-title {
    -webkit-line-clamp: 2;
  }

  .catalog-pagination__edge {
    min-width: 82px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-unified-card,
  .catalog-unified-media img,
  .web-ai-launch,
  .mobile-bottom-nav,
  .storefront-route-overlay {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}
