/* ========== POPUP OVERLAY ========== */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* ========== POPUP CONTAINER ========== */
.popup-checkout {
  position: fixed;
  z-index: 1001;
  background: var(--ivory, #F5F0E8);
  overflow-y: auto;
  max-height: 90vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

/* Desktop styles */
@media (min-width: 769px) {
  .popup-checkout {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 480px;
    border-radius: 12px;
    padding: 32px 28px;
  }
  .popup-checkout.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  .popup-checkout {
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 16px 16px 0 0;
    padding: 32px 28px;
    transform: translateY(100%);
  }
  .popup-checkout.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

/* ========== POPUP HEADER ========== */
.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.popup-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.popup-product-img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.popup-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  font-weight: 300;
  color: var(--charcoal, #3A3832);
}

.popup-subtitle {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--warm-grey, #8C8880);
  margin-top: 4px;
}

.popup-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--charcoal, #3A3832);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ========== FORM FIELDS ========== */
.popup-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--charcoal, #3A3832);
}

.form-group input,
.form-group textarea,
.form-group select {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(58, 56, 50, 0.15);
  border-radius: 6px;
  background: #fff;
  color: var(--charcoal, #3A3832);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--sage, #8FA68A);
}

.form-group textarea {
  resize: vertical;
}

.form-group input.error,
.form-group textarea.error,
.form-group select.error {
  border-color: #B5705A;
}

.field-error {
  font-size: 12px;
  color: #B5705A;
  display: none;
}

.field-error.visible {
  display: block;
}

/* ========== QUANTITY ========== */
.quantity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quantity-input {
  width: 70px;
  text-align: center;
}

.quantity-price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  color: var(--charcoal, #3A3832);
}

/* ========== PAYMENT TOGGLE ========== */
.payment-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(58, 56, 50, 0.12);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.payment-option.selected {
  border-color: var(--sage, #8FA68A);
  background: var(--sage-mist, #E8EFE6);
}

.payment-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.payment-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(58, 56, 50, 0.2);
  flex-shrink: 0;
  position: relative;
}

.payment-option.selected .payment-radio {
  border-color: var(--sage, #8FA68A);
}

.payment-option.selected .payment-radio::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border-radius: 50%;
  background: var(--sage, #8FA68A);
}

.payment-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--charcoal, #3A3832);
}

.payment-sub {
  font-size: 12px;
  color: var(--warm-grey, #8C8880);
}

/* ========== SUBMIT BUTTON ========== */
.popup-submit {
  width: 100%;
  background: var(--sage, #8FA68A);
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  padding: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.popup-submit:hover {
  background: #7a9476;
}

.popup-submit:disabled {
  background: var(--warm-grey, #8C8880);
  cursor: not-allowed;
}

/* ========== OTP SCREEN ========== */
.otp-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.otp-screen.active {
  display: flex;
}

.otp-phone {
  font-size: 14px;
  color: var(--warm-grey, #8C8880);
  background: var(--cream, #EDE8DC);
  padding: 8px 16px;
  border-radius: 4px;
}

.otp-message {
  font-size: 14px;
  color: var(--charcoal, #3A3832);
}

.otp-input {
  font-family: 'DM Sans', sans-serif;
  font-size: 28px;
  text-align: center;
  letter-spacing: 8px;
  width: 200px;
  padding: 12px;
  border: 1px solid rgba(58, 56, 50, 0.15);
  border-radius: 6px;
  outline: none;
}

.otp-input:focus {
  border-color: var(--sage, #8FA68A);
}

.otp-resend {
  font-size: 13px;
  color: var(--sage, #8FA68A);
  cursor: pointer;
  display: none;
}

.otp-resend.visible {
  display: block;
}

.otp-error {
  font-size: 12px;
  color: #B5705A;
  display: none;
}

.otp-error.visible {
  display: block;
}

.otp-verify {
  width: 100%;
  background: var(--sage, #8FA68A);
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  padding: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.otp-verify:hover {
  background: #7a9476;
}

/* ========== SUCCESS SCREEN ========== */
.success-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 20px 0;
}

.success-screen.active {
  display: flex;
}

.success-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--sage, #8FA68A);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 300;
  color: var(--charcoal, #3A3832);
}

.success-order {
  font-size: 14px;
  color: var(--warm-grey, #8C8880);
}

.success-message {
  font-size: 14px;
  color: var(--charcoal, #3A3832);
  line-height: 1.6;
}

.success-messenger {
  display: inline-block;
  padding: 12px 24px;
  border: 1px solid var(--sage, #8FA68A);
  border-radius: 6px;
  color: var(--sage, #8FA68A);
  font-size: 14px;
  transition: background 0.2s;
}

.success-messenger:hover {
  background: var(--sage-mist, #E8EFE6);
}

.success-close {
  font-size: 14px;
  color: var(--warm-grey, #8C8880);
  cursor: pointer;
  border: none;
  background: none;
  padding: 8px;
}

/* ========== RATE LIMIT ========== */
.rate-limit-message {
  display: none;
  text-align: center;
  padding: 40px 20px;
}

.rate-limit-message.active {
  display: block;
}

.rate-limit-message p {
  font-size: 14px;
  color: #B5705A;
  line-height: 1.6;
}
