/* ============================================
   COMPONENTS - Reusable UI Components
   ============================================ */

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-6);
  font-family: var(--font-primary);
  font-size: var(--text-body);
  font-weight: var(--font-semibold);
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-primary-ring);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #DC2626;
}

.btn-sm {
  min-height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--text-body-sm);
}

.btn-lg {
  min-height: 56px;
  padding: 0 var(--space-8);
  font-size: 1.125rem;
}

.btn-xl {
  min-height: 64px;
  padding: 0 var(--space-10);
  font-size: 1.125rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  min-height: 44px;
  min-width: 44px;
  padding: 0;
}

.btn-icon.btn-sm {
  min-height: 36px;
  min-width: 36px;
}

/* ---- INPUTS ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  min-height: 52px;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-body);
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-ring);
  background: var(--surface-hover);
}

.form-input.error,
.form-textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-subtle);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: var(--leading-relaxed);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
  cursor: pointer;
}

.form-helper {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  line-height: var(--leading-normal);
}

.form-helper svg {
  width: 12px;
  height: 12px;
  display: inline;
  vertical-align: middle;
  margin-right: 4px;
}

.form-error {
  font-size: var(--text-caption);
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ---- TOGGLE ---- */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  position: relative;
  transition: all var(--transition-fast);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle input {
  display: none;
}

.toggle input:checked + .toggle-track {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
  background: #fff;
}

.toggle-label {
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
}

/* ---- CHIPS ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.chip:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.chip.active {
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.chip .chip-remove {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}

.chip .chip-remove:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ---- SELECTABLE CARD ---- */
.selectable-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  position: relative;
}

.selectable-card:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.selectable-card.selected {
  background: var(--accent-primary-subtle);
  border-color: var(--accent-primary);
}

.selectable-card.selected::after {
  content: '✓';
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-radius: 50%;
  font-size: 12px;
  font-weight: var(--font-bold);
}

.selectable-card .card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--accent-primary-subtle);
  border-radius: var(--radius-md);
  color: var(--accent-primary);
}

.selectable-card .card-title {
  font-size: var(--text-body);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.selectable-card .card-desc {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

.selectable-card input[type="radio"],
.selectable-card input[type="checkbox"] {
  display: none;
}

/* ---- STEPPER ---- */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
}

.stepper-item {
  display: flex;
  align-items: center;
  flex: 1;
  position: relative;
}

.stepper-item:last-child {
  flex: 0;
}

.stepper-circle {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: var(--text-body-sm);
  font-weight: var(--font-semibold);
  background: var(--surface);
  color: var(--text-tertiary);
  border: 2px solid var(--border);
  transition: all var(--transition-fast);
  z-index: 1;
}

.stepper-item.active .stepper-circle {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.stepper-item.completed .stepper-circle {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.stepper-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 var(--space-2);
  transition: background var(--transition-fast);
}

.stepper-item.completed + .stepper-item .stepper-line,
.stepper-item.completed .stepper-line {
  background: var(--success);
}

.stepper-label {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  white-space: nowrap;
  font-weight: var(--font-medium);
}

.stepper-item.active .stepper-label {
  color: var(--accent-primary);
}

.stepper-item.completed .stepper-label {
  color: var(--success);
}

/* ---- PROGRESS BAR ---- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  animation: progressBar 0.6s ease;
}

.progress-bar-fill.success {
  background: var(--success);
}

/* ---- TABS ---- */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font-primary);
}

.tab-item:hover {
  color: var(--text-secondary);
}

.tab-item.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.tab-content {
  display: none;
  padding: var(--space-6) 0;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

/* ---- ACCORDION ---- */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--border);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-5) var(--space-6);
  font-family: var(--font-primary);
  font-size: var(--text-body);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
  text-align: left;
}

.accordion-header:hover {
  background: var(--surface);
}

.accordion-icon {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-fast);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.accordion-item.open .accordion-icon {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.accordion-item.open .accordion-body {
  max-height: 500px;
}

.accordion-content {
  padding: 0 var(--space-6) var(--space-5);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ---- TOOLTIP ---- */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-caption);
  color: var(--text-primary);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: var(--z-tooltip);
  pointer-events: none;
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--surface-hover);
}

.tooltip-wrapper:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* ---- TOAST ---- */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  min-width: 320px;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: var(--text-body-sm);
  color: var(--text-primary);
}

.toast-close {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent-primary); }

/* ---- MODAL ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: var(--z-modal-backdrop);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: var(--text-h3);
  font-weight: var(--font-semibold);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
}

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  color: var(--text-tertiary);
}

.empty-state h3 {
  margin-bottom: var(--space-3);
  font-size: var(--text-h3);
}

.empty-state p {
  margin-bottom: var(--space-6);
  max-width: 400px;
}

/* ---- SKELETON LOADER ---- */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-title {
  height: 24px;
  width: 50%;
  margin-bottom: var(--space-4);
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* ---- STATUS BADGE ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-caption);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-default {
  background: var(--surface);
  color: var(--text-secondary);
}

.badge-primary {
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
}

.badge-success {
  background: var(--success-subtle);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-subtle);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-subtle);
  color: var(--danger);
}

/* ---- SCORE BADGE ---- */
.score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.score-value {
  font-size: var(--text-h2);
  font-weight: var(--font-bold);
}

.score-value.high { color: var(--success); }
.score-value.medium { color: var(--warning); }
.score-value.low { color: var(--danger); }

.score-label {
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
}

/* ---- CARD ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-fast);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ---- PREVIEW TOOLBAR ---- */
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.preview-toolbar .toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-primary);
}

.preview-toolbar .toolbar-btn:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.preview-toolbar .toolbar-btn.active {
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
}

.preview-toolbar .toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 var(--space-2);
}

/* ---- REPEATABLE ROW ---- */
.repeatable-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.repeatable-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.repeatable-row .form-input {
  flex: 1;
  min-height: 48px;
}

.repeatable-row .row-number {
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-caption);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  background: var(--surface);
  border-radius: 50%;
}

.repeatable-row .btn-remove-row {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: 18px;
}

.repeatable-row .btn-remove-row:hover {
  color: var(--danger);
  background: var(--danger-subtle);
}

.btn-add-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--accent-primary);
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-primary);
}

.btn-add-row:hover {
  background: var(--accent-primary-subtle);
  border-color: var(--accent-primary);
}

/* ---- COLOR SWATCHES ---- */
.color-swatches {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--text-primary);
}

.color-swatch.selected::after {
  content: '\2713';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ---- SEGMENTED CONTROL ---- */
.segmented-control {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.segmented-btn {
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  background: none;
  border: none;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.segmented-btn:hover {
  color: var(--text-secondary);
}

.segmented-btn.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
  font-weight: var(--font-semibold);
}

/* ---- LOADING STATES ---- */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  padding: var(--space-16);
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: left;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-body-sm);
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
}

.loading-step.active {
  color: var(--accent-primary);
}

.loading-step.completed {
  color: var(--success);
}

.loading-step-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---- NAVBAR ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-sticky);
  padding: 0 var(--space-6);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-h3);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-weight: var(--font-extrabold);
  font-size: 18px;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.navbar-link {
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.navbar-link:hover {
  color: var(--text-primary);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.navbar-mobile-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 24px;
}

@media (max-width: 768px) {
  .navbar-menu {
    display: none;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    background: var(--bg-primary);
    padding: var(--space-6);
    gap: var(--space-4);
    border-top: 1px solid var(--border);
  }

  .navbar-menu.open {
    display: flex;
  }

  .navbar-link {
    font-size: var(--text-body);
    padding: var(--space-3) 0;
  }

  .navbar-actions .hide-mobile {
    display: none;
  }

  .navbar-mobile-toggle {
    display: flex;
  }
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: transform var(--transition-normal);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--border);
  min-height: var(--navbar-height);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: var(--space-6);
}

.sidebar-section-title {
  font-size: var(--text-caption);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.sidebar-link:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
}

.sidebar-link-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  font-size: var(--text-body-sm);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-plan {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}

/* Sidebar mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: calc(var(--z-sticky) - 1);
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .app-main {
    margin-left: 0 !important;
  }
}

/* ---- APP LAYOUT ---- */
.app-layout {
  min-height: 100vh;
}

.app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: var(--space-8);
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  gap: var(--space-4);
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 20px;
}

@media (max-width: 1024px) {
  .mobile-menu-btn {
    display: flex;
  }

  .app-main {
    padding: var(--space-4);
  }
}

/* ---- FOOTER ---- */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

.footer-brand p {
  margin-top: var(--space-4);
  font-size: var(--text-body-sm);
  max-width: 300px;
}

.footer-title {
  font-size: var(--text-body-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-links a {
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
  font-size: var(--text-body-sm);
  color: var(--text-tertiary);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
  }
}

/* ---- HERO SECTION ---- */
.hero-section {
  padding: calc(var(--navbar-height) + var(--space-16)) 0 var(--space-16);
  background: linear-gradient(180deg, rgba(56,189,248,0.04) 0%, transparent 60%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
}

.hero-title {
  font-size: var(--text-display-xl);
  font-weight: var(--font-extrabold);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-4);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 600px;
  margin: 0 auto var(--space-8);
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* ---- SECTION HELPERS ---- */
.section-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-body-sm);
  font-weight: var(--font-semibold);
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-h2);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-3);
}

.section-subtitle {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ---- NAVBAR LINKS (homepage) ---- */
.navbar-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.navbar-links .navbar-link {
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.navbar-links .navbar-link:hover {
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .navbar-links {
    display: none;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-primary);
    padding: var(--space-6);
    gap: var(--space-4);
    border-bottom: 1px solid var(--border);
    z-index: var(--z-sticky);
  }
  .navbar-links.open {
    display: flex;
  }
  .mobile-menu-btn {
    display: flex;
  }
}

/* ---- FOOTER INNER ---- */
.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  padding-bottom: var(--space-8);
  flex-wrap: wrap;
}

.footer-link {
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--text-primary);
}

/* ---- TOGGLE SWITCH ---- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}

/* ---- PROGRESS FILL (for loading bar) ---- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), #818CF8);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* ---- TAB (simple) ---- */
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-primary);
  font-size: var(--text-body-sm);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* ---- TEXT HELPERS ---- */
.text-error { color: var(--danger); }
.text-display { font-size: var(--text-h1); font-weight: var(--font-extrabold); }

/* ---- BTN BLOCK ---- */
.btn-block {
  display: flex;
  width: 100%;
}

/* ---- STEPPER (simplified for wizard) ---- */
.stepper .stepper-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

.stepper .stepper-number {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: var(--text-body-sm);
  font-weight: var(--font-bold);
  background: var(--surface);
  color: var(--text-tertiary);
  border: 2px solid var(--border);
  transition: all var(--transition-fast);
  margin-bottom: var(--space-1);
}

.stepper .stepper-item.active .stepper-number {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(56,189,248,0.3);
}

.stepper .stepper-item.completed .stepper-number {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

/* ---- LOADING OVERLAY (fullscreen) ---- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7,11,20,0.92);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
  max-width: 400px;
  padding: var(--space-8);
}

/* ---- PREVIEW FRAME ---- */
.preview-frame-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.preview-frame-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.preview-frame-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.preview-frame-dot.red { background: #EF4444; }
.preview-frame-dot.yellow { background: #F59E0B; }
.preview-frame-dot.green { background: #22C55E; }

.preview-frame-url {
  flex: 1;
  margin-left: var(--space-4);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  text-align: center;
}

.preview-frame {
  width: 100%;
  min-height: 500px;
  border: none;
  background: #fff;
  transition: all var(--transition-normal);
}

.preview-frame.tablet {
  max-width: 768px;
  margin: 0 auto;
  display: block;
}

.preview-frame.mobile {
  max-width: 375px;
  margin: 0 auto;
  display: block;
}
