/* ===================================
   COMPONENTS - REUSABLE UI ELEMENTS
   =================================== */

/* ===================================
   FORM COMPONENTS
   =================================== */

.form-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.form-header {
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-green));
  color: var(--text-white);
  padding: var(--space-2xl);
  text-align: center;
}

.form-header h2 {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  margin-bottom: var(--space-sm);
}

.form-header p {
  opacity: 0.9;
  font-size: var(--fs-lg);
}

.form-progress {
  background: var(--bg-light);
  padding: var(--space-md);
  border-bottom: 1px solid var(--bg-gray);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-gray);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-green), var(--primary-blue));
  border-radius: 4px;
  transition: width var(--transition-normal);
}

.progress-text {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  text-align: center;
  font-weight: var(--fw-medium);
}

.form-section {
  padding: var(--space-2xl);
  border-bottom: 1px solid var(--bg-gray);
}

.form-section:last-child {
  border-bottom: none;
}

.form-section-title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.section-number {
  width: 32px;
  height: 32px;
  background: var(--primary-green);
  color: var(--text-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

.form-group {
  margin-bottom: var(--space-xl);
}

.form-label {
  display: block;
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  font-size: var(--fs-base);
}

.form-label.required::after {
  content: ' *';
  color: #e53e3e;
}

.form-input {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid var(--bg-gray);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  transition: border-color var(--transition-fast);
  background: var(--bg-white);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.1);
}

.form-input.error {
  border-color: #e53e3e;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* ===================================
   CHECKBOX & RADIO COMPONENTS
   =================================== */

.checkbox-group, .radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.checkbox-item, .radio-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

.checkbox-item:hover, .radio-item:hover {
  background: var(--bg-white);
  border-color: var(--primary-green);
}

.checkbox-item.selected, .radio-item.selected {
  background: var(--light-blue);
  border-color: var(--primary-green);
}

.checkbox-item input, .radio-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-green);
}

.checkbox-item label, .radio-item label {
  cursor: pointer;
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-primary);
}

/* ===================================
   SLIDER COMPONENTS
   =================================== */

.slider-group {
  margin: var(--space-lg) 0;
}

.slider-container {
  background: var(--bg-light);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.slider-value {
  background: var(--primary-green);
  color: var(--text-white);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-medium);
  min-width: 40px;
  text-align: center;
}

.slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-gray);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-green);
  cursor: pointer;
  border: 3px solid var(--bg-white);
  box-shadow: var(--shadow-md);
}

.slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-green);
  cursor: pointer;
  border: 3px solid var(--bg-white);
  box-shadow: var(--shadow-md);
}

/* ===================================
   ALERT & MESSAGE COMPONENTS
   =================================== */

.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.alert-success {
  background: #f0fff4;
  color: #276749;
  border: 1px solid #9ae6b4;
}

.alert-error {
  background: #fed7d7;
  color: #c53030;
  border: 1px solid #feb2b2;
}

.alert-warning {
  background: #fffbeb;
  color: #b7791f;
  border: 1px solid #f6e05e;
}

.alert-info {
  background: #ebf8ff;
  color: #2c5282;
  border: 1px solid #90cdf4;
}

.alert-icon {
  font-size: var(--fs-lg);
  flex-shrink: 0;
}

/* ===================================
   MODAL COMPONENTS
   =================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  padding: var(--space-xl);
  border-bottom: 1px solid var(--bg-gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--fs-2xl);
  color: var(--text-light);
  cursor: pointer;
  padding: var(--space-xs);
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-xl);
}

.modal-footer {
  padding: var(--space-xl);
  border-top: 1px solid var(--bg-gray);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
}

/* ===================================
   LOADING COMPONENTS
   =================================== */

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--bg-gray);
  border-top: 3px solid var(--primary-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  text-align: center;
}

.loading-content .loading-spinner {
  width: 48px;
  height: 48px;
  border-width: 4px;
  margin-bottom: var(--space-lg);
}

.loading-text {
  font-size: var(--fs-lg);
  color: var(--text-primary);
  font-weight: var(--fw-medium);
}

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

/* ===================================
   CARD COMPONENTS
   =================================== */

.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  padding: var(--space-xl);
  background: var(--bg-light);
  border-bottom: 1px solid var(--bg-gray);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  color: var(--text-primary);
  margin: 0;
}

.card-body {
  padding: var(--space-xl);
}

.card-footer {
  padding: var(--space-xl);
  background: var(--bg-light);
  border-top: 1px solid var(--bg-gray);
}

/* ===================================
   BADGE COMPONENTS
   =================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: var(--primary-blue);
  color: var(--text-white);
}

.badge-success {
  background: var(--primary-green);
  color: var(--text-white);
}

.badge-warning {
  background: var(--accent-gold);
  color: var(--text-white);
}

.badge-secondary {
  background: var(--bg-gray);
  color: var(--text-secondary);
}

/* ===================================
   STEP INDICATOR COMPONENTS
   =================================== */

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-2xl) 0;
}

.step-item {
  display: flex;
  align-items: center;
  position: relative;
}

.step-item:not(:last-child)::after {
  content: '';
  width: 50px;
  height: 2px;
  background: var(--bg-gray);
  margin: 0 var(--space-md);
}

.step-item.completed::after {
  background: var(--primary-green);
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-gray);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  transition: all var(--transition-normal);
}

.step-item.active .step-circle {
  background: var(--primary-blue);
}

.step-item.completed .step-circle {
  background: var(--primary-green);
}

/* ===================================
   PRICING COMPONENTS
   =================================== */

.pricing-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  text-align: center;
  position: relative;
  transition: all var(--transition-normal);
}

.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.pricing-card.featured {
  border: 3px solid var(--primary-green);
}

.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-green);
  color: var(--text-white);
  padding: var(--space-xs) var(--space-lg);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
}

.pricing-header {
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
  background: linear-gradient(135deg, var(--bg-light), var(--cream));
}

.pricing-title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.pricing-amount {
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
  font-weight: var(--fw-bold);
  color: var(--primary-green);
  margin-bottom: var(--space-xs);
}

.pricing-period {
  color: var(--text-light);
  font-size: var(--fs-sm);
}

.pricing-features {
  padding: var(--space-xl);
}

.pricing-features ul {
  list-style: none;
  padding: 0;
}

.pricing-features li {
  padding: var(--space-sm) 0;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.pricing-features li::before {
  content: '✓';
  color: var(--primary-green);
  font-weight: var(--fw-bold);
}

.pricing-cta {
  padding: 0 var(--space-xl) var(--space-xl);
}

/* ===================================
   TOOLTIP COMPONENTS
   =================================== */

.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--text-white);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
  z-index: 1000;
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(1px);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-primary);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
}

.tooltip:hover::before,
.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

/* ===================================
   UTILITY COMPONENTS
   =================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0 !important; }
.mb-sm { margin-bottom: var(--space-sm) !important; }
.mb-md { margin-bottom: var(--space-md) !important; }
.mb-lg { margin-bottom: var(--space-lg) !important; }
.mb-xl { margin-bottom: var(--space-xl) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-sm { margin-top: var(--space-sm) !important; }
.mt-md { margin-top: var(--space-md) !important; }
.mt-lg { margin-top: var(--space-lg) !important; }
.mt-xl { margin-top: var(--space-xl) !important; }

.hidden { display: none !important; }
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
  animation: slideUp 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ===================================
   RESPONSIVE COMPONENT ADJUSTMENTS
   =================================== */

@media (max-width: 768px) {
  .checkbox-group, .radio-group {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    margin: var(--space-md);
    max-width: calc(100vw - 2rem);
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--space-lg);
  }
  
  .step-indicator {
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .step-item::after {
    display: none;
  }
  
  .pricing-card {
    margin-bottom: var(--space-lg);
  }
}
