/**
 * StudijaAI — zajednički sloj za sve stranice (base.html).
 * Auth, roditelj, povijest (vibrant); usklađeni tokeni s theme.css.
 */

/* Povijest — bedževi ispod naslova (classic + vibrant) */
.history-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.history-card-badges:empty {
  display: none;
}

.history-card-badges .history-card-scope-badge,
.history-card-badges .history-card-level-badge,
.history-card-badges .history-card-hidden-badge {
  margin-left: 0;
}

/* ── Globalno: vibrant (header, tipografija, sekundarni gumbi) ─────── */
body.theme-vibrant .header {
  background: color-mix(in srgb, var(--theme-surface) 88%, transparent);
  border-bottom-color: var(--theme-border);
}

body.theme-vibrant .logo-icon {
  background: linear-gradient(135deg, var(--theme-primary), #8b5cf6);
  box-shadow: 0 2px 14px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

body.theme-vibrant .logo-text {
  color: var(--theme-text);
}

body.theme-vibrant .logo-text span {
  color: var(--theme-primary);
}

body.theme-vibrant .nav-link {
  color: var(--theme-muted);
}

body.theme-vibrant .nav-link:hover {
  color: var(--theme-text);
  background: color-mix(in srgb, var(--theme-primary) 9%, var(--theme-bg));
}

body.theme-vibrant .nav-link.active {
  color: var(--theme-primary);
  background: color-mix(in srgb, var(--theme-primary) 12%, transparent);
}

body.theme-vibrant .account-chip {
  background: color-mix(in srgb, var(--theme-primary) 7%, var(--theme-surface));
  color: var(--theme-muted);
  border-color: var(--theme-border);
}

body.theme-vibrant .account-chip strong {
  color: var(--theme-text);
}

body.theme-vibrant .footer {
  border-top-color: var(--theme-border);
  color: var(--theme-muted);
}

body.theme-vibrant .footer a {
  color: var(--theme-primary);
}

body.theme-vibrant .page-intro__eyebrow {
  background: color-mix(in srgb, var(--theme-primary) 12%, var(--theme-surface));
  color: var(--theme-primary-dark);
}

/* Sekundarni / outline gumbi — bez klasičnog plavog hovera */
body.theme-vibrant .action-btn:not(.primary):not(.danger) {
  border-color: var(--theme-border);
  background: var(--theme-surface);
  color: var(--theme-text);
}

body.theme-vibrant .action-btn:not(.primary):not(.danger):hover {
  border-color: color-mix(in srgb, var(--theme-primary) 45%, var(--theme-border));
  color: var(--theme-primary);
  background: color-mix(in srgb, var(--theme-primary) 7%, var(--theme-surface));
}

body.theme-vibrant .action-btn.danger {
  border-color: color-mix(in srgb, var(--theme-warning) 35%, var(--theme-border));
  color: var(--theme-text);
}

body.theme-vibrant .action-btn.danger:hover {
  border-color: var(--theme-warning);
  color: #9f1239;
  background: color-mix(in srgb, var(--theme-warning) 14%, #fff);
}

/* ── Povijest (theme-vibrant) ───────────────────────────────────────── */
body.theme-vibrant .history-header {
  background: var(--theme-surface);
  border: 1px solid color-mix(in srgb, var(--theme-primary) 12%, var(--theme-border));
  border-radius: var(--theme-radius-card);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--theme-shadow-card);
}

body.theme-vibrant .history-title {
  color: var(--theme-text);
  letter-spacing: -0.01em;
  font-family: inherit;
}

body.theme-vibrant .history-subtitle {
  color: var(--theme-muted);
}

body.theme-vibrant .batch-toolbar {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--theme-primary) 42%, #0f172a) 0%,
    color-mix(in srgb, var(--theme-primary) 28%, #1e1b4b) 48%,
    var(--theme-primary-dark) 100%
  );
  color: #f8fafc;
  border: 1px solid color-mix(in srgb, var(--theme-primary) 45%, transparent);
  box-shadow: 0 10px 32px color-mix(in srgb, var(--theme-primary) 32%, transparent);
}

body.theme-vibrant .batch-toolbar .action-btn:not(.primary) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: #f1f5f9;
}

body.theme-vibrant .batch-toolbar .action-btn:not(.primary):hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

body.theme-vibrant .batch-toolbar .action-btn.danger {
  border-color: rgba(251, 113, 133, 0.55);
  color: #ffe4e6;
}

body.theme-vibrant .batch-toolbar .action-btn.danger:hover {
  background: rgba(251, 113, 133, 0.2);
  border-color: #fb7185;
  color: #fff;
}

body.theme-vibrant .history-group--school > .history-group__header {
  background: color-mix(in srgb, var(--theme-primary) 6%, var(--theme-bg));
  border-color: var(--theme-border);
}

body.theme-vibrant .history-group--grade > .history-group__header {
  background: var(--theme-surface);
  border-color: var(--theme-border);
}

body.theme-vibrant .history-group__header:hover {
  background: color-mix(in srgb, var(--theme-primary) 8%, var(--theme-bg));
}

body.theme-vibrant .history-group__icon--school,
body.theme-vibrant .history-group__icon--grade {
  background: color-mix(in srgb, var(--theme-primary) 14%, transparent);
  color: var(--theme-primary);
}

body.theme-vibrant .history-group__icon--subject {
  background: color-mix(in srgb, var(--theme-primary) 8%, var(--theme-surface));
  color: var(--theme-muted);
}

body.theme-vibrant .history-group__title {
  color: var(--theme-text);
}

body.theme-vibrant .history-group--school > .history-group__header .history-group__title {
  font-family: inherit;
}

body.theme-vibrant .history-group--subject > .history-group__header .history-group__title {
  color: var(--theme-muted);
}

body.theme-vibrant .history-group__count {
  background: color-mix(in srgb, var(--theme-muted) 12%, var(--theme-bg));
  color: var(--theme-muted);
}

body.theme-vibrant .history-group__chevron {
  color: var(--theme-muted);
}

body.theme-vibrant .batch-select-all:hover {
  background: color-mix(in srgb, var(--theme-primary) 8%, var(--theme-bg));
  color: var(--theme-text);
}

body.theme-vibrant .batch-select-all input[type="checkbox"],
body.theme-vibrant .history-card__checkbox input[type="checkbox"] {
  accent-color: var(--theme-primary);
}

body.theme-vibrant .history-card--selected {
  border-color: var(--theme-primary);
  background: color-mix(in srgb, var(--theme-primary) 6%, var(--theme-surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--theme-primary) 22%, transparent);
}

body.theme-vibrant .history-card:hover {
  border-color: color-mix(in srgb, var(--theme-primary) 40%, var(--theme-border));
}

body.theme-vibrant .history-card-title {
  font-family: inherit;
}

/* Isti vertikalni popis kao klasična tema — grid u 3 stupca guši kartice (uski flex za naslov + akcije). */
body.theme-vibrant .history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body.theme-vibrant .history-card {
  border: 1px solid color-mix(in srgb, var(--theme-primary) 14%, var(--theme-border));
  border-radius: var(--theme-radius-card);
  background: var(--theme-surface);
  color: var(--theme-text);
  box-shadow: var(--theme-shadow-card);
}

body.theme-vibrant .history-card-title__text {
  color: var(--theme-text);
}

body.theme-vibrant .history-card-meta {
  color: var(--theme-muted);
}

body.theme-vibrant .history-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--theme-primary) 10%, var(--theme-surface));
  color: var(--theme-primary);
  display: grid;
  place-items: center;
}

body.theme-vibrant .history-card-arrow {
  color: var(--theme-muted);
}

body.theme-vibrant .history-card:hover .history-card-arrow {
  color: var(--theme-primary);
}

body.theme-vibrant .history-card-lesson {
  color: var(--theme-muted);
}

body.theme-vibrant .history-card-scope-badge {
  background: color-mix(in srgb, var(--theme-primary) 14%, transparent);
  color: var(--theme-primary-dark);
}

body.theme-vibrant .history-card-level-badge--standard {
  background: color-mix(in srgb, var(--theme-muted) 16%, var(--theme-surface));
  color: var(--theme-muted);
}

body.theme-vibrant .history-card-level-badge--srednje {
  background: color-mix(in srgb, var(--theme-primary) 12%, var(--theme-surface));
  color: var(--theme-primary-dark);
}

body.theme-vibrant .history-card-level-badge--napredno {
  background: color-mix(in srgb, #8b5cf6 14%, var(--theme-surface));
  color: #5b21b6;
}

/* ── Auth: hero-badge + auth-switch (base, sve teme) ───────────────── */

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-warm, #f5f0eb);
  color: var(--ink-muted, #6b7280);
  border: 1px solid var(--border, #e5e7eb);
  margin-bottom: 10px;
}

.auth-switch {
  display: flex;
  gap: 4px;
  background: var(--bg-warm, #f5f0eb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  padding: 3px;
}

.auth-switch__option {
  flex: 1;
  display: flex;
  cursor: pointer;
}

.auth-switch__option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.auth-switch__option span {
  flex: 1;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink-muted, #6b7280);
  transition: background 0.2s ease, color 0.2s ease;
}

.auth-switch__option input[type="radio"]:checked + span {
  background: #fff;
  color: var(--ink, #1a1a2e);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* ── Auth: input wrap — ikona unutar polja (base) ───────────────────── */

.auth-input-wrap {
  position: relative;
}

.auth-input-wrap .form-input {
  padding-left: 42px;
}

.auth-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* ── Auth: prijava / registracija (theme-vibrant) ───────────────────── */

/* Purple token lokalni scope */
body.theme-vibrant .auth-card {
  --auth-purple: #8b5cf6;
  --auth-purple-deep: #7c3aed;
  --auth-purple-rgb: 139 92 246;
  --auth-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Kartica — 24px radius, ljubičasti sjaj */
body.theme-vibrant .auth-card {
  border-radius: 1.5rem;
  border-color: rgb(139 92 246 / 0.12);
  box-shadow:
    0 4px 24px rgb(139 92 246 / 0.08),
    0 1px 4px rgb(0 0 0 / 0.05);
}

/* Hero bedž ikona — malena, usklađena s tekstom */
.hero-badge :is(i[data-lucide], svg.lucide) {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Hero bedž — ljubičasti chip */
body.theme-vibrant .auth-card .hero-badge {
  background: rgb(139 92 246 / 0.08);
  color: #7c3aed;
  border-color: rgb(139 92 246 / 0.2);
  font-family: var(--theme-font);
}

/* Header naslovi */
body.theme-vibrant .auth-card__header {
  background: none;
  padding: 0;
  border-radius: 0;
}
body.theme-vibrant .auth-card__title {
  font-family: var(--theme-font);
  font-weight: 700;
  color: var(--theme-text);
}
body.theme-vibrant .auth-card__subtitle {
  font-family: var(--theme-font);
  color: var(--theme-muted);
}

/* Auth-switch — ljubičasti segmented selector */
body.theme-vibrant .auth-switch {
  background: rgb(139 92 246 / 0.06);
  border-color: rgb(139 92 246 / 0.14);
  font-family: var(--theme-font);
}

body.theme-vibrant .auth-switch__option span {
  font-family: var(--theme-font);
  color: var(--theme-muted);
  transition: var(--auth-transition);
}

body.theme-vibrant .auth-switch__option input[type="radio"]:checked + span {
  background: #8b5cf6;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgb(139 92 246 / 0.35);
}

/* Labele */
body.theme-vibrant .auth-form .form-label {
  font-family: var(--theme-font);
  font-weight: 600;
  color: var(--theme-muted);
}

/* Input wrap */
body.theme-vibrant .auth-input-wrap .form-input {
  padding-left: 42px;
  border-radius: 12px;
  font-family: var(--theme-font);
  border-color: var(--theme-border);
  background: var(--theme-surface);
  color: var(--theme-text);
  transition: var(--auth-transition);
}

body.theme-vibrant .auth-input-wrap .form-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgb(139 92 246 / 0.40);
  background: #fff;
  outline: none;
}

/* Input ikona — muted, ne indigo */
body.theme-vibrant .auth-input-icon {
  color: var(--theme-muted);
}

/* Submit gumb — masivan flat purple */
body.theme-vibrant .auth-submit.action-btn.primary {
  background: #8b5cf6;
  border-color: #8b5cf6;
  border-radius: 12px;
  font-family: var(--theme-font);
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  padding: 13px;
  transition: var(--auth-transition);
}
body.theme-vibrant .auth-submit.action-btn.primary:hover {
  background: #7c3aed;
  border-color: #7c3aed;
  filter: none;
}

/* Podnožje */
body.theme-vibrant .auth-card__footer {
  font-family: var(--theme-font);
  color: var(--theme-muted);
  border-top-color: var(--theme-border);
}
body.theme-vibrant .auth-card__footer a {
  color: #8b5cf6;
  transition: var(--auth-transition);
}
body.theme-vibrant .auth-card__footer a:hover {
  color: #7c3aed;
}

/* Warning banner — neutralan u vibranta (nema naranče) */
body.theme-vibrant .auth-card .warning-banner {
  background: #fff7f7;
  border-color: #fca5a5;
  color: #991b1b;
  border-radius: 12px;
  font-family: var(--theme-font);
}

/* ── Roditelj (theme-vibrant) ─────────────────────────────────────── */
body.theme-vibrant .parent-shield {
  width: 18px;
  height: 18px;
  color: var(--theme-primary);
  margin-right: 8px;
  vertical-align: text-bottom;
}

/* Placeholderi u formama — čitljivija siva od default browser sive */
body.theme-classic .form-input::placeholder,
body.theme-classic textarea::placeholder,
body.theme-vibrant .form-input::placeholder,
body.theme-vibrant .ss-input::placeholder,
body.theme-vibrant textarea::placeholder {
  color: var(--theme-text-secondary);
  opacity: 0.75;
}
