/* Product grid, modal, and shopping list drawer */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(230px,1fr));
  gap: 22px;
  transition: 0.25s ease;
}

.product-card {
  background: linear-gradient(145deg,#050b13,#0e1823);
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
  cursor: pointer;
  min-width: 0;
}

.product-card:hover {
  transform: translateY(-6px);
  border-color: rgba(24,160,255,0.5);
  box-shadow: 0 16px 28px rgba(0,0,0,0.28);
}

.product-grid.dimmed .product-card {
  opacity: 0.18;
  pointer-events: none;
  transform: scale(0.98);
}

.product-grid.dimmed .product-card.active-card {
  opacity: 1;
  transform: none;
  border-color: rgba(24,160,255,0.75);
}

.product-card img {
  width:100%;
  height:210px;
  object-fit:cover;
}

.product-card-body {
  padding: 16px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.product-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.product-price { font-size: 15px; color: var(--accent); font-weight: 700; }
.product-category { font-size:10px; letter-spacing:0.14em; text-transform:uppercase; color:var(--text-muted); }

.product-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 7, 12, 0.82);
  padding: 18px;
  z-index: 1000;
  overscroll-behavior: contain;
}

.product-modal.active { display: flex; }

.product-modal-content {
  position: relative;
  width: min(900px, 100%);
  max-height: min(92vh, 760px);
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(165deg,#0d1824,#030a13);
  border: 1px solid var(--border-soft);
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.modal-image-panel {
  position: relative;
  background: #02060c;
}

.zoom-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  background: rgba(2, 7, 12, 0.8);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.modal-image-frame {
  overflow: hidden;
  height: 100%;
}

.modal-image {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  transform-origin: var(--zoom-x, 50%) var(--zoom-y, 50%);
  transition: transform 220ms ease;
}

.modal-image-frame:hover .modal-image,
.modal-image-frame.is-zoomed .modal-image {
  transform: scale(1.8);
}

.modal-details {
  padding: 26px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-category {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.modal-name {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  font-family: 'Playfair Display', serif;
}

.modal-price {
  color: var(--accent);
  font-weight: 700;
  margin: 12px 0;
  font-size: 18px;
}

.modal-description {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-size-block {
  margin: 0 0 20px;
}

.modal-size-title {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.size-option {
  border: 1px solid var(--border-soft);
  background: rgba(8, 18, 30, 0.95);
  color: var(--text-main);
  border-radius: 12px;
  padding: 10px 10px;
  font-size: 12px;
  cursor: pointer;
  min-height: 44px;
}

.size-option.selected {
  border-color: rgba(255, 97, 97, 0.95);
  color: #fff5f5;
  background: linear-gradient(145deg, #a61212, #e53b3b);
  box-shadow: 0 0 0 1px rgba(255, 82, 82, 0.35), 0 0 0 0 rgba(255, 82, 82, 0.35);
  animation: sizePulse 1.8s ease-in-out infinite;
}

@keyframes sizePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.5);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 82, 82, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 82, 82, 0);
  }
}

.modal-size-block.has-warning {
  border: 1px solid rgba(255, 89, 89, 0.55);
  border-radius: 12px;
  padding: 10px;
}

.size-warning {
  display: none;
  margin: -6px 0 14px;
  font-size: 12px;
  color: #ff8f8f;
}

.size-warning.active {
  display: block;
}

.modal-quantity-block {
  margin: 0 0 18px;
}

.quantity-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 5px;
  background: rgba(8, 18, 30, 0.95);
}

.qty-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  background: rgba(4, 10, 16, 0.8);
  color: var(--text-main);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.qty-value {
  min-width: 34px;
  text-align: center;
  font-weight: 700;
}

.add-cart-btn {
  padding: 10px 16px;
  background: rgba(9,19,32,0.95);
}

.cart-feedback {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.cart-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 7, 12, 0.82);
  padding: 18px;
  z-index: 1100;
  overscroll-behavior: contain;
}

.cart-modal.active {
  display: flex;
}

.cart-modal-content {
  position: relative;
  width: min(900px, 100%);
  max-height: min(90vh, 760px);
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(165deg,#0d1824,#030a13);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 20px;
  gap: 14px;
}

.cart-modal-header h3 {
  margin: 0;
}

.cart-modal-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.cart-items {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.cart-item {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 10px;
  background: rgba(5, 12, 19, 0.9);
  opacity: 1;
  transform: translateX(0);
  transition: opacity 220ms ease, transform 220ms ease;
}

.cart-item.is-removing {
  opacity: 0;
  transform: translateX(18px);
}

.cart-item img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 10px;
}

.cart-item-body h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.cart-item-body p {
  margin: 3px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.item-total {
  color: var(--accent) !important;
  font-weight: 700;
}

.remove-item-btn {
  border: 1px solid rgba(255, 85, 85, 0.55);
  color: #ffb3b3;
  background: rgba(120, 8, 8, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  cursor: pointer;
  min-height: 44px;
}

.product-card:active,
.add-cart-btn:active,
.qty-btn:active,
.remove-item-btn:active,
.toolbar-btn:active,
.back-btn:active,
.category-buttons button:active,
.category-menu-toggle:active {
  transform: scale(0.98);
  filter: brightness(1.08);
}

.cart-total-row {
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
}

.close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: rgba(4,10,16,0.8);
  color: var(--text-main);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

@media(max-width:860px){
  .product-modal-content { grid-template-columns: 1fr; }

  .modal-image {
    min-height: 240px;
    max-height: 280px;
  }

  .size-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cart-item {
    grid-template-columns: 78px 1fr;
  }

  .cart-item img {
    width: 78px;
    height: 78px;
  }

  .remove-item-btn {
    grid-column: span 2;
    width: 100%;
  }

  .modal-image-frame:hover .modal-image {
    transform: none;
  }

  .product-card:hover {
    transform: none;
    box-shadow: none;
  }
}

@media(max-width:560px){
  .product-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .product-card img {
    height: 200px;
  }

  .modal-details {
    padding: 18px;
  }

  .size-grid {
    grid-template-columns: 1fr;
  }

  .cart-modal-content {
    padding: 14px;
    max-height: 94vh;
  }

  .cart-item-body h4 {
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .modal-name {
    font-size: clamp(20px, 7vw, 26px);
    line-height: 1.22;
    overflow-wrap: anywhere;
  }
}

.checkout-btn {
  border: 1px solid rgba(113, 214, 255, 0.35);
  color: #d6f4ff;
  background: rgba(12, 34, 51, 0.92);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
}

.checkout-btn[hidden] {
  display: none;
}

.messenger-checkout-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 7, 12, 0.82);
  z-index: 1200;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.messenger-checkout-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.messenger-checkout-content {
  position: relative;
  width: min(560px, 100%);
  max-height: min(92vh, 760px);
  overflow-y: auto;
  border-radius: 22px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(165deg,#0d1824,#030a13);
  padding: 20px;
  display: grid;
  gap: 12px;
  transform: translateY(10px);
  transition: transform 220ms ease;
}

.messenger-checkout-modal.active .messenger-checkout-content {
  transform: translateY(0);
}

.order-summary-items {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.messenger-checkout-form {
  display: grid;
  gap: 6px;
}

.messenger-checkout-form label {
  font-size: 13px;
  color: var(--text-muted);
}

.messenger-checkout-form input,
.messenger-checkout-form textarea {
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(4, 10, 16, 0.8);
  color: var(--text-main);
  padding: 10px 12px;
  font: inherit;
}

.messenger-checkout-form input[aria-invalid="true"],
.messenger-checkout-form textarea[aria-invalid="true"] {
  border-color: rgba(255, 95, 95, 0.75);
}

.field-error {
  min-height: 16px;
  margin: 0 0 4px;
  color: #ffb4b4;
  font-size: 12px;
  opacity: 0;
}

.field-error.active {
  opacity: 1;
}

.confirm-order-btn {
  margin-top: 6px;
}
