/* wa-checkout.css - Global WhatsApp Checkout Component Redesign */

:root {
  --wa-primary: #f59e0b; /* Yellow/Orange button */
  --wa-border-color: #f97316; /* Orange container border */
  --wa-bg: #ffffff;
  --wa-text: #1f2937;
  --wa-text-light: #6b7280;
  --wa-gray-light: #f3f4f6;
  --wa-input-border: #d1d5db;
}

/* Modal Overlay */
.wa-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: waFadeIn 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.wa-modal-overlay.wa-hidden {
  display: none;
}

@keyframes waFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Checkout Modal Card */
.wa-checkout-modal {
  background: var(--wa-bg);
  border: 4px solid var(--wa-border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  position: relative;
  animation: waScaleUp 0.3s ease;
}

@keyframes waScaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Modal Header (Close button & optional Title) */
.wa-modal-header {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
}

.wa-close-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--wa-input-border);
  cursor: pointer;
  color: var(--wa-text-light);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wa-close-btn:hover {
  background: #f9fafb;
  color: var(--wa-text);
  transform: scale(1.05);
}

/* Modal Body */
.wa-modal-body {
  padding: 32px 24px 24px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.wa-modal-body::-webkit-scrollbar { width: 6px; }
.wa-modal-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Product Summary Section */
.wa-items-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--wa-gray-light);
}

.wa-item {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wa-item-img-wrap {
  position: relative;
  width: 70px;
  height: 70px;
}

.wa-item-img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.wa-item-qty-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #6b7280;
  color: white;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid white;
}

.wa-item-details {
  flex: 1;
}

.wa-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--wa-text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.wa-item-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--wa-text);
  text-align: right;
  white-space: nowrap;
}

/* Delivery Mode Block */
.wa-delivery-mode {
  margin-bottom: 24px;
}

.wa-delivery-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--wa-text);
}

.wa-delivery-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--wa-input-border);
  border-radius: 8px;
  background: #fff;
}

.wa-delivery-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wa-text);
}

.wa-radio-fake {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 5px solid black;
  background: white;
}

.wa-delivery-right {
  font-size: 14px;
  font-weight: 700;
  color: var(--wa-text);
}

/* Form Styles */
.wa-checkout-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wa-form-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wa-form-label {
  flex: 0 0 100px; /* Fixed width for labels, or adjust as needed */
  font-size: 13px;
  font-weight: 700;
  color: var(--wa-text);
  line-height: 1.2;
}
.wa-form-label span {
  color: #ef4444; /* red star */
}

.wa-input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.wa-input-group {
  display: flex;
  border: 1px solid var(--wa-input-border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.2s;
}

.wa-input-group:focus-within {
  border-color: var(--wa-border-color);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.wa-input-group.wa-has-error {
  border-color: #ef4444;
}

.wa-input-addon {
  background: var(--wa-gray-light);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--wa-input-border);
  color: var(--wa-text-light);
}

.wa-input {
  flex: 1;
  padding: 10px 12px;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--wa-text);
  background: transparent;
  text-align: left;
}

/* For Arabic text layout */
.wa-input::placeholder {
  color: #9ca3af;
  text-align: left;
}

.wa-error-text {
  color: #ef4444;
  font-size: 11px;
  margin-top: 4px;
  display: none;
  font-weight: 500;
}

.wa-input-group.wa-has-error + .wa-error-text {
  display: block;
}

/* Total Section (If cart, otherwise hidden) */
.wa-cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  color: var(--wa-text);
  padding-top: 16px;
  border-top: 1px solid var(--wa-gray-light);
  margin-top: -8px;
  margin-bottom: 16px;
}

/* Submit Button */
.wa-submit-btn {
  margin-top: 8px;
  width: 100%;
  background: var(--wa-primary);
  color: var(--wa-text);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(245, 158, 11, 0.2);
  transition: all 0.3s;
}

.wa-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
  background: #fbbf24;
}

.wa-submit-btn:active {
  transform: translateY(0);
}

.wa-submit-btn svg {
  color: var(--wa-text);
}

/* Responsive fixes */
@media (max-width: 480px) {
  .wa-checkout-modal {
    margin: 10px;
    height: auto;
    max-height: calc(100vh - 20px);
  }
  .wa-form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .wa-form-label {
    flex: none;
    font-size: 12px;
  }
}
