/* Shopflo-style Checkout Modal CSS */
:root {
  --modal-bg: #fff;
  --modal-text: #1a1a1a;
  --modal-border: #e0e0e0;
  --modal-primary: #8a2be2;
  --modal-shadow: 0 -10px 40px rgba(0,0,0,0.15);
  --modal-radius: 20px;
}

#sf-checkout-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#sf-checkout-overlay.sf-active {
  display: flex;
  opacity: 1;
}

#sf-checkout-modal {
  background: var(--modal-bg);
  width: 100%;
  max-width: 480px;
  height: 90vh;
  max-height: 850px;
  border-radius: var(--modal-radius) var(--modal-radius) 0 0;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--modal-shadow);
  color: var(--modal-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#sf-checkout-overlay.sf-active #sf-checkout-modal {
  transform: translateY(0);
}

@media (min-width: 600px) {
  #sf-checkout-overlay {
    align-items: center;
  }
  #sf-checkout-modal {
    height: auto;
    max-height: 90vh;
    border-radius: 16px;
    transform: scale(0.95);
    opacity: 0;
  }
  #sf-checkout-overlay.sf-active #sf-checkout-modal {
    transform: scale(1);
    opacity: 1;
  }
}

.sf-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--modal-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  z-index: 2;
}

.sf-header-back {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #555;
  padding: 4px;
}

.sf-header-logo {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--modal-text);
  text-transform: uppercase;
}

.sf-header-price {
  font-weight: 700;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.sf-header-price span {
  font-size: 11px;
  color: #888;
  text-decoration: line-through;
  font-weight: 500;
}

.sf-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f9f9f9;
  position: relative;
}

/* Step Views */
.sf-step {
  display: none;
  animation: sfFadeIn 0.3s ease;
}

.sf-step.sf-active {
  display: block;
}

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

/* Loading View */
.sf-loading-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  background: #fff;
}

.sf-loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--modal-text);
  border-radius: 50%;
  animation: sfSpin 1s linear infinite;
  margin-bottom: 20px;
}

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

.sf-loading-text {
  font-size: 14px;
  color: #666;
  margin-bottom: 24px;
}

/* Form Styles */
.sf-form-group {
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--modal-border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.sf-form-group.sf-focused {
  border-color: #000;
}

.sf-input {
  width: 100%;
  padding: 22px 16px 8px;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--modal-text);
  outline: none;
}

.sf-label {
  position: absolute;
  left: 16px;
  top: 16px;
  font-size: 14px;
  color: #888;
  transition: 0.2s ease all;
  pointer-events: none;
}

.sf-input:focus + .sf-label,
.sf-input:not(:placeholder-shown) + .sf-label {
  top: 6px;
  font-size: 11px;
  color: #555;
  font-weight: 500;
}

.sf-section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 24px 0 16px;
  color: var(--modal-text);
}

/* Address Tags */
.sf-address-tags {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.sf-tag {
  padding: 8px 16px;
  border: 1px solid var(--modal-border);
  border-radius: 20px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.sf-tag.active {
  border-color: #000;
  background: #f0f0f0;
  color: #000;
}

/* Payment Methods */
.sf-payment-method {
  background: #fff;
  border: 1px solid var(--modal-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.sf-payment-method:hover {
  border-color: #aaa;
}

.sf-payment-method.sf-suggested {
  border: 2px solid #a81c2e;
  position: relative;
}

.sf-suggested-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #a81c2e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
}

.sf-pm-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sf-pm-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sf-pm-desc {
  font-size: 12px;
  color: #666;
}

.sf-pm-price {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.sf-pm-price span {
  font-size: 11px;
  color: #666;
  font-weight: 500;
}

/* Order Summary Box */
.sf-summary-box {
  background: #fff;
  border: 1px solid var(--modal-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.sf-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 12px;
  color: #444;
}

.sf-summary-row:last-child {
  margin-bottom: 0;
}

.sf-summary-total {
  border-top: 1px dashed var(--modal-border);
  padding-top: 12px;
  margin-top: 12px;
  font-weight: 700;
  color: #000;
  font-size: 16px;
}

/* Footer / Button */
.sf-footer {
  padding: 16px 20px;
  background: #fff;
  border-top: 1px solid var(--modal-border);
}

.sf-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 8px;
  background: #a81c2e;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sf-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sf-btn:hover:not(:disabled) {
  opacity: 0.9;
}

/* Trust Badges */
.sf-trust-badges {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  padding-bottom: 20px;
}

.sf-trust-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #666;
  font-weight: 500;
}

/* Success View */
.sf-success-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  text-align: center;
  background: #fff;
}

.sf-success-icon {
  width: 80px;
  height: 80px;
  background: #4CAF50;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 40px;
  margin-bottom: 20px;
  animation: sfScaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes sfScaleIn {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.sf-success-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #000;
}

.sf-success-desc {
  font-size: 15px;
  color: #555;
  line-height: 1.5;
  max-width: 80%;
}
