/**
 * Console Maven - Checkout Modal Styles
 * Terminal-themed checkout flow for BYOK and Power User tiers
 */

/* Checkout Modal Overlay */
.checkout-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  animation: checkout-fade-in 0.3s ease;
  padding: 20px;
}

.checkout-modal-overlay.active {
  display: flex;
}

@keyframes checkout-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Container */
.checkout-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid rgba(124, 58, 237, 0.3);
  border-radius: 16px;
  padding: 0;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 40px rgba(124, 58, 237, 0.2);
  animation: checkout-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes checkout-slide-up {
  from {
    transform: translateY(40px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Modal Header */
.checkout-modal-header {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  border-radius: 14px 14px 0 0;
}

.checkout-modal-title {
  margin: 0;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkout-modal-title::before {
  content: ">";
  font-family: 'Courier New', monospace;
  color: #a78bfa;
  font-size: 28px;
  font-weight: 700;
}

.checkout-modal-subtitle {
  margin: 8px 0 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 400;
}

/* Close Button */
.checkout-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  transition: all 0.2s ease;
  font-weight: 300;
}

.checkout-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.checkout-close-btn:active {
  transform: rotate(90deg) scale(0.95);
}

/* Modal Body */
.checkout-modal-body {
  padding: 32px 28px;
}

/* Form Sections */
.checkout-section {
  margin-bottom: 28px;
}

.checkout-section:last-child {
  margin-bottom: 0;
}

.checkout-section-label {
  display: block;
  color: #a78bfa;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  font-family: 'Courier New', monospace;
}

/* Tier Selection */
.tier-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tier-option {
  position: relative;
  cursor: pointer;
}

.tier-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tier-card {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.tier-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(109, 40, 217, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tier-option input[type="radio"]:checked + .tier-card {
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
  box-shadow: 0 0 0 1px #7c3aed inset, 0 8px 16px rgba(124, 58, 237, 0.2);
  transform: scale(1.02);
}

.tier-option input[type="radio"]:checked + .tier-card::before {
  opacity: 1;
}

.tier-card:hover {
  border-color: rgba(124, 58, 237, 0.5);
  transform: translateY(-2px);
}

.tier-name {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px 0;
}

.tier-price {
  font-size: 14px;
  color: #a78bfa;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

.tier-description {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin: 8px 0 0 0;
  line-height: 1.4;
}

.tier-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #7c3aed;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s ease;
}

.tier-option input[type="radio"]:checked + .tier-card .tier-badge {
  opacity: 1;
  transform: scale(1);
}

/* Project Count Slider */
.project-count-control {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
}

.project-count-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.project-count-value {
  font-size: 32px;
  font-weight: 700;
  color: #7c3aed;
  font-family: 'Courier New', monospace;
}

.project-count-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

.project-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
}

.project-slider::-webkit-slider-track {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.project-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
  transition: all 0.2s ease;
}

.project-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.6);
}

.project-slider::-moz-range-track {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.project-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.slider-markers {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 2px;
}

.slider-marker {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Courier New', monospace;
}

/* Credit Package Selection */
.credit-packages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.credit-package-option {
  position: relative;
  cursor: pointer;
}

.credit-package-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.credit-package-card {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.credit-package-option input[type="radio"]:checked + .credit-package-card {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 0 1px #10b981 inset;
}

.credit-package-card:hover {
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateY(-2px);
}

.credit-amount {
  font-size: 24px;
  font-weight: 700;
  color: #10b981;
  font-family: 'Courier New', monospace;
  margin: 0;
}

.credit-bonus {
  font-size: 11px;
  color: #10b981;
  font-weight: 600;
  margin-top: 4px;
}

/* Email Input */
.email-input-wrapper {
  position: relative;
}

.email-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 15px;
  transition: all 0.2s ease;
  font-family: 'Courier New', monospace;
}

.email-input:focus {
  outline: none;
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.05);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.email-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.email-input.error {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

/* Error Messages */
.error-message {
  display: none;
  color: #ef4444;
  font-size: 13px;
  margin-top: 8px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.error-message::before {
  content: "!";
  width: 18px;
  height: 18px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.error-message.visible {
  display: flex;
}

/* Price Summary */
.price-summary {
  background: rgba(124, 58, 237, 0.1);
  border: 2px solid rgba(124, 58, 237, 0.3);
  border-radius: 12px;
  padding: 20px;
  margin-top: 28px;
}

.price-summary-title {
  color: #a78bfa;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 16px 0;
  font-family: 'Courier New', monospace;
}

.price-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.price-line:last-child {
  margin-bottom: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 700;
  color: #fff;
  font-size: 18px;
}

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

.price-value {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: #10b981;
}

.price-line:last-child .price-value {
  font-size: 24px;
  color: #7c3aed;
}

.price-period {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

/* Submit Button */
.checkout-submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border: none;
  color: #fff;
  padding: 16px 24px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  margin-top: 28px;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.checkout-submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.checkout-submit-btn:hover::before {
  left: 100%;
}

.checkout-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}

.checkout-submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

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

.checkout-submit-btn.loading {
  pointer-events: none;
}

.checkout-submit-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: checkout-spin 0.8s linear infinite;
}

@keyframes checkout-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Hidden State for Conditional Elements */
.hidden {
  display: none !important;
}

/* Trust Signals */
.trust-signals {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px 0 0 0;
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.trust-signal {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.trust-signal::before {
  content: "✓";
  color: #10b981;
  font-weight: 700;
  font-size: 14px;
}

/* Responsive Design */
@media (max-width: 640px) {
  .checkout-modal {
    max-width: 100%;
    border-radius: 12px;
    max-height: 95vh;
  }

  .checkout-modal-header {
    padding: 20px 24px;
  }

  .checkout-modal-title {
    font-size: 20px;
  }

  .checkout-modal-body {
    padding: 24px 20px;
  }

  .tier-options {
    grid-template-columns: 1fr;
  }

  .credit-packages {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-count-value {
    font-size: 28px;
  }

  .price-summary {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .checkout-modal-overlay {
    padding: 10px;
  }

  .checkout-modal-header {
    padding: 16px 20px;
  }

  .checkout-modal-title {
    font-size: 18px;
  }

  .checkout-modal-body {
    padding: 20px 16px;
  }

  .tier-card {
    padding: 16px;
  }

  .tier-name {
    font-size: 16px;
  }

  .credit-packages {
    grid-template-columns: 1fr;
  }

  .checkout-submit-btn {
    padding: 14px 20px;
  }
}

/* Accessibility - Focus Styles */
.tier-option:focus-within .tier-card,
.credit-package-option:focus-within .credit-package-card {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

.email-input:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

/* Smooth Scrollbar */
.checkout-modal::-webkit-scrollbar {
  width: 10px;
}

.checkout-modal::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 16px 16px 0;
}

.checkout-modal::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.5);
  border-radius: 10px;
}

.checkout-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.7);
}
