/* ==========================================================================
   CLAY POLISH — auth, nav 3D icons, bubbles, tiles (lavender / deep purple)
   ========================================================================== */

.clay-auth-card {
  position: relative;
  text-align: center;
  padding-top: 0.5rem !important;
}

.clay-auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}

.clay-auth-hero {
  display: flex;
  justify-content: center;
  margin: -0.25rem 0 0.15rem;
  pointer-events: none;
}

.clay-auth-mascot {
  width: min(58vw, 210px);
  height: auto;
  max-height: 210px;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(88, 60, 140, 0.2));
  border-radius: 24px;
}

.clay-auth-head {
  margin-bottom: 0.85rem;
}

.clay-auth-heart {
  display: inline-block;
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.clay-auth-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent-primary);
  margin: 0 0 0.25rem;
}

.clay-auth-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 auto;
  max-width: 28ch;
}

.clay-auth-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  padding: 4px;
  background: var(--bg-card-subtle);
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

.clay-auth-tabs .perspective-tab-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 9px 10px;
  font-weight: 700;
  font-size: 0.82rem;
  background: transparent;
  color: var(--text-muted);
}

.clay-auth-tabs .perspective-tab-btn.active {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent-primary) 30%, transparent);
}

.clay-field {
  margin-bottom: 0.7rem;
  text-align: left;
}

.clay-input-row {
  display: flex;
  align-items: center;
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.clay-input-row:focus-within {
  border-color: color-mix(in srgb, var(--accent-primary) 55%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 0 3px var(--accent-soft);
}

.clay-input-well {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  margin: 3px 0 3px 3px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--accent-secondary), var(--accent-primary));
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--accent-primary) 28%, transparent);
}

.clay-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 12px 14px 12px 10px;
  outline: none;
  font-family: inherit;
}

.clay-input::placeholder {
  color: var(--text-dim);
  font-weight: 500;
}

.clay-register-extra {
  margin-bottom: 0.25rem;
}

.clay-auth-cta {
  margin-top: 0.35rem;
}

.clay-auth-status {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 10px;
  line-height: 1.4;
  min-height: 1.2em;
}

.clay-auth-logout {
  margin-top: 10px;
}

.clay-auth-switch {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.clay-text-link {
  border: none;
  background: none;
  color: var(--accent-primary);
  font-weight: 800;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mobile-nav-3d {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  box-shadow: 0 2px 6px rgba(88, 60, 140, 0.12);
}

.mobile-nav-item.active .mobile-nav-3d {
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--accent-primary) 25%, transparent);
}

.msg-content {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1.5px solid var(--border-subtle) !important;
  box-shadow: var(--shadow-card) !important;
  background: var(--bg-elev) !important;
}

.message-bubble.user .msg-content {
  background: var(--gradient-brand) !important;
  border: none !important;
  color: #fff !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 8px 18px color-mix(in srgb, var(--accent-primary) 30%, transparent) !important;
}

.badge {
  border-radius: 999px;
  font-weight: 700;
}

.badge-edu {
  background: color-mix(in srgb, #c4b5fd 28%, white);
  color: #5b4bc4;
  border-color: color-mix(in srgb, #a78bfa 35%, transparent);
}

.badge-amber,
.badge-trigger {
  background: color-mix(in srgb, #fde68a 55%, white);
  color: #92400e;
  border-color: color-mix(in srgb, #fbbf24 40%, transparent);
}

.passport-card,
.kb-card,
.settings-row,
.index-card {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border-color: var(--border-subtle);
}

[data-theme="dark"] .child-tab-pill.is-active,
[data-theme="dark-neon"] .child-tab-pill.is-active,
[data-theme="soft-neon-night"] .child-tab-pill.is-active,
[data-theme="deep-purple-clay"] .child-tab-pill.is-active {
  color: #1a1430;
}

.brand-icon-img {
  border-radius: 12px;
  object-fit: cover;
}

.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent-primary);
  border-color: color-mix(in srgb, var(--accent-primary) 30%, transparent);
}

.avatar-bubble {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 8px 18px color-mix(in srgb, var(--accent-primary) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent-primary) 28%, transparent);
}

.nav-glass-facet,
.nav-glass-sheen {
  opacity: 0.45;
}

@media (max-width: 768px) {
  .mobile-nav-cloud {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--bg-elev) !important;
    border: 1.5px solid var(--border-subtle) !important;
    box-shadow: var(--shadow-clay) !important;
  }

  .mobile-nav-item.active {
    background: var(--accent-soft);
    color: var(--accent-primary);
  }

  .clay-auth-mascot {
    width: min(52vw, 180px);
    max-height: 180px;
  }
}

/* ==========================================================================
   PHASE 2 — Dashboard 3D tiles, hero, pulse, library
   ========================================================================== */

:root {
  --shadow-clay-lg:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 16px 36px rgba(88, 60, 140, 0.14),
    0 6px 0 rgba(196, 181, 253, 0.28);
  --shadow-clay-press:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 4px 12px rgba(88, 60, 140, 0.12),
    0 2px 0 rgba(196, 181, 253, 0.2);
}

[data-theme="dark"],
[data-theme="dark-neon"],
[data-theme="soft-neon-night"],
[data-theme="deep-purple-clay"] {
  --shadow-clay-lg:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 18px 40px rgba(0, 0, 0, 0.45),
    0 5px 0 rgba(20, 12, 40, 0.55);
  --shadow-clay-press:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 6px 14px rgba(0, 0, 0, 0.35);
}

/* Soft pastel 3D tiles */
.clay-tile {
  position: relative;
  border-radius: 22px;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow-clay-lg);
  background: #f3edff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.clay-tile--lilac { background: linear-gradient(165deg, #f0e9ff 0%, #e4d9ff 100%); }
.clay-tile--peach { background: linear-gradient(165deg, #ffe9df 0%, #ffd8c8 100%); }
.clay-tile--butter { background: linear-gradient(165deg, #fff6d9 0%, #ffe9a8 100%); }
.clay-tile--sky { background: linear-gradient(165deg, #e5f4ff 0%, #cfe9ff 100%); }
.clay-tile--mint { background: linear-gradient(165deg, #e4faf0 0%, #c9f0df 100%); }
.clay-tile--rose { background: linear-gradient(165deg, #ffe6ef 0%, #ffd0e0 100%); }

[data-theme="dark"] .clay-tile,
[data-theme="dark-neon"] .clay-tile,
[data-theme="soft-neon-night"] .clay-tile,
[data-theme="deep-purple-clay"] .clay-tile {
  border-color: rgba(196, 181, 253, 0.22);
}

[data-theme="dark"] .clay-tile--lilac,
[data-theme="dark-neon"] .clay-tile--lilac,
[data-theme="soft-neon-night"] .clay-tile--lilac,
[data-theme="deep-purple-clay"] .clay-tile--lilac {
  background: linear-gradient(165deg, #3a2f5c 0%, #2f274d 100%);
}
[data-theme="dark"] .clay-tile--peach,
[data-theme="dark-neon"] .clay-tile--peach,
[data-theme="soft-neon-night"] .clay-tile--peach,
[data-theme="deep-purple-clay"] .clay-tile--peach {
  background: linear-gradient(165deg, #4a3340 0%, #3a2834 100%);
}
[data-theme="dark"] .clay-tile--butter,
[data-theme="dark-neon"] .clay-tile--butter,
[data-theme="soft-neon-night"] .clay-tile--butter,
[data-theme="deep-purple-clay"] .clay-tile--butter {
  background: linear-gradient(165deg, #4a422e 0%, #3a3424 100%);
}
[data-theme="dark"] .clay-tile--sky,
[data-theme="dark-neon"] .clay-tile--sky,
[data-theme="soft-neon-night"] .clay-tile--sky,
[data-theme="deep-purple-clay"] .clay-tile--sky {
  background: linear-gradient(165deg, #2e3a52 0%, #263048 100%);
}
[data-theme="dark"] .clay-tile--mint,
[data-theme="dark-neon"] .clay-tile--mint,
[data-theme="soft-neon-night"] .clay-tile--mint,
[data-theme="deep-purple-clay"] .clay-tile--mint {
  background: linear-gradient(165deg, #2a453c 0%, #243a34 100%);
}
[data-theme="dark"] .clay-tile--rose,
[data-theme="dark-neon"] .clay-tile--rose,
[data-theme="soft-neon-night"] .clay-tile--rose,
[data-theme="deep-purple-clay"] .clay-tile--rose {
  background: linear-gradient(165deg, #4a3040 0%, #3a2836 100%);
}

.clay-icon-3d {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  box-shadow: 0 6px 14px rgba(88, 60, 140, 0.14);
  margin-bottom: 10px;
}

/* Pulse dashboard grid */
.clay-stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0 0 1rem;
}

@media (min-width: 420px) {
  .clay-stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.clay-stat-card {
  padding: 14px 14px 12px;
  text-align: left;
}

.clay-stat-card:hover {
  transform: translateY(-2px);
}

.clay-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  line-height: 1.25;
}

.clay-stat-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 10px;
}

.clay-stat-bar {
  height: 8px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.55) !important;
  overflow: hidden;
}

.clay-stat-bar .progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gradient-brand) !important;
}

.clay-tile--rose .clay-stat-bar .progress-bar-fill {
  background: linear-gradient(90deg, #f472b6, #fb7185) !important;
}
.clay-tile--lilac .clay-stat-bar .progress-bar-fill {
  background: linear-gradient(90deg, #8b7cf6, #a78bfa) !important;
}
.clay-tile--mint .clay-stat-bar .progress-bar-fill {
  background: linear-gradient(90deg, #34d399, #6ee7b7) !important;
}

/* Heroes */
.clay-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin: 0 0 12px;
  border-radius: 24px;
  background: linear-gradient(135deg, #f7f2ff 0%, #ebe3ff 55%, #ffe9f2 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-clay-lg);
}

[data-theme="dark"] .clay-hero,
[data-theme="dark-neon"] .clay-hero,
[data-theme="soft-neon-night"] .clay-hero,
[data-theme="deep-purple-clay"] .clay-hero {
  background: linear-gradient(135deg, #322a52 0%, #2a2348 60%, #3a2840 100%);
  border-color: rgba(196, 181, 253, 0.22);
}

.clay-hero-mascot {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 22px;
  flex-shrink: 0;
  box-shadow: 0 10px 20px rgba(88, 60, 140, 0.16);
}

.clay-hero--pulse .clay-hero-mascot {
  width: 72px;
  height: 72px;
}

.clay-hero-copy {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.clay-hero-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 4px;
}

.clay-hero-sub,
.clay-hero-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 0 6px;
}

.clay-hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding: 9px 16px;
  border: none;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.8rem;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  background: var(--gradient-brand);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 8px 16px color-mix(in srgb, var(--accent-primary) 32%, transparent);
}

.clay-hero-cta:active {
  box-shadow: var(--shadow-clay-press);
  transform: translateY(1px);
}

.chat-welcome-hero {
  margin: 4px 4px 14px;
}

/* Knowledge cards as horizontal clay rows */
.clay-kb-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 12px;
  padding: 12px !important;
  border-radius: 20px !important;
  background: var(--bg-elev) !important;
  border: 1.5px solid var(--border-subtle) !important;
  box-shadow: var(--shadow-clay) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.clay-kb-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-clay-lg) !important;
}

.clay-kb-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 16px;
}

.clay-kb-icon .kb-card-icon-svg {
  display: flex;
  align-items: center;
  justify-content: center;
}

.clay-kb-icon .kb-svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-main);
}

.clay-kb-body {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.clay-kb-card .kb-card-title {
  margin-bottom: 4px;
}

/* Deeper passport + search clay */
.passport-card {
  box-shadow: var(--shadow-clay-lg) !important;
}

.kb-search-bar {
  border-radius: 999px !important;
  box-shadow: var(--shadow-card) !important;
  border: 1.5px solid var(--border-subtle) !important;
  background: var(--bg-elev) !important;
}

.chat-input {
  border-radius: 999px !important;
  box-shadow: var(--shadow-card);
}

/* Stronger glass panels */
.glass-panel {
  box-shadow: var(--shadow-clay-lg) !important;
}

@media (max-width: 420px) {
  .clay-stat-grid {
    grid-template-columns: 1fr;
  }

  .clay-hero {
    gap: 10px;
    padding: 12px;
  }

  .clay-hero-mascot {
    width: 68px;
    height: 68px;
  }

  .clay-stat-value {
    font-size: 1.45rem;
  }
}
