/* NeuroHub dual-theme stylesheet (ADR 0006)
   Themes: corp (default B2B) and assistants (B2C "Васёк AI")
   All colors, radii, fonts are CSS custom properties.
   No build step required. */

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; display: flex; flex-direction: column; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ─── Corp theme ─────────────────────────────────────────────────────────── */
[data-theme="corp"],
[data-theme="default"] {
  --color-primary:      #1E3A5F;
  --color-primary-h:    #163050;
  --color-accent:       #2563EB;
  --color-accent-h:     #1D4ED8;
  --color-bg:           #F8FAFC;
  --color-surface:      #FFFFFF;
  --color-surface-2:    #F1F5F9;
  --color-text:         #0F172A;
  --color-text-muted:   #64748B;
  --color-border:       #E2E8F0;
  --color-success:      #16A34A;
  --color-error:        #DC2626;
  --color-error-bg:     #FEF2F2;
  --font-sans:          "Inter", system-ui, sans-serif;
  --radius-sm:          4px;
  --radius-md:          8px;
  --radius-lg:          12px;
  --radius-card:        8px;
  --shadow-card:        0 1px 3px 0 rgb(0 0 0 / .10), 0 1px 2px -1px rgb(0 0 0 / .10);
}

/* ─── Assistants / Васёк AI theme ────────────────────────────────────────── */
[data-theme="assistants"] {
  --color-primary:      #7C3AED;
  --color-primary-h:    #6D28D9;
  --color-accent:       #8B5CF6;
  --color-accent-h:     #7C3AED;
  --color-bg:           #FAF5FF;
  --color-surface:      #FFFFFF;
  --color-surface-2:    #F5F3FF;
  --color-text:         #1E1B4B;
  --color-text-muted:   #6B7280;
  --color-border:       #DDD6FE;
  --color-success:      #16A34A;
  --color-error:        #DC2626;
  --color-error-bg:     #FEF2F2;
  --font-sans:          "Inter", system-ui, sans-serif;
  --radius-sm:          6px;
  --radius-md:          14px;
  --radius-lg:          20px;
  --radius-card:        16px;
  --shadow-card:        0 4px 16px 0 rgb(124 58 237 / .10);
}

/* ─── Base tokens ────────────────────────────────────────────────────────── */
body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

/* ─── Nav ─────────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav__brand { display: flex; align-items: center; gap: .5rem; }
.nav__logo  { display: flex; align-items: center; gap: .5rem; }
.nav__logo-icon { font-size: 1.4rem; }
.nav__logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary);
  letter-spacing: -.02em;
}

.nav__actions { display: flex; align-items: center; gap: .75rem; }
.nav__username {
  font-size: .875rem;
  color: var(--color-text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  padding: .5em 1.25em;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn--primary:hover { background: var(--color-accent-h); border-color: var(--color-accent-h); }

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

.btn--sm  { padding: .3em .85em; font-size: .82rem; }
.btn--lg  { padding: .7em 1.75em; font-size: 1rem; }
.btn--block { width: 100%; }

/* ─── Main content ────────────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 2rem 1.5rem; max-width: 1120px; margin: 0 auto; width: 100%; }

/* ─── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 5rem 1rem;
}
.hero__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--color-primary);
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
}
.hero__actions { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

/* ─── Auth page ────────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
}
.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 2.25rem 2.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-card__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1.75rem;
  text-align: center;
}

/* ─── Form elements ─────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.form-label { font-size: .875rem; font-weight: 500; color: var(--color-text); }
.form-input {
  padding: .6rem .85rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 20%, transparent);
}

/* ─── Alerts ────────────────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  margin-bottom: 1rem;
}
.alert--error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid color-mix(in srgb, var(--color-error) 30%, transparent);
}
.alert--success {
  background: #F0FDF4;
  color: var(--color-success);
  border: 1px solid color-mix(in srgb, var(--color-success) 30%, transparent);
}

/* ─── Auth divider ──────────────────────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.5rem 0;
  color: var(--color-text-muted);
  font-size: .8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.telegram-login-wrap {
  display: flex;
  justify-content: center;
  margin-top: .5rem;
}

/* ─── HTMX spinner ──────────────────────────────────────────────────────── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Footer ────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: .8rem;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-card { padding: 1.5rem 1.25rem; }
  .nav { padding: .6rem 1rem; }
  .main-content { padding: 1.5rem 1rem; }
}
