/* Sudegy Discovery Portal — Components */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--color-gold-500);
  color: var(--text-on-gold);
}

.btn--primary:hover {
  background: var(--color-gold-400);
}

.btn--ghost {
  background: transparent;
  border-color: var(--surface-border-strong);
  color: var(--text-primary);
}

.btn--ghost:hover {
  border-color: var(--color-gold-500);
  color: var(--text-accent);
}

.btn--text {
  background: transparent;
  color: var(--text-accent);
  padding: var(--space-2) var(--space-1);
}

.btn--text:hover {
  color: var(--color-gold-300);
}

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

/* Form fields */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.field label {
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
}

.field input,
.field textarea,
.field select {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  font-size: var(--text-body-lg);
  transition: border-color var(--duration-fast) var(--ease-standard);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--color-gold-500);
  outline: none;
}

.field--error input,
.field--error textarea,
.field--error select {
  border-color: var(--color-danger);
}

.field__hint {
  font-size: var(--text-caption);
  color: var(--text-muted);
}

.field__error {
  font-size: var(--text-caption);
  color: var(--color-danger);
}

/* Card */
.card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.card--interactive {
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard),
    background var(--duration-fast) var(--ease-standard);
}

.card--interactive:hover {
  border-color: var(--surface-border-strong);
  background: var(--surface-card-hover);
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--surface-raised);
  border: 1px solid var(--surface-border-strong);
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
}

.chip__remove {
  color: var(--text-muted);
  font-size: var(--text-caption);
}

.chip__remove:hover {
  color: var(--color-danger);
}

/* Signature element — the gold thread that traces journey progress */
.progress-thread {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.progress-thread__track {
  flex: 1;
  height: 1px;
  background: var(--surface-border-strong);
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-full);
}

.progress-thread__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--color-gold-600), var(--color-gold-400));
  transition: width var(--duration-slow) var(--ease-out-soft);
}

[dir='rtl'] .progress-thread__fill {
  background: linear-gradient(270deg, var(--color-gold-600), var(--color-gold-400));
}

.progress-thread__label {
  font-size: var(--text-caption);
  color: var(--text-muted);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Autosave indicator */
.autosave {
  position: fixed;
  bottom: var(--space-6);
  inset-inline-end: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-caption);
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  z-index: var(--z-toast);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-standard);
}

.autosave--visible {
  opacity: 1;
  transform: translateY(0);
}

.autosave__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.autosave[data-status='saving'] .autosave__dot {
  background: var(--color-gold-400);
  animation: pulseGold 1s var(--ease-standard) infinite;
}

.autosave[data-status='saved'] .autosave__dot {
  background: var(--color-success);
}

.autosave[data-status='error'] .autosave__dot {
  background: var(--color-danger);
}

/* Configuration screen — shown when Supabase isn't reachable yet, instead
   of a blank page. Reuses .card for the visual treatment. */
.config-screen {
  max-width: 560px;
  margin: var(--space-20) auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: start;
}

.config-screen .btn {
  align-self: flex-start;
  margin-top: var(--space-2);
}

.config-screen__detail {
  font-family: var(--font-body);
  font-size: var(--text-caption);
  color: var(--color-danger);
  background: var(--color-danger-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  word-break: break-word;
  white-space: pre-wrap;
}

/* Boot shell */
.boot-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--surface-base);
  z-index: var(--z-overlay);
  transition: opacity var(--duration-slow) var(--ease-standard);
}

.boot-shell__mark {
  font-family: var(--font-display);
  font-size: var(--text-display-md);
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin: 0;
}

.boot-shell__line {
  width: 120px;
  height: 1px;
  background: var(--surface-border-strong);
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-full);
}

.boot-shell__line::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--color-gold-400), transparent);
  animation: bootSweep 1.2s var(--ease-standard) infinite;
}

.boot-shell.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* App header — persistent across every screen */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-shell);
  background: rgba(10, 9, 8, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--surface-border);
}

.app-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.app-header__mark {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.app-header__progress {
  flex: 1;
  min-width: 0;
}

.app-header__progress .progress-thread__label {
  display: none;
}

@media (min-width: 640px) {
  .app-header__progress .progress-thread__label {
    display: inline-block;
  }
}

/* Language switcher */
.lang-switch {
  display: flex;
  gap: var(--space-1);
  flex-shrink: 0;
}

.lang-switch__btn {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-caption);
  color: var(--text-muted);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}

.lang-switch__btn:hover {
  color: var(--text-primary);
}

.lang-switch__btn.is-active {
  color: var(--text-accent);
  border-color: var(--surface-border-strong);
}
