/* ==========================================================
   Quick Order Module — Theme-Matching Styles
   Inherits theme colors via Bootstrap classes.
   ========================================================== */

/* ---------- Wrapper ---------- */
.quickorder-form-wrapper {
  padding: 0;
  margin-top: 16px;
  border: none;
  background: transparent;
}

.quickorder-cart-wrapper {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 24px 20px;
  margin-top: 0;
}

/* ---------- Title ---------- */
.quickorder-title {
  font-size: 15px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 8px 0;
  text-transform: none;
}

.quickorder-divider {
  height: 1px;
  background: #CBD5E1;
  border: none;
  margin-bottom: 16px;
}

/* ---------- Form Fields ---------- */
.quickorder-field {
  margin-bottom: 10px;
}

.quickorder-field input,
.quickorder-field select {
  width: 100%;
  padding: 0 16px;
  height: 48px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background-color: #fff;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  transition: border-color 0.2s ease;
  outline: none;
  box-sizing: border-box;
  line-height: 48px;
}

.quickorder-field select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.quickorder-field input::placeholder {
  color: #CBD5E1;
  font-weight: 500;
}

.quickorder-field input:focus,
.quickorder-field select:focus {
  border-width: 2px;
  border-color: #333;
}

.quickorder-field.has-error input,
.quickorder-field.has-error select {
  border-color: #dc3545;
}

/* ---------- Totals ---------- */
.quickorder-totals {
  margin: 12px 0;
  padding: 8px 0;
}

.quickorder-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
}

.quickorder-line span:last-child {
  font-weight: 400;
}

.quickorder-total-line {
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid #CBD5E1;
  font-size: 16px;
}

.quickorder-total-line strong {
  font-weight: 700;
  color: #000;
}

/* ---------- Actions Row ---------- */
.quickorder-actions {
  margin-top: 8px;
}

.quickorder-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* "Acheter maintenant" — uses .btn.btn-primary from theme for color */
.quickorder-buy-btn {
  flex: 1;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.quickorder-buy-btn:hover {
  opacity: 0.9;
}

.quickorder-buy-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Quantity Controls ---------- */
.quickorder-qty {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  height: 48px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.quickorder-qty-btn {
  width: 40px;
  height: 100%;
  border: none;
  background: #f0f0f0;
  color: #333;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  line-height: 1;
}

.quickorder-qty-btn:hover {
  background: #e0e0e0;
}

.quickorder-qty-display {
  padding: 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  text-align: center;
  min-width: 24px;
  user-select: none;
}

/* ---------- "Ajouter au panier" moved into our form ---------- */
#quickorder-addtocart-slot {
  margin-top: 8px;
}

#quickorder-addtocart-slot .add {
  width: 100%;
}

/* Override the original btn-primary to make it an outlined/secondary button */
#quickorder-addtocart-slot .add-to-cart,
.quickorder-addtocart-btn {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  background: #fff !important;
  color: #333 !important;
  border: 1px solid #CBD5E1 !important;
  transition: all 0.2s ease;
  box-shadow: none !important;
}

#quickorder-addtocart-slot .add-to-cart:hover,
.quickorder-addtocart-btn:hover {
  background: #f8f8f8 !important;
  border-color: #999 !important;
}

/* ---------- Error Messages ---------- */
.quickorder-errors {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #dc2626;
  font-size: 13px;
  line-height: 1.5;
}

.quickorder-errors ul {
  margin: 0;
  padding: 0 0 0 16px;
  list-style: disc;
}

/* ---------- Loading ---------- */
.quickorder-loading {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 13px;
}

.quickorder-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e5e5e5;
  border-top-color: #333;
  border-radius: 50%;
  animation: quickorder-spin 0.6s linear infinite;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .quickorder-actions-row {
    flex-direction: column;
    gap: 8px;
  }

  .quickorder-buy-btn {
    width: 100% !important;
    min-height: 54px !important;
  }

  #quickorder-addtocart-slot .add-to-cart,
  .quickorder-addtocart-btn {
    min-height: 54px !important;
  }

  .quickorder-qty {
    align-self: center;
  }
}
