/* ============================================
   WC Quick Order — Frontend Styles
   Compatible WooCommerce, sans modification
/* ============================================*/

/* ---------- Variables ---------- */
:root {
  --wcqo-primary: #25d366;
  --wcqo-primary-dark: #1da851;
  --wcqo-primary-glow: rgba(37, 211, 102, .35);
  --wcqo-white: #ffffff;
  --wcqo-dark: #1a1a2e;
  --wcqo-gray-100: #f8f9fa;
  --wcqo-gray-200: #e9ecef;
  --wcqo-gray-400: #ced4da;
  --wcqo-gray-600: #6c757d;
  --wcqo-gray-800: #343a40;
  --wcqo-danger: #e74c3c;
  --wcqo-radius: 14px;
  --wcqo-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  --wcqo-transition: .3s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Bouton Commander Maintenant ---------- */
.wcqo-order-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 24px;
  padding: 18px 32px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--wcqo-white);
  background: linear-gradient(135deg, var(--wcqo-primary) 0%, #128c7e 100%);
  border: none;
  border-radius: 60px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 15px var(--wcqo-primary-glow),
    0 0 0 0 var(--wcqo-primary-glow);
  transition: var(--wcqo-transition);
  animation: wcqo-pulse-shadow 2.5s ease-in-out infinite;
  z-index: 1;
}

.wcqo-order-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, .25),
    transparent
  );
  transition: left .6s ease;
}

.wcqo-order-btn:hover::before {
  left: 100%;
}

.wcqo-order-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 8px 30px var(--wcqo-primary-glow),
    0 0 0 8px rgba(37, 211, 102, .12);
}

.wcqo-order-btn:active {
  transform: translateY(0) scale(.98);
}

.wcqo-order-btn svg {
  width: 24px;
  height: 24px;
  fill: var(--wcqo-white);
  flex-shrink: 0;
}

@keyframes wcqo-pulse-shadow {
  0%, 100% { box-shadow: 0 4px 15px var(--wcqo-primary-glow), 0 0 0 0 var(--wcqo-primary-glow); }
  50%      { box-shadow: 0 4px 15px var(--wcqo-primary-glow), 0 0 0 12px rgba(37, 211, 102, 0); }
}

/* ---------- Overlay + Modal ---------- */
.wcqo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999998;
  opacity: 0;
  visibility: hidden;
  transition: var(--wcqo-transition);
}

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

.wcqo-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.85);
  width: 94%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--wcqo-white);
  border-radius: var(--wcqo-radius);
  box-shadow: var(--wcqo-shadow);
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: all .35s cubic-bezier(.4, 0, .2, 1);
}

.wcqo-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.wcqo-modal::-webkit-scrollbar {
  width: 6px;
}
.wcqo-modal::-webkit-scrollbar-thumb {
  background: var(--wcqo-gray-400);
  border-radius: 3px;
}

/* ---------- Modal Header ---------- */
.wcqo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.wcqo-modal-header h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--wcqo-dark);
}

.wcqo-modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wcqo-gray-100);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--wcqo-gray-600);
  transition: var(--wcqo-transition);
}

.wcqo-modal-close:hover {
  background: var(--wcqo-danger);
  color: var(--wcqo-white);
}

/* ---------- Produit résumé ---------- */
.wcqo-product-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 28px;
  padding: 14px 16px;
  background: var(--wcqo-gray-100);
  border-radius: 12px;
}

.wcqo-product-summary img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
}

.wcqo-product-summary-info h4 {
  margin: 0 0 4px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--wcqo-dark);
}

.wcqo-product-summary-info span {
  font-size: .85rem;
  color: var(--wcqo-primary-dark);
  font-weight: 600;
}

/* ---------- Formulaire ---------- */
.wcqo-form {
  padding: 8px 28px 28px;
}

.wcqo-form-row {
  margin-bottom: 16px;
}

.wcqo-form-row label {
  display: block;
  margin-bottom: 6px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--wcqo-gray-800);
}

.wcqo-form-row label .required {
  color: var(--wcqo-danger);
  margin-left: 2px;
}

.wcqo-form-row input,
.wcqo-form-row textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: .95rem;
  color: var(--wcqo-dark);
  background: var(--wcqo-gray-100);
  border: 2px solid transparent;
  border-radius: 10px;
  outline: none;
  transition: var(--wcqo-transition);
  box-sizing: border-box;
}

.wcqo-form-row input:focus,
.wcqo-form-row textarea:focus {
  border-color: var(--wcqo-primary);
  background: var(--wcqo-white);
  box-shadow: 0 0 0 4px rgba(37, 211, 102, .12);
}

.wcqo-form-row input.error,
.wcqo-form-row textarea.error {
  border-color: var(--wcqo-danger);
  box-shadow: 0 0 0 4px rgba(231, 76, 60, .1);
}

.wcqo-form-row textarea {
  resize: vertical;
  min-height: 70px;
}

.wcqo-form-row-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.wcqo-form-qty {
  display: flex;
  align-items: center;
  gap: 0;
}

.wcqo-form-qty button {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--wcqo-dark);
  background: var(--wcqo-gray-200);
  border: 2px solid transparent;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  transition: var(--wcqo-transition);
}

.wcqo-form-qty button:last-child {
  border-radius: 0 10px 10px 0;
}

.wcqo-form-qty button:hover {
  background: var(--wcqo-primary);
  color: var(--wcqo-white);
}

.wcqo-form-qty input {
  width: 70px;
  height: 44px;
  text-align: center;
  font-weight: 700;
  border-radius: 0 !important;
  border-left: 2px solid transparent !important;
  border-right: 2px solid transparent !important;
  -moz-appearance: textfield;
}

/* L'input quantité en erreur : bordures latérales deviennent rouges */
.wcqo-form-qty input.error {
  border-left-color: var(--wcqo-danger) !important;
  border-right-color: var(--wcqo-danger) !important;
}

.wcqo-form-qty input::-webkit-inner-spin-button,
.wcqo-form-qty input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

/* ---------- Bouton submit ---------- */
.wcqo-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  margin-top: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--wcqo-white);
  background: linear-gradient(135deg, var(--wcqo-primary) 0%, #128c7e 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--wcqo-transition);
}

.wcqo-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--wcqo-primary-glow);
}

.wcqo-submit-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.wcqo-submit-btn .wcqo-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, .3);
  border-top-color: var(--wcqo-white);
  border-radius: 50%;
  animation: wcqo-spin .6s linear infinite;
  display: none;
}

.wcqo-submit-btn.loading .wcqo-spinner { display: block; }
.wcqo-submit-btn.loading .wcqo-btn-text { display: none; }

@keyframes wcqo-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Message de remerciement ---------- */
.wcqo-thank-you {
  text-align: center;
  padding: 32px 28px;
  display: none;
}

.wcqo-thank-you.active {
  display: block;
  animation: wcqo-fade-up .5s ease;
}

.wcqo-thank-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--wcqo-primary), #128c7e);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wcqo-thank-icon svg {
  width: 36px;
  height: 36px;
  fill: var(--wcqo-white);
  animation: wcqo-check-pop .4s cubic-bezier(.4, 0, .2, 1) .2s both;
}

@keyframes wcqo-check-pop {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(0); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.wcqo-thank-you h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--wcqo-dark);
}

.wcqo-thank-you p {
  margin: 0 0 6px;
  font-size: .95rem;
  color: var(--wcqo-gray-600);
  line-height: 1.6;
}

.wcqo-thank-you .wcqo-order-number {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 14px;
  background: var(--wcqo-gray-100);
  border-radius: 20px;
  font-weight: 700;
  font-size: .9rem;
  color: var(--wcqo-primary-dark);
}

/* ---------- Bouton WhatsApp ---------- */
.wcqo-whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--wcqo-white);
  background: #25d366;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  text-decoration: none;
  transition: var(--wcqo-transition);
  box-shadow: 0 4px 15px rgba(37, 211, 102, .3);
}

.wcqo-whatsapp-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(37, 211, 102, .4);
  background: #1da851;
}

.wcqo-whatsapp-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--wcqo-white);
}

/* ---------- Erreurs ---------- */
.wcqo-error-msg {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: var(--wcqo-danger);
  font-size: .9rem;
  font-weight: 500;
}

.wcqo-error-msg.active { display: flex; }

/* ---------- Animations ---------- */
@keyframes wcqo-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .wcqo-order-btn {
    font-size: 1.05rem;
    padding: 16px 24px;
  }

  .wcqo-modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 20px 20px 0 0;
    top: auto;
    bottom: 0;
    left: 0;
    transform: translate(0, 100%);
    overflow-y: auto;
  }

  .wcqo-modal.active {
    transform: translate(0, 0);
  }

  .wcqo-form-row-inline {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
