/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: #1e293b;
  background: linear-gradient(135deg, #f8fafc 0%, #e0f2fe 100%);
  min-height: 100vh;
}

/* Header */
.header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  width: 40px;
  height: 40px;
  background: #3bf6b3;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.header-subtitle {
  font-size: 0.75rem;
  color: #64748b;
}

.header-right {
  text-align: right;
}

.header-right p {
  font-size: 0.875rem;
  color: #64748b;
}

.support-phone {
  font-size: 0.875rem;
  font-weight: 600;
  color: #3b82f6;
}

/* Main Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.checkout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .checkout-grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* Card Styles */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-content {
  padding: 1.5rem;
}

/* Form Styles */
.form-section {
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
  position: relative;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.form-row.two-cols {
  grid-template-columns: 1fr 1fr;
}

.form-row.address-row {
  grid-template-columns: 1fr 1fr 2fr;
}

@media (max-width: 768px) {
  .form-row.two-cols,
  .form-row.address-row {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #1e293b;
}

.required {
  color: #ef4444;
}

input,
select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.2s;
  background: white;
}

input:focus,
select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input.error,
select.error {
  border-color: #ef4444;
}

input.valid,
select.valid {
  border-color: #10b981;
  padding-right: 2.5rem;
}

/* Valid checkmark */
.form-group.valid::after {
  content: '✓';
  position: absolute;
  right: 0.75rem;
  top: 2.25rem;
  color: #10b981;
  font-weight: bold;
  font-size: 1.125rem;
}

.error-message {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: none;
}

.error-message.show {
  display: block;
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.checkbox-group label {
  margin: 0;
  cursor: pointer;
  font-weight: 400;
}

/* Security Notice */
.security-notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.security-notice-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.security-notice-content p:first-child {
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 0.25rem;
}

.security-notice-content p:last-child {
  font-size: 0.875rem;
  color: #1e40af;
}

/* Security Badges */
.security-badges {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  margin-top: 1rem;
}

.badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

/* Order Summary */
.product-info {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.product-image {
  width: 96px;
  height: 96px;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  flex-shrink: 0;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.product-details h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.product-description {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.product-sku {
  display: inline-block;
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #64748b;
}

/* Quantity Selector */
.quantity-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quantity-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  transition: all 0.2s;
}

.quantity-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity-value {
  width: 48px;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
}

/* Discount Input */
.discount-input-group {
  display: flex;
  gap: 0.5rem;
}

.discount-input-group input {
  flex: 1;
}

.discount-btn {
  padding: 0.625rem 1rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.discount-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.discount-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.discount-success {
  color: #10b981;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Separator */
.separator {
  height: 1px;
  background: #e2e8f0;
  margin: 1.5rem 0;
}

/* Price Breakdown */
.price-breakdown {
  margin-top: 1.5rem;
}

.price-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.price-label {
  color: #64748b;
}

.price-value {
  font-weight: 500;
}

.price-row.discount {
  color: #10b981;
}

.price-row.total {
  font-size: 1.125rem;
  font-weight: 700;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.price-row.total .price-value {
  color: #3b82f6;
}

/* Security Badge Box */
.security-box {
  background: #f8fafc;
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 1.5rem;
}

.security-box-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

/* Submit Button */
.submit-btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 1.5rem;
}

.submit-btn:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Success Page */
.success-page {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.success-page.show {
  display: flex;
}

.success-card {
  max-width: 500px;
  width: 100%;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  text-align: center;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: #d1fae5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 3rem;
}

.success-card h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

.success-card p {
  color: #64748b;
  margin-bottom: 1.5rem;
}

.success-details {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.success-detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.success-detail-row:last-child {
  margin-bottom: 0;
}

.success-detail-label {
  color: #64748b;
}

.success-detail-value {
  font-weight: 600;
}

.order-id {
  font-family: monospace;
  font-size: 0.75rem;
}

/* Payment Method Icons Section */
.payment-methods {
  background: white;
  border-top: 1px solid #e2e8f0;
  padding: 2rem 1.5rem;
  margin-top: 2rem;
}

.payment-methods-content {
  max-width: 1280px;
  margin: 0 auto;
  text-align: center;
}

.payment-methods-title {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 1rem;
  font-weight: 500;
}

.payment-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.payment-icon {
  width: 60px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 1.5rem;
}

.payment-icon:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}

.payment-icon svg,
.payment-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.5rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: #64748b;
  font-size: 0.875rem;
}

.footer p {
  margin-bottom: 0.5rem;
}

/* Sticky Order Summary on Desktop */
@media (min-width: 1024px) {
  .order-summary-wrapper {
    position: sticky;
    top: 5rem;
  }
}

/* Hidden Shipping Form */
.shipping-fields {
  display: none;
  padding-top: 1rem;
}

.shipping-fields.show {
  display: block;
}

/* Loading State */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: none;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

.toast.show {
  display: flex;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

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

.toast-icon {
  font-size: 1.5rem;
}

.toast-content h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.toast-content p {
  font-size: 0.75rem;
  color: #64748b;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .header-left {
    flex-direction: column;
  }
  
  .header-right {
    text-align: center;
  }
  
  .container {
    padding: 1rem;
  }
  
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .payment-icons {
    gap: 1rem;
  }

  .payment-icon {
    width: 50px;
    height: 35px;
  }
}