/* ============================================================
   ap-aqi.css — Sprint 12: Academic Quality Intelligence
   ============================================================ */

/* ── Hide developer-only blocks from plan view ── */
#aiUsedBlock,
#contextUsedBlock {
  display: none !important;
}

/* ============================================================
   AQI CARD — tarjeta principal en Vista del Plan (Obj 8)
   ============================================================ */
.aqi-card {
  background: #fff;
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(30, 58, 138, 0.06);
}

/* header */
.aqi-card__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.aqi-card__icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #1E3A8A 0%, #4338CA 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.aqi-card__meta {
  flex: 1;
}

.aqi-card__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted, #64748B);
}

.aqi-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text, #334155);
  margin: 0;
}

/* score hero */
.aqi-score-row {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 60%, #1E40AF 100%);
  border-radius: 14px;
  margin-bottom: 24px;
}

.aqi-score-ring {
  flex-shrink: 0;
  position: relative;
  width: 96px;
  height: 96px;
}

.aqi-score-ring svg {
  width: 96px;
  height: 96px;
  transform: rotate(-90deg);
}

.aqi-score-ring__track {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 7;
}

.aqi-score-ring__fill {
  fill: none;
  stroke: url(#aqiGradient);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 1s ease;
}

.aqi-score-ring__num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.aqi-score-ring__pct {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.aqi-score-ring__sub {
  font-size: 0.62rem;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.aqi-score-info {
  flex: 1;
}

.aqi-score-cat {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

.aqi-score-disc {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  margin-top: 6px;
  line-height: 1.4;
}

.aqi-score-bloom {
  display: inline-block;
  margin-top: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.8);
  font-weight: 600;
}

/* ── Sections ── */
.aqi-section {
  margin-bottom: 20px;
}

.aqi-section__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-muted, #64748B);
  margin: 0 0 12px;
}

/* ── Dimensions grid ── */
.aqi-dims {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.aqi-dim {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 12px 14px;
}

.aqi-dim__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.aqi-dim__name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-text, #334155);
}

.aqi-dim__score {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary, #1E3A8A);
}

.aqi-dim__bar {
  height: 5px;
  background: #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
}

.aqi-dim__fill {
  height: 100%;
  border-radius: 10px;
  width: 0;
  transition: width 0.8s ease;
}

.aqi-dim__evidence {
  font-size: 0.7rem;
  color: var(--color-text-muted, #64748B);
  line-height: 1.35;
}

/* dim score colors */
.aqi-dim--high .aqi-dim__fill  { background: #10B981; }
.aqi-dim--high .aqi-dim__score { color: #059669; }
.aqi-dim--mid  .aqi-dim__fill  { background: #F59E0B; }
.aqi-dim--mid  .aqi-dim__score { color: #D97706; }
.aqi-dim--low  .aqi-dim__fill  { background: #EF4444; }
.aqi-dim--low  .aqi-dim__score { color: #DC2626; }

/* ── Strengths list ── */
.aqi-strengths {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aqi-strength {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #14532D;
  line-height: 1.4;
}

.aqi-strength::before {
  content: "✓";
  color: #16A34A;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Opportunities list ── */
.aqi-opps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aqi-opp {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #78350F;
  line-height: 1.4;
}

.aqi-opp::before {
  content: "→";
  color: #D97706;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Recommendations ── */
.aqi-recs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aqi-rec {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-left: 3px solid #6366F1;
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
}

.aqi-rec__source {
  font-size: 0.68rem;
  font-weight: 600;
  color: #6366F1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.aqi-rec__text {
  font-size: 0.82rem;
  color: var(--color-text, #334155);
  line-height: 1.4;
}

/* ── Apply button (Obj 6) ── */
.aqi-apply-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #E2E8F0;
  flex-wrap: wrap;
}

.aqi-apply-hint {
  font-size: 0.78rem;
  color: var(--color-text-muted, #64748B);
  flex: 1;
}

/* ── Apply modal ── */
.aqi-apply-modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  max-width: 480px;
  width: 100%;
}

.aqi-apply-modal__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text, #334155);
  margin: 0 0 6px;
}

.aqi-apply-modal__sub {
  font-size: 0.82rem;
  color: var(--color-text-muted, #64748B);
  margin: 0 0 18px;
}

.aqi-apply-modal__fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.aqi-apply-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--color-text, #334155);
}

.aqi-apply-field__icon {
  color: #6366F1;
  font-size: 0.9rem;
}

.aqi-apply-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ============================================================
   AQI DASHBOARD BLOCK (Obj 7)
   ============================================================ */
.aqi-dash {
  background: #fff;
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 24px;
}

.aqi-dash__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.aqi-dash__icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #1E3A8A 0%, #4338CA 100%);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.aqi-dash__name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text, #334155);
}

.aqi-dash__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.aqi-dash__stat {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}

.aqi-dash__val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary, #1E3A8A);
  line-height: 1;
  margin-bottom: 4px;
}

.aqi-dash__lbl {
  font-size: 0.7rem;
  color: var(--color-text-muted, #64748B);
  font-weight: 500;
}

/* History timeline */
.aqi-history {
  border-top: 1px solid #E2E8F0;
  padding-top: 16px;
}

.aqi-history__title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted, #64748B);
  margin: 0 0 12px;
}

.aqi-timeline {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 60px;
  overflow-x: auto;
}

.aqi-timeline__bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.aqi-timeline__bar {
  width: 24px;
  background: linear-gradient(to top, #1E40AF, #6366F1);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.6s ease;
}

.aqi-timeline__num {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--color-text-muted, #64748B);
}

/* ── Companion AQI message ── */
.aqi-companion-msg {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-left: 3px solid #3B82F6;
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #1E40AF;
  line-height: 1.4;
  margin-bottom: 10px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .aqi-dims { grid-template-columns: 1fr; }
  .aqi-dash__grid { grid-template-columns: repeat(2, 1fr); }
  .aqi-score-row { flex-direction: column; gap: 16px; text-align: center; }
}

@media (max-width: 600px) {
  .aqi-card { padding: 20px 16px; }
  .aqi-score-row { padding: 16px; }
  .aqi-dash__grid { grid-template-columns: 1fr 1fr; }
}
