/* Stripe Elements Checkout Styling */

/* Clear Info Button */
.clear-info-btn {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.clear-info-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.clear-info-btn:active {
  background: #d1d5db;
}

/* Payment Section */
.payment-section {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.payment-form {
  margin-top: 15px;
}

/* Stripe Elements Container */
#payment-element {
  margin-bottom: 20px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

/* Payment Button */
#submit-payment {
  width: 100%;
  padding: 12px 20px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#submit-payment:hover:not(:disabled) {
  background: #1d4ed8;
}

#submit-payment:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Payment Message */
#payment-message {
  margin-top: 15px;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
}

#payment-message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

#payment-message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ffffff;
  border-top: 4px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.loading-text {
  color: white;
  font-size: 18px;
  font-weight: 500;
}

/* Success Modal */
.success-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.success-modal-content {
  background: white;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  max-width: 400px;
  margin: 20px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.success-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.success-modal-content h2 {
  color: #1f2937;
  margin-bottom: 15px;
  font-size: 24px;
}

.success-modal-content p {
  color: #6b7280;
  margin-bottom: 25px;
  line-height: 1.5;
}

.success-btn {
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.success-btn:hover {
  background: #1d4ed8;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .payment-section {
    margin-top: 15px;
    padding: 15px;
  }
  
  #payment-element {
    padding: 12px;
  }
  
  #submit-payment {
    padding: 14px 20px;
    font-size: 16px;
  }
  
  .success-modal-content {
    padding: 30px 20px;
    margin: 15px;
  }
  
  .success-modal-content h2 {
    font-size: 20px;
  }
}

/* Stripe Elements Custom Styling */
.StripeElement {
  padding: 12px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  background: white;
  transition: border-color 0.2s ease;
}

.StripeElement--focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.StripeElement--invalid {
  border-color: #dc2626;
}

.StripeElement--complete {
  border-color: #10b981;
}

/* Form Field Styling */
.payment-form .form-group {
  margin-bottom: 15px;
}

.payment-form .form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #374151;
}

.payment-form .form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.payment-form .form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Error Styling */
.payment-form .form-error {
  color: #dc2626;
  font-size: 12px;
  margin-top: 5px;
}

/* Loading States */
.payment-form.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Animation for smooth transitions */
.payment-section {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Focus management for accessibility */
.payment-section:focus-within {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .payment-section {
    border: 2px solid #000;
  }
  
  #submit-payment {
    border: 2px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .payment-section {
    animation: none;
  }
  
  .spinner {
    animation: none;
  }
  
  .loading-spinner {
    animation: none;
  }
}

/* Product Options Modal */
.option-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.option-modal-content {
  background: white;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.option-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
}

.option-modal-header h3 {
  margin: 0;
  color: #1f2937;
  font-size: 20px;
}

.option-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-modal-close:hover {
  color: #374151;
}

.option-modal-body {
  padding: 20px;
}

.product-info {
  margin-bottom: 20px;
}

.product-info p {
  margin: 0 0 10px 0;
  color: #6b7280;
}

.base-price {
  font-weight: 600;
  color: #1f2937 !important;
}

.option-group {
  margin-bottom: 20px;
}

.option-group h4 {
  margin: 0 0 10px 0;
  color: #374151;
  font-size: 16px;
}

.option-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-choice {
  display: flex;
  align-items: center;
  padding: 10px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-choice:hover {
  border-color: #2563eb;
  background: #f8fafc;
}

.option-choice input[type="radio"],
.option-choice input[type="checkbox"] {
  margin-right: 10px;
}

.option-choice label {
  flex: 1;
  cursor: pointer;
  margin: 0;
}

.option-choice .price {
  font-weight: 600;
  color: #1f2937;
}

.option-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
  margin-top: 20px;
}

.total-price {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.add-to-cart-btn {
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.add-to-cart-btn:hover {
  background: #1d4ed8;
}

/* Mobile responsiveness for modal */
@media (max-width: 768px) {
  .option-modal-content {
    width: 95%;
    max-height: 90vh;
  }
  
  .option-modal-header,
  .option-modal-body {
    padding: 15px;
  }
  
  .option-modal-footer {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .add-to-cart-btn {
    width: 100%;
  }
}

/* Stripe Elements Customization */
#payment-element {
  margin-top: 20px;
}

/* Completely hide default Stripe terms text */
#payment-element .TermsText,
#payment-element [data-testid="terms-text"],
#payment-element .p-Typography,
#payment-element [class*="Terms"],
#payment-element [class*="terms"],
#payment-element [class*="LegalText"],
#payment-element [class*="legal"],
#payment-element [class*="Disclaimer"],
#payment-element [class*="disclaimer"],
#payment-element [class*="Agreement"],
#payment-element [class*="agreement"] {
  display: none !important;
}

/* Hide any text blocks that contain terms-like content */
#payment-element > div > div:last-child {
  display: none !important;
}


/* Hide billing details fields since they're pre-filled */
#payment-element .p-Fieldset[data-testid="billing-details"],
#payment-element .p-Fieldset[data-testid="billing-details"] * {
  display: none !important;
}

/* Compact tab styling */
#payment-element .p-Tab {
  padding: 8px 12px !important;
  margin-bottom: 4px !important;
}

#payment-element .p-TabLabel {
  font-size: 14px !important;
  font-weight: 500 !important;
}

/* Compact input styling */
#payment-element .p-Input {
  padding: 10px !important;
  font-size: 14px !important;
}

#payment-element .p-Label {
  font-size: 13px !important;
  margin-bottom: 4px !important;
}

/* Reduce spacing in payment form */
#payment-element .p-Fieldset {
  margin-bottom: 12px !important;
}

#payment-element .p-Fieldset:last-child {
  margin-bottom: 0 !important;
}

