/* Checkout Overlay Styles */

.checkout-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.checkout-wrapper.active {
  display: flex;
  opacity: 1;
}

.checkout-overlay {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}

.checkout-wrapper.active .checkout-overlay {
  transform: scale(1) translateY(0);
}

/* Close Button */
.checkout-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 28px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  z-index: 10001;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.checkout-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ffffff;
  transform: scale(1.1);
}

/* Checkout Header */
.checkout-header {
  background: linear-gradient(135deg, #042D6B, #1e40af);
  color: white !important;
  padding: 30px 80px 30px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.checkout-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: white !important;
}

/* Checkout Content Wrapper */
.checkout-content-wrapper {
  flex: 1;
  overflow-y: auto;
  max-height: calc(90vh - 160px);
}

/* Loading State */
.checkout-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 30px;
  color: #666;
}

.checkout-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #042D6B;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Checkout Content */
.checkout-content {
  padding: 30px;
}

.checkout-section {
  margin-bottom: 40px;
}

.checkout-section:last-child {
  margin-bottom: 0;
}

.checkout-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkout-section-title i {
  color: #042D6B;
}

/* Order Summary */
.order-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.order-summary-header:hover {
  background: #f3f4f6;
}

.order-summary-total {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-summary-label {
  font-size: 14px;
  color: #6b7280;
}

.order-summary-price {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.order-summary-toggle {
  color: #6b7280;
  transition: transform 0.2s ease;
}

.order-summary-toggle.expanded {
  transform: rotate(180deg);
}

.order-summary-details {
  display: none;
  padding: 20px;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: white;
}

.order-summary-details.expanded {
  display: block;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

.order-item:last-child {
  border-bottom: none;
}

.order-item-info {
  flex: 1;
}

.order-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 2px;
}

.order-item-quantity {
  font-size: 12px;
  color: #9ca3af;
}

.order-item-price {
  font-size: 14px;
  font-weight: 600;
  color: #059669;
}

.order-summary-note {
  font-size: 12px;
  color: #6b7280;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
  font-style: italic;
}

/* Address Section */
.address-selector {
  margin-bottom: 20px;
}

.address-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.address-option {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.address-option:hover {
  border-color: #042D6B;
  box-shadow: 0 2px 8px rgba(4, 45, 107, 0.1);
}

.address-option.selected {
  border-color: #042D6B;
  background: #f0f7ff;
}

.address-option-label {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 8px;
}

.address-option-details {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.address-option-radio {
  position: absolute;
  top: 16px;
  right: 16px;
}

.new-address-btn {
  background: none;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 16px;
  width: 100%;
  cursor: pointer;
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.new-address-btn:hover {
  border-color: #042D6B;
  color: #042D6B;
  background: #f0f7ff;
}

/* Address Form */
.address-form {
  display: none;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  margin-top: 16px;
}

.address-form.active {
  display: block;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.form-label.required::after {
  content: " *";
  color: #ef4444;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: #042D6B;
  box-shadow: 0 0 0 3px rgba(4, 45, 107, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}

.checkbox-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-label {
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

/* Payment Section */
.payment-method {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.payment-method-logo {
  height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.payment-method-info {
  flex: 1;
}

.payment-method-name {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.payment-method-description {
  font-size: 13px;
  color: #6b7280;
}

/* Bottom Action Bar */
.checkout-action-bar {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.checkout-total {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checkout-total-label {
  font-size: 14px;
  color: #6b7280;
}

.checkout-total-price {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.checkout-submit-btn {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.checkout-submit-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857, #059669);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.checkout-submit-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
}

/* Error Messages */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
}

.error-message.show {
  display: block;
}

/* Success Messages */
.success-message {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
}

.success-message.show {
  display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .checkout-overlay {
    width: 95%;
    max-height: 95vh;
  }

  .checkout-header {
    padding: 20px;
  }

  .checkout-header h2 {
    font-size: 20px;
  }

  .checkout-content {
    padding: 20px;
  }

  .address-options {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .checkout-action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .checkout-submit-btn {
    width: 100%;
    justify-content: center;
  }

  .payment-method-logo {
    height: 32px;
  }

  .address-lookup-row {
    grid-template-columns: 1fr !important;
  }

  .address-lookup-row .flex-2,
  .address-lookup-row .flex-1 {
    flex: 1 1 100% !important;
  }

  .btn-lookup {
    width: 100%;
    margin-top: 0;
  }
}

/* Address Lookup Styles */
.address-lookup-row {
  display: grid !important;
  grid-template-columns: 2fr 1fr auto !important;
  gap: 12px !important;
  align-items: end;
}

.address-lookup-row .flex-2 {
  flex: 2;
}

.address-lookup-row .flex-1 {
  flex: 1;
}

.btn-lookup {
  background: linear-gradient(135deg, #042D6B, #1e40af);
  color: white;
  border: none;
  border-radius: 8px;
  width: 56px;
  height: 48px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin-top: 28px;
  flex-shrink: 0;
}

.btn-lookup:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e40af, #042D6B);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(4, 45, 107, 0.3);
}

.btn-lookup:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.btn-lookup i {
  font-size: 18px;
}

/* Lookup Feedback Messages */
.lookup-error,
.lookup-success {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 12px 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lookup-error::before,
.lookup-success::before {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 16px;
}

.lookup-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.lookup-error::before {
  content: "\f06a"; /* fa-exclamation-circle */
  color: #dc2626;
}

.lookup-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.lookup-success::before {
  content: "\f058"; /* fa-check-circle */
  color: #16a34a;
}

/* Make street and city readonly initially */
.form-control[readonly] {
  background-color: #f3f4f6;
  cursor: not-allowed;
}

.form-control[readonly]:focus {
  background-color: #f3f4f6;
  border-color: #d1d5db;
}
