/* ===========================
   TIROIR PANIER (CART DRAWER)
   =========================== */

.cart-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.cart-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 450px;
  height: 100vh;
  background: #fff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
  transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cart-drawer.active {
  right: 0;
}

/* Header du tiroir */
.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px;
  border-bottom: 1px solid #e5e5e5;
  background: #f9f9f9;
}

.cart-drawer-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #000;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-drawer-title svg {
  width: 24px;
  height: 24px;
}

.cart-drawer-close {
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cart-drawer-close:hover {
  background: #e5e5e5;
  transform: rotate(90deg);
}

.cart-drawer-close svg {
  width: 24px;
  height: 24px;
}

/* Contenu du tiroir */
.cart-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.cart-drawer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 15px;
  color: #999;
}

.cart-drawer-empty svg {
  width: 80px;
  height: 80px;
  opacity: 0.3;
}

.cart-drawer-empty p {
  font-size: 1.1rem;
  margin: 0;
}

/* Articles du panier */
.cart-drawer-items {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cart-drawer-item {
  display: flex;
  gap: 15px;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  transition: all 0.3s ease;
  animation: slideInRight 0.4s ease;
}

.cart-drawer-item:hover {
  border-color: #d4af37;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.cart-drawer-item-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.cart-drawer-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cart-drawer-item-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #000;
  margin: 0;
  line-height: 1.3;
}

.cart-drawer-item-meta {
  font-size: 0.8rem;
  color: #666;
}

.cart-drawer-item-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: #d4af37;
}

.cart-drawer-item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}

.cart-drawer-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 4px;
}

.qty-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 600;
}

.qty-btn:hover {
  background: #d4af37;
  color: #fff;
}

.qty-value {
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.cart-drawer-item-remove {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 5px;
  transition: all 0.2s ease;
}

.cart-drawer-item-remove:hover {
  color: #ef4444;
}

.cart-drawer-item-remove svg {
  width: 18px;
  height: 18px;
}

/* Footer du tiroir */
.cart-drawer-footer {
  padding: 20px;
  border-top: 2px solid #e5e5e5;
  background: #f9f9f9;
}

.cart-drawer-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e5e5e5;
}

.drawer-summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  color: #333;
}

.drawer-summary-line.drawer-total {
  font-weight: 800;
  font-size: 1.05rem;
  color: #000;
}

.drawer-summary-value {
  font-weight: 600;
  color: #000;
}

.drawer-summary-value.drawer-free {
  color: #10b981;
  font-weight: 700;
}

.drawer-summary-value.drawer-total-value {
  color: #d4af37;
  font-size: 1.1rem;
}

.drawer-summary-divider {
  height: 1px;
  background: #e5e5e5;
  margin: 4px 0;
}

.drawer-promo-line {
  gap: 8px;
}

.drawer-promo-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.drawer-promo-input:focus {
  border-color: #d4af37;
}

.drawer-promo-btn {
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: #000;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawer-promo-btn:hover {
  background: #d4af37;
}

.cart-drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-drawer-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
}

.cart-drawer-btn-primary {
  background: #000;
  color: #fff;
}

.cart-drawer-btn-primary:hover {
  background: #d4af37;
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(212, 175, 55, 0.3);
}

.cart-drawer-btn-secondary {
  background: #fff;
  color: #000;
  border: 2px solid #000;
}

.cart-drawer-btn-secondary:hover {
  background: #000;
  color: #fff;
}

.cart-drawer-btn svg {
  width: 20px;
  height: 20px;
}

.cart-drawer-trust {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.drawer-trust-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #555;
}

.drawer-trust-item svg {
  width: 18px;
  height: 18px;
  color: #d4af37;
}

/* Mobile */
@media (max-width: 768px) {
  .cart-drawer {
    max-width: 100%;
  }

  .cart-drawer-header {
    padding: 20px;
  }

  .cart-drawer-title {
    font-size: 1.1rem;
  }

  .cart-drawer-content {
    padding: 15px;
  }

  .cart-drawer-item {
    padding: 12px;
  }

  .cart-drawer-item-image {
    width: 70px;
    height: 70px;
  }

  .cart-drawer-footer {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .cart-drawer-header {
    padding: 15px;
  }

  .cart-drawer-title {
    font-size: 1rem;
  }

  .cart-drawer-content {
    padding: 12px;
  }

  .cart-drawer-item {
    padding: 10px;
    gap: 10px;
  }

  .cart-drawer-item-image {
    width: 60px;
    height: 60px;
  }

  .cart-drawer-item-name {
    font-size: 0.85rem;
  }

  .cart-drawer-item-meta {
    font-size: 0.75rem;
  }

  .cart-drawer-summary {
    padding: 12px;
  }

  .drawer-summary-line {
    font-size: 0.85rem;
  }

  .drawer-summary-value.drawer-total-value {
    font-size: 1rem;
  }

  .drawer-promo-line {
    flex-direction: column;
    align-items: stretch;
  }

  .drawer-promo-btn {
    width: 100%;
  }

  .cart-drawer-btn {
    padding: 14px;
    font-size: 0.9rem;
  }
}

/* ===========================
   MODALE CHECKOUT (commande sans changer de page)
   =========================== */
.checkout-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.checkout-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.checkout-modal {
  position: fixed;
  z-index: 10001;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%);
  width: calc(100% - 32px);
  max-width: 540px;
  max-height: 92vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0.3s ease;
}
.checkout-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%);
}

.checkout-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.checkout-modal-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
}
.checkout-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f3f3f3;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #333;
  transition: background 0.2s ease;
}
.checkout-modal-close svg {
  width: 18px;
  height: 18px;
}
.checkout-modal-close:hover {
  background: #e7e7e7;
}

.checkout-modal-body {
  padding: 18px 22px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Résumé */
.checkout-modal-summary {
  margin-bottom: 18px;
}
.cm-sum-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.cm-sum-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cm-sum-item img {
  width: 50px;
  height: 62px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #f2f2f2;
}
.cm-sum-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cm-sum-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cm-sum-meta {
  font-size: 12px;
  color: #888;
}
.cm-sum-price {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}
.cm-sum-ship,
.cm-sum-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
}
.cm-sum-ship {
  font-size: 14px;
  color: #555;
  border-top: 1px solid #eee;
}
.cm-free {
  color: #1a8a3a;
  font-weight: 700;
}
.cm-sum-total {
  font-weight: 800;
  font-size: 16px;
}
.cm-sum-total-value {
  color: #c2a36b;
}

/* Formulaire */
.checkout-modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cm-field label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}
.cm-field input,
.cm-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}
.cm-field textarea {
  resize: vertical;
}
.cm-field input:focus,
.cm-field textarea:focus {
  outline: none;
  border-color: #c2a36b;
}
.cm-payment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f7f3ec;
  border-radius: 10px;
  font-size: 12.5px;
  color: #6b5a36;
}
.cm-payment svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #c2a36b;
}
.checkout-modal-submit {
  margin-top: 4px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 10px;
  background: #0b0b0c;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.25s ease, transform 0.25s ease;
}
.checkout-modal-submit:hover {
  background: #c2a36b;
  color: #1a1305;
  transform: translateY(-2px);
}
.checkout-modal-submit.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Mobile : feuille qui glisse depuis le bas */
@media (max-width: 600px) {
  .checkout-modal {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  .checkout-modal.active {
    transform: translateY(0);
  }
  .checkout-modal-header {
    padding: 16px 18px;
  }
  .checkout-modal-body {
    padding: 16px 18px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .checkout-modal {
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }
}
