/* Shared components: buttons, inputs, cards, nav, badges, motion widgets.
   Used consistently across every page (landing, auth, dashboard,
   playground, ops) so no page carries a one-off visual style. */

/* ── Focus ── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--orange-400);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem var(--space-5);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  border: 1px solid transparent;
  min-height: 44px;
  transition:
    transform var(--duration-fast) var(--ease-out),
    background var(--duration-base),
    border-color var(--duration-base),
    box-shadow var(--duration-base);
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
  background: var(--gradient-brand-hover);
  box-shadow: var(--shadow-glow-orange);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface);
}

.btn-block {
  width: 100%;
}
.btn-sm {
  min-height: 36px;
  padding: 0.4rem var(--space-3);
  font-size: var(--text-xs);
}

/* ── Inputs ── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem var(--space-4);
  min-height: 44px;
  color: var(--text);
  transition:
    border-color var(--duration-base),
    box-shadow var(--duration-base);
}
.input::placeholder {
  color: var(--text-dim);
}
.input:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}
.input[aria-invalid="true"] {
  border-color: var(--danger);
}
.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}
.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input-group {
  position: relative;
}
.input-group .input {
  padding-right: 2.75rem;
}
.input-group__action {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  min-height: 32px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  background: transparent;
  border: none;
}
.input-group__action:hover {
  color: var(--text);
  background: var(--surface);
}

.hint {
  font-size: var(--text-xs);
  color: var(--text-dim);
}

.error-text {
  font-size: var(--text-sm);
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Password strength meter */
.strength-meter {
  display: flex;
  gap: var(--space-1);
  height: 4px;
}
.strength-meter__bar {
  flex: 1;
  border-radius: var(--radius-full);
  background: var(--border);
  transition: background var(--duration-base);
}
.strength-meter__bar.is-weak {
  background: var(--danger);
}
.strength-meter__bar.is-fair {
  background: var(--warning);
}
.strength-meter__bar.is-strong {
  background: var(--success);
}
.strength-label {
  font-size: var(--text-xs);
  color: var(--text-dim);
}

/* ── Card / surface ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.2rem var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-demo {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
}
.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}
.badge-muted {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-info {
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.badge-violet {
  background: rgba(139, 92, 246, 0.12);
  color: var(--violet-400);
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.badge-teal {
  background: rgba(45, 212, 191, 0.12);
  color: #5eead4;
  border: 1px solid rgba(45, 212, 191, 0.3);
}

/* ── Alerts ── */
.alert {
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}
.alert-danger {
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--danger);
}
.alert-info {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--violet-400);
}
.alert-warning {
  background: var(--warning-bg);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--warning);
}

/* ── Nav / header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(10, 10, 18, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.nav-links a:hover {
  color: var(--text);
}

@media (max-width: 768px) {
  .site-header__inner {
    padding-inline: var(--space-4);
  }
  .nav-links {
    display: none;
  }
}

/* ── Brand lockup ── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--text);
}
.brand__mark {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}

/* ── Loading spinner ── */
.spinner {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Voice waveform motif ── */
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 2.5rem;
}
.waveform__bar {
  width: 4px;
  border-radius: var(--radius-full);
  background: var(--gradient-brand);
  animation: waveform-pulse 1.2s ease-in-out infinite;
}
.waveform__bar:nth-child(1) {
  height: 40%;
  animation-delay: 0ms;
}
.waveform__bar:nth-child(2) {
  height: 70%;
  animation-delay: 100ms;
}
.waveform__bar:nth-child(3) {
  height: 100%;
  animation-delay: 200ms;
}
.waveform__bar:nth-child(4) {
  height: 55%;
  animation-delay: 300ms;
}
.waveform__bar:nth-child(5) {
  height: 85%;
  animation-delay: 400ms;
}
.waveform__bar:nth-child(6) {
  height: 35%;
  animation-delay: 500ms;
}
.waveform__bar:nth-child(7) {
  height: 65%;
  animation-delay: 600ms;
}
@keyframes waveform-pulse {
  0%,
  100% {
    transform: scaleY(0.5);
    opacity: 0.7;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .waveform__bar {
    animation: none;
    transform: scaleY(0.8);
  }
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--orange-500);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  z-index: 100;
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

/* ── Early-access modal (app/static/js/early-interest-modal.js) ── */
.ei-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 200;
}

.ei-modal {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  position: relative;
}

.ei-modal__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-dim);
}
.ei-modal__close:hover {
  background: var(--bg-elevated-hover, rgba(255, 255, 255, 0.06));
  color: var(--text);
}

.ei-modal__title {
  font-size: var(--text-xl, 1.25rem);
  margin-bottom: var(--space-2);
  padding-right: var(--space-8);
}

.ei-modal__body {
  color: var(--text-dim);
  margin-bottom: var(--space-6);
}

.ei-modal__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ei-modal__consent {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm, 0.875rem);
  color: var(--text-dim);
}
.ei-modal__consent input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.ei-modal__consent a {
  color: var(--text);
  text-decoration: underline;
}

.ei-modal__success {
  text-align: center;
}

/* Honeypot: visually and structurally hidden from sighted users AND screen
   readers, but still present/fillable by a naive bot that doesn't execute
   CSS -- display:none is deliberately avoided (some bots skip
   display:none fields) in favor of off-screen positioning. */
.ei-modal__honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 380px) {
  .ei-modal {
    padding: var(--space-6);
  }
}
