/* ═══════════════════════════════════════════════
   Cart button (navbar)
   ═══════════════════════════════════════════════ */
.cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.18);
  border: 1.5px solid rgba(255,255,255,.32);
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
  margin-left: 8px;
}
.cart-btn:hover {
  background: rgba(255,255,255,.28);
  border-color: rgba(255,255,255,.5);
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: #f43f5e;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  display: none;
  border: 2px solid var(--brand);
}
.cart-badge.visible { display: block; }

/* ═══════════════════════════════════════════════
   Drawer overlay
   ═══════════════════════════════════════════════ */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  z-index: 350;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s, visibility .28s;
}
.cart-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ═══════════════════════════════════════════════
   Cart drawer
   ═══════════════════════════════════════════════ */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -440px;
  width: 420px;
  height: 100%;
  background: #fff;
  z-index: 360;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 40px rgba(0,0,0,.14);
  transition: right .3s cubic-bezier(.4,0,.2,1);
}
.cart-drawer.open { right: 0; }

/* header */
.cart-drawer__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid #e8edf3;
  flex-shrink: 0;
}
.cart-drawer__title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-drawer__title-count {
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  background: #f1f5f9;
  border-radius: 20px;
  padding: 2px 9px;
}
.cart-drawer__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: none;
  border-radius: 7px;
  font-size: 16px;
  cursor: pointer;
  color: #64748b;
  transition: background .15s, color .15s;
}
.cart-drawer__close:hover { background: #e2e8f0; color: #0f172a; }

/* body */
.cart-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* empty state */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 48px 24px;
  color: #94a3b8;
  gap: 14px;
  text-align: center;
}
.cart-empty__icon { opacity: .35; }
.cart-empty__text { font-size: 15px; color: #64748b; }
.cart-empty__sub  { font-size: 13px; color: #94a3b8; }

/* item row */
.cart-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
.cart-item:hover { background: #fafbfc; }

.cart-item__img {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f1f5f9;
}

.cart-item__info { flex: 1; min-width: 0; }

.cart-item__name {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.cart-item__price {
  font-size: 15px;
  font-weight: 800;
  color: var(--brand);
}

.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}
.cart-qty-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  color: #334155;
  transition: background .12s;
  user-select: none;
}
.cart-qty-btn:hover { background: #dde3eb; }
.cart-qty-num {
  font-size: 14px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
  color: #0f172a;
}

.cart-item__del {
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.cart-item__del:hover { color: #ef4444; background: #fef2f2; }

/* footer */
.cart-drawer__ft {
  padding: 16px 20px 20px;
  border-top: 2px solid #e8edf3;
  background: #f8fafc;
  flex-shrink: 0;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.cart-total-label { font-size: 14px; color: #64748b; font-weight: 500; }
.cart-total-value { font-size: 22px; font-weight: 800; color: #0f172a; }

.cart-checkout-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #3A86C8 0%, #2568A8 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 4px 18px rgba(58,134,200,.38);
  font-family: inherit;
}
.cart-checkout-btn:hover {
  opacity: .93;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(58,134,200,.45);
}
.cart-checkout-btn:active { transform: translateY(0); }
.cart-checkout-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════
   Checkout modal overlay
   ═══════════════════════════════════════════════ */
.checkout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.62);
  backdrop-filter: blur(5px);
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.checkout-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ═══════════════════════════════════════════════
   Checkout modal card
   ═══════════════════════════════════════════════ */
.checkout-modal {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 70px rgba(0,0,0,.22);
  transform: scale(.94) translateY(14px);
  transition: transform .28s cubic-bezier(.34,1.42,.64,1);
  scrollbar-width: thin;
}
.checkout-overlay.active .checkout-modal {
  transform: scale(1) translateY(0);
}

.checkout-modal__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #e8edf3;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-radius: 18px 18px 0 0;
}
.checkout-modal__title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}
.checkout-modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: none;
  border-radius: 7px;
  font-size: 18px;
  cursor: pointer;
  color: #64748b;
  transition: background .15s;
}
.checkout-modal__close:hover { background: #e2e8f0; }

.checkout-modal__body { padding: 20px 24px 24px; }

/* order summary */
.checkout-summary {
  background: #f8fafc;
  border: 1px solid #e8edf3;
  border-radius: 11px;
  padding: 14px 16px;
  margin-bottom: 22px;
}
.checkout-summary__lbl {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 10px;
}
.checkout-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  color: #475569;
  padding: 4px 0;
}
.checkout-summary__row span:last-child { font-weight: 600; color: #0f172a; }
.checkout-summary__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

/* form */
.co-field {
  margin-bottom: 14px;
}
.co-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}
.co-field .req { color: #ef4444; margin-left: 2px; }
.co-field input,
.co-field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #d1d9e0;
  border-radius: 9px;
  font-size: 14px;
  color: #0f172a;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.co-field input:focus,
.co-field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(58,134,200,.13);
}
.co-field textarea {
  resize: vertical;
  min-height: 78px;
}

/* Стан помилки поля */
.co-field input.co-field--error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.13);
}
.co-field-hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
  line-height: 1.4;
}
.co-field-hint--error {
  color: #ef4444;
  font-weight: 500;
}

.co-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #3A86C8 0%, #2568A8 100%);
  color: #fff;
  border: none;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 4px 18px rgba(58,134,200,.38);
  margin-top: 6px;
  font-family: inherit;
}
.co-submit:hover {
  opacity: .93;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(58,134,200,.46);
}
.co-submit:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* success state */
.co-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px 36px;
}
.co-success.show { display: flex; }

.co-success__icon {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 6px 24px rgba(34,197,94,.32);
  animation: coPopIn .4s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes coPopIn {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}
.co-success__title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}
.co-success__text {
  font-size: 14.5px;
  color: #64748b;
  line-height: 1.65;
  max-width: 320px;
}

/* ═══════════════════════════════════════════════
   Toast
   ═══════════════════════════════════════════════ */
.cart-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1e293b;
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 700;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, transform .2s, visibility .2s;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,.28);
  pointer-events: none;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════
   "Add to cart" button (on product pages)
   ═══════════════════════════════════════════════ */
.btn-add-to-cart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #3A86C8 0%, #2568A8 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(58,134,200,.34);
  font-family: inherit;
}
.btn-add-to-cart:hover {
  opacity: .93;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(58,134,200,.44);
}
.btn-add-to-cart:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
  .cart-drawer {
    width: 100%;
    right: -100%;
  }
  .checkout-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .checkout-modal {
    border-radius: 18px 18px 0 0;
    max-height: 96vh;
  }
}
