/*
  Academic Intelligence Core Experience — Sprint 11
  Identidad visual premium de todos los motores del AIC.
  Complementa el sistema de diseño existente (Inter, variables CSS de styles.css).
  No sobreescribe ninguna clase existente.
*/

/* ============================================================
   VARIABLES DE MOTORES — colores institucionales
   ============================================================ */
:root {
  --motor-brain:        #1E40AF;
  --motor-knowledge:    #4338CA;
  --motor-genome:       #059669;
  --motor-dna:          #7C3AED;
  --motor-context:      #0891B2;
  --motor-orchestrator: #D97706;
  --motor-claude:       #374151;
  --motor-quality:      #16A34A;
}

/* ============================================================
   AICX HERO CARD — tarjeta principal del Dashboard
   ============================================================ */
.aicx-hero {
  background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 55%, #0F2942 100%);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: var(--radius-lg, 20px);
  padding: 28px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.aicx-hero::before {
  content: '';
  position: absolute;
  top: -70px; right: -70px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 65%);
  pointer-events: none;
}

.aicx-hero::after {
  content: '';
  position: absolute;
  bottom: -50px; left: 30px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.07), transparent 65%);
  pointer-events: none;
}

.aicx-hero__top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.aicx-hero__icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 0 0 28px rgba(99, 102, 241, 0.35);
}

.aicx-hero__meta { flex: 1; min-width: 0; }

.aicx-hero__label {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #818CF8;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.aicx-hero__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #F1F5F9;
  line-height: 1.2;
}

.aicx-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 20px;
  flex-shrink: 0;
}

.aicx-hero__badge--active {
  background: rgba(16, 185, 129, 0.14);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.22);
}

.aicx-badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #10B981;
  animation: aicx-pulse-dot 2s ease-in-out infinite;
}

@keyframes aicx-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.75); }
}

.aicx-hero__body {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 32px;
  align-items: center;
}

/* Score ring */
.aicx-score { flex-shrink: 0; }

.aicx-score__ring {
  width: 96px; height: 96px;
  position: relative;
}

.aicx-score__ring svg {
  transform: rotate(-90deg);
  width: 100%; height: 100%;
  overflow: visible;
}

.aicx-score__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 6.5;
}

.aicx-score__fill {
  fill: none;
  stroke: url(#aicxGrad);
  stroke-width: 6.5;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 1.3s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

.aicx-score__num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.aicx-score__pct {
  font-size: 1.55rem;
  font-weight: 800;
  color: #F1F5F9;
  line-height: 1;
}

.aicx-score__lbl {
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.38);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Factor bars */
.aicx-factors {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.aicx-factor {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 9px;
  opacity: 0.45;
  transition: opacity 0.3s;
}

.aicx-factor--active { opacity: 1; }

.aicx-factor__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.aicx-factor__name {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.6);
}

.aicx-factor--active .aicx-factor__name { color: rgba(255, 255, 255, 0.88); }

.aicx-factor__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aicx-factor__bar {
  width: 64px;
  height: 3px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 2px;
  overflow: hidden;
}

.aicx-factor__fill {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width 1s ease 0.5s;
}

.aicx-factor__val {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.38);
  min-width: 36px;
  text-align: right;
  white-space: nowrap;
}

.aicx-factor--active .aicx-factor__val { color: rgba(255, 255, 255, 0.7); }

.aicx-hero__footer {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.28);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  letter-spacing: 0.01em;
}

/* ============================================================
   MOTOR GRID — 6 tarjetas de motores
   ============================================================ */
.aicx-motors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.aicx-motor {
  background: var(--color-card, #fff);
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: var(--radius-md, 14px);
  padding: 14px 16px;
  position: relative;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.aicx-motor:hover {
  border-color: var(--aicx-mc, var(--color-primary));
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.aicx-motor__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.aicx-motor__icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.aicx-motor__name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text, #334155);
  line-height: 1.2;
  flex: 1;
}

/* Tooltip trigger */
.aicx-motor__tip {
  width: 17px; height: 17px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--color-border, #E2E8F0);
  color: var(--color-text-muted, #64748B);
  font-size: 0.6rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: help;
  flex-shrink: 0;
  position: relative;
  font-family: inherit;
  line-height: 1;
  padding: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.aicx-motor__tip:hover,
.aicx-motor__tip:focus {
  background: var(--aicx-mc, var(--color-primary));
  border-color: var(--aicx-mc, var(--color-primary));
  color: #fff;
  outline: none;
}

.aicx-tip-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: #1E293B;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.71rem;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 200;
  white-space: normal;
  font-weight: 400;
  text-align: left;
}

.aicx-tip-bubble::after {
  content: '';
  position: absolute;
  top: 100%; right: 10px;
  border: 5px solid transparent;
  border-top-color: #1E293B;
}

.aicx-motor__tip:hover .aicx-tip-bubble,
.aicx-motor__tip:focus .aicx-tip-bubble {
  opacity: 1;
  transform: translateY(0);
}

/* Motor status line */
.aicx-motor__status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}

.aicx-motor__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.aicx-motor__dot--on  { background: #10B981; }
.aicx-motor__dot--wait{ background: #F59E0B; }
.aicx-motor__dot--off { background: #CBD5E1; }

.aicx-motor__val {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--color-text, #334155);
}

.aicx-motor__sub {
  font-size: 0.67rem;
  color: var(--color-text-muted, #64748B);
}

/* ============================================================
   PROACTIVE MESSAGES — Academic Brain Proactivo
   ============================================================ */
.aicx-proactive {
  margin-bottom: 24px;
}

.aicx-proactive__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-muted, #64748B);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aicx-proactive__label::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #10B981;
  animation: aicx-pulse-dot 2s infinite;
}

.aicx-proactive__rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aicx-msg {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 15px;
  background: var(--color-card, #fff);
  border: 1px solid var(--color-border, #E2E8F0);
  border-left: 3px solid var(--aicx-mc, var(--color-primary));
  border-radius: var(--radius-sm, 10px);
  animation: aicx-fadein 0.35s ease both;
}

@keyframes aicx-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.aicx-msg__icon { font-size: 0.95rem; flex-shrink: 0; margin-top: 1px; }

.aicx-msg__body { flex: 1; }

.aicx-msg__motor {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--aicx-mc, var(--color-primary));
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}

.aicx-msg__text {
  font-size: 0.82rem;
  color: var(--color-text, #334155);
  line-height: 1.45;
}

/* ============================================================
   INTELLIGENCE HISTORY — Últimas decisiones inteligentes
   ============================================================ */
.aicx-history {
  background: var(--color-card, #fff);
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: var(--radius-md, 14px);
  padding: 18px 22px;
  margin-bottom: 24px;
}

.aicx-history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.aicx-history__title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--color-text, #334155);
}

.aicx-evt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border, #E2E8F0);
}

.aicx-evt:last-child { border-bottom: none; }

.aicx-evt__icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.aicx-evt__body { flex: 1; }

.aicx-evt__text {
  font-size: 0.8rem;
  color: var(--color-text, #334155);
  line-height: 1.4;
}

.aicx-evt__meta {
  font-size: 0.68rem;
  color: var(--color-text-muted, #64748B);
  margin-top: 2px;
}

.aicx-evt__motor {
  font-weight: 600;
  color: var(--aicx-mc, var(--color-primary));
}

/* ============================================================
   LANDING — sección AIC feature cards (Obj 8)
   ============================================================ */
.aicx-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 32px;
}

.aicx-feat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 18px 20px;
  transition: background 0.2s, border-color 0.2s;
}

.aicx-feat:hover {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.2);
}

.aicx-feat__icon {
  font-size: 1.25rem;
  margin-bottom: 10px;
  display: block;
}

.aicx-feat__name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #E2E8F0;
  margin-bottom: 5px;
}

.aicx-feat__desc {
  font-size: 0.73rem;
  color: rgba(255, 255, 255, 0.35);
  line-height: 1.55;
}

/* ============================================================
   PREMIUM DESIGN POLISH — uniformización del sistema (Obj 10/13)
   ============================================================ */

/* Cards uniformes */
.app-card {
  transition: box-shadow 0.18s ease;
}

/* Stat cards: ajuste de sombra y border-radius */
.stat-card {
  border-radius: var(--radius-md, 14px) !important;
}

/* Inputs: height y border-radius uniformes */
.search-input,
.filter-select,
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  border-radius: var(--radius-sm, 10px);
  border: 1.5px solid var(--color-border, #E2E8F0);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus,
.filter-select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--color-cta, #2563EB);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

/* Buttons: micro-transición consistente */
.btn {
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn--cta:hover {
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
}

/* Badge uniformes */
.badge {
  border-radius: 20px !important;
}

/* Cards hover suave */
.subject-card:hover,
.app-card:hover {
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.09);
}

/* Navigation active state más definida */
.app-nav__item--active {
  font-weight: 600;
}

/* Summary stats: tipografía uniforme */
.summary-stat__value {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Toast/mensaje: border-radius */
.auth-message {
  border-radius: var(--radius-sm, 10px);
}

/* Spacing uniforme entre secciones del dashboard */
.app-card--spaced {
  margin-bottom: 20px;
}

/* Motor engine tags en el AIC Widget chips */
.aic-widget__chip {
  border-radius: 20px;
  font-size: 0.64rem;
}

/* ============================================================
   OCULTAR INFO TÉCNICA — Obj 11/12
   ============================================================ */
/* Estas clases ocultan elementos de debug/dev cuando se añaden */
.aicx-hidden-dev { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .aicx-motors { grid-template-columns: repeat(2, 1fr); }
  .aicx-hero__body { grid-template-columns: 1fr; gap: 20px; }
  .aicx-score { display: flex; align-items: center; gap: 20px; }
  .aicx-score__ring { width: 80px; height: 80px; }
  .aicx-features { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .aicx-motors { grid-template-columns: 1fr 1fr; gap: 8px; }
  .aicx-hero { padding: 18px 16px; }
  .aicx-hero__top { gap: 10px; }
  .aicx-factor__bar { width: 44px; }
  .aicx-tip-bubble { width: 170px; }
}
