/* ═══════════════════════════════════════════════════════════════
   МАЙСТЕРНЯ КУСЯ — iOS-Style Design System
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  --bg: #f2f2f7;
  --bg2: #ffffff;
  --bg3: #f2f2f7;
  --surface: #ffffff;
  --surface2: rgba(116,116,128,.08);
  --separator: rgba(60,60,67,.18);
  --label: #1d1d1f;
  --label2: rgba(60,60,67,.6);
  --label3: rgba(60,60,67,.3);
  --accent: #007aff;
  --accent-tint: rgba(0,122,255,.12);
  --success: #34c759;
  --warning: #ff9500;
  --danger: #ff3b30;
  --purple: #bf5af2;
  --nav-bg: rgba(242,242,247,.85);
  --nav-border: rgba(60,60,67,.18);
  --tab-bg: rgba(242,242,247,.85);
  --tab-border: rgba(60,60,67,.18);
  --tab-active: #007aff;
  --tab-inactive: rgba(60,60,67,.4);
  --status-color: #1d1d1f;
  --card-bg: #ffffff;
  --card-shadow: 0 2px 20px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --list-bg: #ffffff;
  --list-sep: rgba(60,60,67,.12);
  --status-h: 44px;
  --nav-h: 52px;
  --tab-h: 83px;
  --radius: 14px;
  --radius-lg: 20px;
  --t: .25s cubic-bezier(.32,.72,0,1);
  --t-fast: .15s ease;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg2: #1c1c1e;
  --bg3: #000000;
  --surface: #1c1c1e;
  --surface2: rgba(118,118,128,.24);
  --separator: rgba(84,84,88,.6);
  --label: #f5f5f7;
  --label2: rgba(235,235,245,.6);
  --label3: rgba(235,235,245,.3);
  --accent: #0a84ff;
  --accent-tint: rgba(10,132,255,.15);
  --success: #30d158;
  --warning: #ff9f0a;
  --danger: #ff453a;
  --nav-bg: rgba(28,28,30,.85);
  --nav-border: rgba(84,84,88,.6);
  --tab-bg: rgba(28,28,30,.85);
  --tab-border: rgba(84,84,88,.6);
  --tab-inactive: rgba(235,235,245,.4);
  --status-color: #f5f5f7;
  --card-bg: #1c1c1e;
  --card-shadow: 0 2px 20px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.25);
  --list-bg: #1c1c1e;
  --list-sep: rgba(84,84,88,.5);
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--t), color var(--t);
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }

.status-bar {
  height: var(--status-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 0;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  position: sticky;
  top: 0;
  z-index: 200;
  color: var(--status-color);
}
.status-time { font-size: 15px; font-weight: 600; letter-spacing: -.3px; }
.status-icons { display: flex; align-items: center; gap: 6px; }
.battery {
  width: 25px; height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  position: relative;
  padding: 2px;
}
.battery::after {
  content: '';
  position: absolute;
  right: -5px; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 6px;
  background: currentColor;
  border-radius: 0 1px 1px 0;
}
.battery-fill { height: 100%; background: var(--success); border-radius: 1px; }

.nav-bar {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--nav-border);
  position: sticky;
  top: var(--status-h);
  z-index: 199;
}
.nav-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
.nav-logo { font-size: 22px; }
.nav-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.4px;
  white-space: nowrap;
}
.nav-actions { display: flex; align-items: center; gap: 4px; }
.nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 8px;
}
.nav-back:active { opacity: .5; }
.nav-icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--accent);
  position: relative;
}
.nav-icon-btn:active { background: var(--surface2); }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
.cart-badge {
  position: absolute;
  top: 1px; right: 1px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-content {
  padding-bottom: var(--tab-h);
  min-height: calc(100dvh - var(--status-h) - var(--nav-h));
  position: relative;
}

.page {
  display: none;
  animation: pageFadeIn .28s cubic-bezier(.32,.72,0,1) both;
  padding-bottom: 20px;
}
.page.active { display: block; }
@keyframes pageFadeIn { from { opacity:0; transform:translateY(12px) } to { opacity:1; transform:none } }

.page-header-large { padding: 14px 20px 8px; }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: -.5px; }

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 8px;
}
.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface2);
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
}
.filter-btn:active { background: var(--surface); }

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 16px;
  justify-content: space-between;
  min-height: 52px;
}
.filter-chips-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.filter-status {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.filter-active-type {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.filter-chip {
  padding: 8px 18px;
  background: var(--surface2);
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.filter-chip.active {
  background: var(--accent);
  color: white;
}
.filter-chip:active { transform: scale(.94); }

.filter-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.filter-sheet-overlay.show { opacity: 1; }
.filter-sheet {
  background: var(--bg2);
  width: 100%;
  max-width: 500px;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.filter-sheet-overlay.show .filter-sheet { transform: translateY(0); }
.filter-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 0.5px solid var(--separator);
}
.filter-sheet-header h3 { font-size: 20px; font-weight: 600; }
.filter-close-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.filter-sheet-content { flex: 1; overflow-y: auto; padding: 20px; }
.filter-section { margin-bottom: 24px; }
.filter-section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.filter-options { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-option {
  flex: 1;
  min-width: calc(50% - 10px);
  padding: 14px 12px;
  background: var(--surface2);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}
.filter-option span:first-child { font-size: 20px; }
.filter-option.active {
  background: var(--accent);
  color: white;
}
.filter-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 0.5px solid var(--separator);
}
.filter-reset-btn, .filter-apply-btn {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
}
.filter-reset-btn { background: var(--surface2); color: var(--label); }
.filter-apply-btn { background: var(--accent); color: white; }
.filter-reset-btn:active, .filter-apply-btn:active { transform: scale(0.97); }

/* ─── HOME: PRODUCTS GRID ─── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  padding: 4px 16px 16px;
}

/* Планшеты (600px - 900px) - 3 карточки */
@media (min-width: 600px) and (max-width: 899px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

/* ПК (900px - 1200px) - 4 карточки */
@media (min-width: 900px) and (max-width: 1199px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    padding: 8px 24px 24px;
  }
}

/* Большие экраны (1200px и выше) - 4 карточки, но с ограничением ширины контента */
@media (min-width: 1200px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 8px 24px 24px;
    max-width: 1280px;
    margin: 0 auto;
  }
}

/* Для очень больших экранов (1600px+) - можно 5 карточек, но оставим 4 для комфорта */
@media (min-width: 1600px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1400px;
  }
}

.page-header-large {
  padding: 14px 20px 8px;
}

@media (min-width: 900px) {
  .page-header-large {
    padding: 16px 24px 8px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
  }
  
  .header-row {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 24px 8px;
  }
  
  .filter-chips {
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 24px 16px;
  }
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  overflow: hidden;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
  animation: cardIn .4s cubic-bezier(.32,.72,0,1) both;
}
.product-card:hover { transform: scale(1.025); }
.product-card:active { transform: scale(.97); }
@keyframes cardIn {
  from { opacity:0; transform:translateY(18px) }
  to { opacity:1; transform:none }
}

.card-image-wrap {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg3);
  position: relative;
}
.card-image-emoji {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 72px;
  background: var(--bg3);
}
.card-type-badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}
.badge-success { background: rgba(52,199,89,.85); color: white; }
.badge-warning { background: rgba(255,149,0,.85); color: white; }
.badge-purple { background: linear-gradient(90deg, rgba(191,90,242,.85) 0%, rgba(94,92,230,.85) 100%); background-size: 200%; animation: shimmer 2s linear infinite; color: white; }
@keyframes shimmer { 0% { background-position: 0% } 100% { background-position: 200% } }
[data-theme="dark"] .badge-success { background: rgba(48,209,88,.85); }
[data-theme="dark"] .badge-warning { background: rgba(255,159,10,.85); }

.card-body { padding: 12px 14px 14px; }
.card-name { font-size: 15px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.card-desc { font-size: 12px; color: var(--label2); line-height: 1.4; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-price { font-size: 17px; font-weight: 700; }
.card-add-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-add-btn:active { transform: scale(.85); }

.detail-image-wrap {
  aspect-ratio: 1;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 110px;
  max-height: 320px;
}
.detail-body { padding: 0 16px; }
.detail-header { padding: 16px 0 0; }
.detail-name { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 4px; }
.detail-price-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.detail-price { font-size: 28px; font-weight: 700; }
.detail-desc { font-size: 15px; color: var(--label2); line-height: 1.6; margin-bottom: 16px; }

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--label2);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 14px 16px 6px;
}
.ios-list {
  background: var(--list-bg);
  border-radius: var(--radius);
  margin: 0 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.ios-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: .5px solid var(--list-sep);
}
.ios-list-item:last-child { border-bottom: none; }
.ios-list-item:active { background: var(--surface2); }
.list-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.list-content { flex: 1; }
.list-title { font-size: 15px; }
.list-sub { font-size: 13px; color: var(--label2); margin-top: 1px; }
.chevron { color: var(--label3); }

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  border-bottom: .5px solid var(--list-sep);
}
.spec-row:last-child { border-bottom: none; }
.spec-key { font-size: 15px; }
.spec-val { font-size: 15px; color: var(--label2); }

.colors-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
.color-chip {
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: transform .2s;
}
.color-chip:hover { transform: scale(1.15); }
.color-chip.selected::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 2px solid var(--accent);
  border-radius: 50%;
}
.color-chip-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.color-chip-label { font-size: 10px; color: var(--label2); text-align: center; max-width: 48px; }

.add-to-cart-btn, .checkout-btn, .submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  margin: 16px 16px 0;
  padding: 16px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
}
.add-to-cart-btn:active, .checkout-btn:active, .submit-btn:active { transform: scale(.97); }
.submit-btn { background: var(--success); }

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--label2);
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: .5px solid var(--list-sep);
}
.cart-item-emoji {
  width: 52px; height: 52px;
  background: var(--bg3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 15px; font-weight: 500; }
.cart-item-meta { font-size: 13px; color: var(--label2); margin-top: 2px; }
.cart-item-price { font-size: 15px; font-weight: 600; }
.cart-item-remove {
  width: 24px; height: 24px;
  background: var(--surface2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  padding: 14px;
}
.cart-total-value { font-size: 22px; font-weight: 700; }

.form-field {
  background: var(--list-bg);
  border-radius: var(--radius);
  margin: 0 16px;
  overflow: hidden;
}
.form-input-row {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: .5px solid var(--list-sep);
  gap: 10px;
}
.form-label-inline {
  font-size: 15px;
  color: var(--label2);
  white-space: nowrap;
  min-width: 90px;
}
.form-input {
  flex: 1;
  padding: 13px 0;
  font-size: 15px;
  background: none;
  border: none;
  outline: none;
  color: var(--label);
}
.delivery-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: .5px solid var(--list-sep);
}
.delivery-option:last-child { border-bottom: none; }
.delivery-option input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
.submit-note { font-size: 13px; color: var(--label2); text-align: center; padding: 12px 24px; }

.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tab-h);
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  background: var(--tab-bg);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--tab-border);
  z-index: 100;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  color: var(--tab-inactive);
  font-size: 10px;
  font-weight: 500;
}
.tab-item.active { color: var(--tab-active); }
.tab-item:active { transform: scale(.9); }

.toast {
  position: fixed;
  top: calc(var(--status-h) + var(--nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(50,50,50,.9);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  z-index: 500;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }
@media (min-width: 768px) { :root { --status-h: 0px; } .status-bar { display: none; } }
@media (min-width: 1200px) { .main-content { max-width: 980px; margin: 0 auto; } }
@media (min-width: 900px) { .nav-bar { padding: 0 24px; } .section-label { padding-left: 24px; } .ios-list { margin: 0 24px; } .colors-row { padding: 14px 24px; } .add-to-cart-btn, .checkout-btn, .submit-btn { width: calc(100% - 48px); margin-left: 24px; margin-right: 24px; } .header-row { padding: 14px 24px 8px; } .filter-chips { padding: 8px 24px 16px; } }
::-webkit-scrollbar { width: 0; }

/* Gallery styles */
.detail-gallery {
  position: relative;
  background: var(--bg3);
  width: 100%;
  display: flex;
  justify-content: center;
}
.detail-image-wrap {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  cursor: pointer;
}
@media (min-width: 768px) {
  .detail-image-wrap {
    max-width: 600px;
    border-radius: 20px;
    margin-top: 16px;
  }
}
.detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  color: white;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  z-index: 10;
  border: 1px solid rgba(255,255,255,0.2);
}
.gallery-nav:active { 
  background: rgba(0,0,0,0.8);
  transform: translateY(-50%) scale(0.95);
}
.gallery-prev { left: max(12px, calc((100% - 600px)/2 - 30px)); }
.gallery-next { right: max(12px, calc((100% - 600px)/2 - 30px)); }
@media (max-width: 767px) {
  .gallery-prev { left: 12px; }
  .gallery-next { right: 12px; }
}
.gallery-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}
.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.5);
  transition: all var(--t-fast);
  padding: 0;
  cursor: pointer;
}
.gallery-dot.active {
  width: 20px;
  background: white;
}

/* Fullscreen modal */
.fullscreen-modal {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.fullscreen-modal.active {
  opacity: 1;
  visibility: visible;
}
.fullscreen-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  cursor: pointer;
  z-index: 1001;
  transition: all var(--t-fast);
  border: none;
}
.fullscreen-close:active {
  background: rgba(255,255,255,0.4);
  transform: scale(0.95);
}
.fullscreen-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}
.fullscreen-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  color: white;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  border: none;
}
.fullscreen-nav:active {
  background: rgba(255,255,255,0.4);
  transform: translateY(-50%) scale(0.95);
}
.fullscreen-prev { left: 20px; }
.fullscreen-next { right: 20px; }
.fullscreen-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  z-index: 1001;
}

/* Card image */
.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: var(--bg3);
  color: var(--label2);
}

/* Cart item image */
.cart-item-image {
  width: 52px;
  height: 52px;
  background: var(--bg3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fix for desktop gallery image - full size without cropping */
@media (min-width: 768px) {
  .detail-gallery {
    margin-top: 20px;
  }
  .detail-image-wrap {
    max-width: 600px;
    border-radius: 20px;
    margin: 0 auto;
    aspect-ratio: auto;
    min-height: 400px;
  }
  .detail-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
  }
  .detail-body {
    margin-top: 8px;
  }
}

/* Для очень больших экранов */
@media (min-width: 1200px) {
  .detail-image-wrap {
    max-width: 700px;
    min-height: 450px;
  }
  .detail-image {
    max-height: 550px;
  }
}

/* Чтобы карточка не обрезалась и был отступ сверху */
@media (min-width: 768px) {
  .page#pageProduct {
    padding-top: 20px;
  }
}

/* Отключаем статус-бар на мобильных устройствах */
.status-bar {
  display: none !important;
}

/* Обновляем отступы после удаления статус-бара */
:root {
  --status-h: 0px;
}

.nav-bar {
  top: 0 !important;
}

.main-content {
  min-height: calc(100dvh - var(--nav-h)) !important;
}

/* Для планшетов и ПК статус-бар все равно скрыт */
@media (min-width: 768px) {
  .status-bar {
    display: none;
  }
}

/* Printer card styles for contacts page */
.printer-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  margin: 0 16px 20px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
@media (min-width: 900px) {
  .printer-card {
    margin: 0 24px 24px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
  }
}
.printer-image-wrap {
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
@media (max-width: 899px) {
  .printer-image-wrap {
    aspect-ratio: 1;
  }
}
@media (min-width: 900px) {
  .printer-image-wrap {
    width: 280px;
    flex-shrink: 0;
    padding: 24px;
  }
}
.printer-image {
  width: 100%;
  height: auto;
  max-width: 200px;
  object-fit: contain;
}
@media (min-width: 900px) {
  .printer-image {
    max-width: 100%;
  }
}
.printer-info {
  padding: 16px;
}
@media (min-width: 900px) {
  .printer-info {
    flex: 1;
    padding: 20px 20px 20px 0;
  }
}
.printer-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.3px;
  margin-bottom: 8px;
  color: var(--label);
}
.printer-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--label2);
  margin-bottom: 16px;
}
.printer-specs {
  background: var(--surface2);
  border-radius: var(--radius);
  overflow: hidden;
}
.specs-table {
  width: 100%;
}
.specs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--separator);
}
.specs-row:last-child {
  border-bottom: none;
}
.specs-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--label);
}
.specs-value {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
}

/* ========== REVIEWS PAGE STYLES ========== */
.review-button-wrap {
  padding: 8px 20px 16px;
}
@media (min-width: 900px) {
  .review-button-wrap {
    padding: 8px 24px 20px;
  }
}
.add-review-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.add-review-btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

/* Review Card */
.review-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  margin: 0 16px 16px;
  padding: 16px;
  box-shadow: var(--card-shadow);
}
@media (min-width: 900px) {
  .review-card {
    margin: 0 24px 20px;
    padding: 20px;
  }
}
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.review-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--label);
}
.review-stars {
  display: flex;
  gap: 4px;
}
.review-star {
  font-size: 18px;
  color: #ffcc00;
}
.review-star.empty {
  color: #e2e2e8;
}
[data-theme="dark"] .review-star.empty {
  color: #3a3a3c;
}
.review-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--label2);
  margin-bottom: 12px;
}
.review-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.review-photo {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  cursor: pointer;
  transition: transform var(--t-fast);
  background: var(--bg3);
}
.review-photo:hover {
  transform: scale(1.05);
}
.review-photo:active {
  transform: scale(0.98);
}

/* Stars empty state for dark mode compatibility */
[data-theme="dark"] .review-star {
  text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* Review image fullscreen modal (без смены темы) */
.review-fullscreen-modal {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.review-fullscreen-modal.active {
  opacity: 1;
  visibility: visible;
}
.review-fullscreen-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  cursor: pointer;
  z-index: 2001;
  transition: all 0.15s ease;
  border: none;
}
.review-fullscreen-close:active {
  background: rgba(255,255,255,0.4);
  transform: scale(0.95);
}
.review-fullscreen-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

/* Review total amount */
.review-total {
  font-size: 12px;
  font-weight: 500;
  color: var(--success);
  background: var(--surface2);
  padding: 3px 8px;
  border-radius: 20px;
  margin-left: 8px;
  display: inline-block;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.review-header > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-custom {
  background: linear-gradient(135deg, #ff9500, #bf5af2);
  color: white;
  animation: shimmer 3s linear infinite;
  background-size: 200%;
}

/* ========== CALCULATOR STYLES ========== */
.calculator-container {
  padding: 8px 16px 24px;
}
@media (min-width: 900px) {
  .calculator-container {
    padding: 8px 24px 32px;
    max-width: 800px;
    margin: 0 auto;
  }
}

.calculator-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  padding: 20px;
}

.calculator-info {
  text-align: center;
  margin-bottom: 24px;
}
.calculator-info p:first-child {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}
.calculator-note {
  font-size: 13px;
  color: var(--label2);
}

.calculator-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--label);
}
.unit {
  font-size: 12px;
  font-weight: normal;
  color: var(--label2);
}

.plastic-options, .color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.plastic-option, .color-option {
  flex: 1;
  min-width: 80px;
  padding: 12px 16px;
  background: var(--surface2);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--t-fast);
  text-align: center;
}
.plastic-option.active, .color-option.active {
  background: var(--accent);
  color: white;
}
.plastic-price {
  font-size: 11px;
  font-weight: normal;
  opacity: 0.7;
}

.form-input-calc {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--separator);
  border-radius: 12px;
  font-size: 16px;
  color: var(--label);
  font-family: var(--font);
}
.form-input-calc:focus {
  outline: none;
  border-color: var(--accent);
}

.calc-btn {
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  margin-top: 8px;
}
.calc-btn:active {
  transform: scale(0.97);
}

.calculator-result {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--separator);
}
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 500;
}
.result-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}
.result-details {
  background: var(--surface2);
  border-radius: 12px;
  padding: 12px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 0.5px solid var(--separator);
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-row.highlight {
  color: var(--warning);
  font-weight: 500;
}
.detail-row.total {
  font-weight: 700;
  font-size: 16px;
  padding-top: 10px;
  margin-top: 5px;
  border-top: 1px solid var(--separator);
  color: var(--label);
}
.result-note {
  font-size: 11px;
  color: var(--label2);
  text-align: center;
  margin-top: 12px;
}

/* ========== CALCULATOR STYLES ========== */
.calculator-container {
  padding: 8px 16px 24px;
}
@media (min-width: 900px) {
  .calculator-container {
    padding: 8px 24px 32px;
    max-width: 800px;
    margin: 0 auto;
  }
}

.calculator-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  padding: 20px;
}

.calculator-info {
  text-align: center;
  margin-bottom: 24px;
}
.calculator-info p:first-child {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}
.calculator-note {
  font-size: 13px;
  color: var(--label2);
}

.calculator-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--label);
}
.unit {
  font-size: 12px;
  font-weight: normal;
  color: var(--label2);
}

.field-note {
  font-size: 11px;
  color: var(--label2);
  margin-top: -5px;
  padding-left: 4px;
}

.plastic-options, .color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.plastic-option, .color-option {
  flex: 1;
  min-width: 80px;
  padding: 12px 16px;
  background: var(--surface2);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--t-fast);
  text-align: center;
}
.plastic-option.active, .color-option.active {
  background: var(--accent);
  color: white;
}
.plastic-price {
  font-size: 11px;
  font-weight: normal;
  opacity: 0.7;
}

.time-row {
  display: flex;
  gap: 12px;
}
.time-field {
  flex: 1;
  position: relative;
}
.time-field .form-input-calc {
  padding-right: 50px;
}
.time-label {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--label2);
}

.form-input-calc {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--separator);
  border-radius: 12px;
  font-size: 16px;
  color: var(--label);
  font-family: var(--font);
}
.form-input-calc:focus {
  outline: none;
  border-color: var(--accent);
}

.calc-btn {
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  margin-top: 8px;
}
.calc-btn:active {
  transform: scale(0.97);
}

.calculator-result {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--separator);
}
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 500;
}
.result-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}
.result-details {
  background: var(--surface2);
  border-radius: 12px;
  padding: 12px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 0.5px solid var(--separator);
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-row.highlight {
  color: var(--warning);
  font-weight: 500;
}
.detail-row.total {
  font-weight: 700;
  font-size: 16px;
  padding-top: 10px;
  margin-top: 5px;
  border-top: 1px solid var(--separator);
  color: var(--label);
}
.result-note {
  font-size: 11px;
  color: var(--label2);
  text-align: center;
  margin-top: 12px;
}

/* Custom order block */
.calculator-custom-order {
  margin-top: 28px;
  padding: 20px;
  background: linear-gradient(135deg, var(--accent-tint) 0%, var(--surface2) 100%);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.custom-order-icon {
  font-size: 40px;
  background: var(--accent);
  width: 60px;
  height: 60px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.custom-order-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--label);
}
.custom-order-text strong {
  font-size: 16px;
}
.custom-order-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform var(--t-fast);
}
.custom-order-btn:active {
  transform: scale(0.95);
}
@media (max-width: 600px) {
  .calculator-custom-order {
    flex-direction: column;
    text-align: center;
  }
  .custom-order-btn {
    white-space: normal;
  }
}

/* ========== FIX FOR TRANSPARENT PNG IN DARK MODE ========== */

/* Добавляем светлую рамку для карточек товаров в темной теме */
[data-theme="dark"] .product-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Добавляем фон для области изображения, чтобы PNG не сливался */
[data-theme="dark"] .card-image-wrap {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Для детальной страницы товара */
[data-theme="dark"] .detail-image-wrap {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
}

/* Для изображений в корзине */
[data-theme="dark"] .cart-item-image {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Для карточки принтера */
[data-theme="dark"] .printer-image-wrap {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
}

/* Легкая тень для карточек в темной теме */
[data-theme="dark"] .product-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(10, 132, 255, 0.15);
}

/* ========== ПК ВЕРСИЯ - КОМПАКТНОЕ РАСПОЛОЖЕНИЕ ========== */

@media (min-width: 900px) {
  /* Навигационная панель - элементы ближе к центру */
  .nav-bar {
    justify-content: center;
    gap: 20px;
    padding: 0 16px;
  }
  
  .nav-title-wrap {
    position: static;
    transform: none;
    margin: 0;
  }
  
  .nav-actions {
    position: absolute;
    right: 24px;
    display: flex;
    gap: 8px;
  }
  
  .nav-back {
    position: absolute;
    left: 24px;
  }
  
  /* Таб бар - центрируем кнопки */
  .tab-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 8px 20px 0;
  }
  
  .tab-item {
    flex: 0 1 auto;
    min-width: 80px;
  }
}

/* Исключение для принтера — убираем фон на темной теме */
[data-theme="dark"] .printer-image-wrap {
  background: transparent !important;
  border: none !important;
}

/* Заголовок отзыва - имя и мета-информация в одной строке */
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.review-name-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.review-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--label);
}

.review-order-type {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.order-type-site {
  background: var(--accent-tint);
  color: var(--accent);
}

.order-type-personal {
  background: rgba(191, 90, 242, 0.15);
  color: var(--purple);
}

.review-date {
  font-size: 11px;
  color: var(--label2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.review-stars {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.review-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--label2);
  margin-bottom: 12px;
}

/* ========== СТАТИСТИКА И ФИЛЬТР ОТЗЫВОВ ========== */
.reviews-stats {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  margin: 0 16px 20px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

@media (min-width: 900px) {
  .reviews-stats {
    margin: 0 24px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
  }
}

.stats-average {
  text-align: center;
  min-width: 120px;
}

.average-number {
  font-size: 48px;
  font-weight: 700;
  color: var(--label);
  line-height: 1;
}

.average-stars {
  margin: 8px 0;
}

.average-count {
  font-size: 13px;
  color: var(--label2);
}

.stats-bars {
  flex: 1;
  min-width: 200px;
}

.stat-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.stat-star {
  width: 45px;
  font-size: 13px;
  color: var(--label2);
}

.stat-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: #ffcc00;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.stat-count {
  width: 30px;
  font-size: 13px;
  color: var(--label2);
  text-align: right;
}

.reviews-filter {
  width: 100%;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--separator);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (min-width: 900px) {
  .reviews-filter {
    width: auto;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-left: auto;
  }
}

.filter-label {
  font-size: 13px;
  color: var(--label2);
}

.filter-stars {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.star-filter {
  padding: 6px 14px;
  background: var(--surface2);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
}

.star-filter.active {
  background: var(--accent);
  color: white;
}

.star-filter:active {
  transform: scale(0.95);
}

/* Стиль для цвета под заказ */
.color-chip.out-of-stock {
  opacity: 0.5;
  filter: grayscale(0.3);
  cursor: not-allowed !important;
}

.color-chip.out-of-stock:hover {
  transform: none;
}

/* Стиль для цвета под заказ - только иконка часов на кружке */
.color-chip.pre-order {
  position: relative;
}

.color-chip.pre-order::after {
  content: '⏳';
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 12px;
  background: var(--warning);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: 0 0 2px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* Иконка часов рядом с названием цвета */
.color-chip-label {
  font-size: 11px;
  color: var(--label2);
  text-align: center;
  max-width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.pre-order-icon {
  font-size: 10px;
  color: var(--warning);
  margin-left: 2px;
}

/* Для выбранного цвета под заказ */
.color-chip.selected.pre-order::after {
  background: var(--accent);
}

.badge-limited {
  background: linear-gradient(135deg, #34c759, #30d158);
  color: white;
  font-weight: 700;
  animation: limitedPulse 1.5s ease infinite;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

@keyframes limitedPulse {
  0% { opacity: 0.8; transform: scale(1); background: linear-gradient(135deg, #34c759, #30d158); }
  50% { opacity: 1; transform: scale(1.02); background: linear-gradient(135deg, #44d769, #40e168); }
  100% { opacity: 0.8; transform: scale(1); background: linear-gradient(135deg, #34c759, #30d158); }
}

[data-theme="dark"] .badge-limited {
  background: linear-gradient(135deg, #34c759, #30d158);
  color: white;
  box-shadow: 0 2px 12px rgba(52, 199, 89, 0.5);
}

/* Фікс для тост-повідомлень на мобільних */
.toast {
  white-space: normal !important;
  max-width: 90vw;
  text-align: center;
  font-size: 14px;
  padding: 12px 16px;
  line-height: 1.4;
  word-break: break-word;
}