/* panel.css — capa propia sobre el tema Jiade para "Estado de España".
 * Solo estiliza los componentes nuevos (veredictos, KPIs, timing, detalle).
 * El layout (sidebar, header, grid) lo gobierna style.css del tema.
 */

:root {
	--ok: #2bc155;
	--ok-soft: rgba(43, 193, 85, .12);
	--warn: #ffab2d;
	--warn-soft: rgba(255, 171, 45, .14);
	--bad: #ff5269;
	--bad-soft: rgba(255, 82, 105, .12);
	--mute: #7e7e8f;
	--mute-soft: rgba(126, 126, 143, .12);
}

/* Material Symbols: alineación vertical correcta dentro de texto */
.material-symbols-outlined {
	vertical-align: middle;
	line-height: 1;
	font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ---------- Cabecera: badge de actualización ---------- */
.badge-update {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #fff;
	font-size: 13px;
	background: rgba(255, 255, 255, .14);
	border: 1px solid rgba(255, 255, 255, .22);
	padding: 6px 12px;
	border-radius: 999px;
	margin-right: 14px;
	white-space: nowrap;
}
.badge-update .material-symbols-outlined { font-size: 18px; }
.badge-update strong { font-weight: 600; }

.dz-head-title h2 { font-weight: 600; }

/* ---------- Intro de sección ---------- */
.section-anchor { scroll-margin-top: 90px; padding-top: 4px; }
.section-intro { margin: 8px 0 18px; }
.section-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 22px;
	font-weight: 600;
	color: var(--text-dark);
	margin: 0 0 4px;
}
.section-title .material-symbols-outlined { color: var(--primary); font-size: 24px; }
.section-sub { margin: 0; color: var(--mute); font-size: 14px; }

.indicator-section { margin-top: 26px; }

/* ====================================================
   A) VEREDICTOS — las dos tarjetas grandes
   ==================================================== */
.verdict-card { border-radius: 18px; overflow: hidden; }
.verdict-card .card-body { padding: 26px 26px 22px; }

.verdict-card--verde { box-shadow: inset 0 3px 0 0 var(--ok); }
.verdict-card--ambar { box-shadow: inset 0 3px 0 0 var(--warn); }
.verdict-card--rojo  { box-shadow: inset 0 3px 0 0 var(--bad); }

.verdict-card__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 6px;
}
.verdict-card__pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 16px;
	font-weight: 600;
	color: var(--text-dark);
	line-height: 1.25;
}
.verdict-card__pill .material-symbols-outlined {
	color: var(--band, var(--primary));
	font-size: 22px;
}
.verdict-card__badge {
	font-size: 13px;
	font-weight: 700;
	color: #fff;
	background: var(--band, var(--primary));
	padding: 4px 14px;
	border-radius: 999px;
	white-space: nowrap;
}

.verdict-card__main {
	display: flex;
	align-items: center;
	gap: 18px;
	margin: 6px 0 16px;
}
.verdict-card__gauge { flex: 0 0 200px; width: 200px; min-height: 200px; }
.verdict-card__copy { flex: 1 1 auto; }
.verdict-card__question {
	font-size: 15px;
	font-weight: 600;
	color: var(--text-dark);
	margin: 0 0 8px;
}
.verdict-card__summary {
	font-size: 14px;
	line-height: 1.6;
	color: #5b5b6b;
	margin: 0;
}

.verdict-card__pyme {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	background: color-mix(in srgb, var(--band, var(--primary)) 8%, transparent);
	border-left: 3px solid var(--band, var(--primary));
	border-radius: 12px;
	padding: 14px 16px;
}
.verdict-card__pyme .material-symbols-outlined { color: var(--band, var(--primary)); font-size: 22px; }
.verdict-card__pyme-label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--band, var(--primary));
	margin-bottom: 2px;
}
.verdict-card__pyme p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-dark); }

.gauge-fallback {
	display: flex;
	align-items: baseline;
	justify-content: center;
	height: 200px;
	font-size: 52px;
	font-weight: 700;
	color: var(--primary);
}
.gauge-fallback span { font-size: 18px; color: var(--mute); margin-left: 4px; }

/* ====================================================
   B) TARJETAS KPI
   ==================================================== */
.kpi-card { border-radius: 16px; height: 100%; transition: transform .15s ease, box-shadow .15s ease; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(20, 20, 60, .08); }
.kpi-card .card-body { padding: 20px; display: flex; flex-direction: column; height: 100%; }

.kpi-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px; height: 42px;
	border-radius: 12px;
	background: color-mix(in srgb, var(--primary) 12%, transparent);
	color: var(--primary);
}
.kpi-card__icon .material-symbols-outlined { font-size: 24px; }

.kpi-chip {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	font-size: 13px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 999px;
}
.kpi-chip .material-symbols-outlined { font-size: 16px; }
.kpi-chip--up   { color: var(--ok);   background: var(--ok-soft); }
.kpi-chip--down { color: var(--bad);  background: var(--bad-soft); }
.kpi-chip--flat { color: var(--mute); background: var(--mute-soft); }

.kpi-card__label { font-size: 14px; font-weight: 500; color: var(--mute); margin-bottom: 4px; }
.kpi-card__value { font-size: 30px; font-weight: 700; color: var(--text-dark); line-height: 1.1; }
.kpi-card__value--na { font-size: 20px; color: var(--mute); }
.kpi-card__unit { font-size: 14px; font-weight: 500; color: var(--mute); margin-left: 6px; }

.kpi-card__spark { margin: 10px 0 6px; min-height: 56px; }
.kpi-card__spark--empty { min-height: 0; margin: 4px 0; }

.kpi-card__period {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: var(--mute);
	margin: 0 0 10px;
}
.kpi-card__period .material-symbols-outlined { font-size: 15px; }

.kpi-card__explain {
	display: flex;
	gap: 6px;
	font-size: 13px;
	line-height: 1.5;
	color: #5b5b6b;
	margin: 0 0 12px;
}
.kpi-card__explain .material-symbols-outlined { font-size: 17px; color: var(--secondary); flex: 0 0 auto; margin-top: 1px; }

.kpi-card__reading {
	margin-top: auto;
	background: color-mix(in srgb, var(--tone, var(--mute)) 9%, transparent);
	border-radius: 12px;
	padding: 12px 14px;
}
.kpi-card__reading p { margin: 0 0 8px; font-size: 13px; line-height: 1.55; color: var(--text-dark); }
.kpi-card__more {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	border: 0;
	background: transparent;
	padding: 0;
	font-size: 13px;
	font-weight: 700;
	color: var(--tone, var(--primary));
	cursor: pointer;
}
.kpi-card__more .material-symbols-outlined { font-size: 18px; }

.kpi-card--broken { opacity: .85; }
.kpi-card--broken .kpi-card__period .material-symbols-outlined { color: var(--bad); }

.kpi-empty, .kpi-card__spark--empty:empty { color: var(--mute); }
.kpi-empty {
	padding: 24px;
	text-align: center;
	color: var(--mute);
	background: var(--mute-soft);
	border-radius: 14px;
	font-size: 14px;
}

/* ====================================================
   C) TARJETAS DE TIMING
   ==================================================== */
.timing-block { margin-bottom: 8px; }
.timing-block__title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 16px;
	font-weight: 600;
	margin: 18px 0 14px;
}
.timing-block__title .material-symbols-outlined { font-size: 22px; }
.timing-block__title--good { color: var(--ok); }
.timing-block__title--warm { color: var(--warn); }
.timing-block__title--bad  { color: var(--bad); }

.timing-card { border-radius: 16px; height: 100%; border-left: 4px solid var(--band, var(--mute)); }
.timing-card .card-body { padding: 20px; }
.timing-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px; height: 40px;
	border-radius: 11px;
	background: color-mix(in srgb, var(--band, var(--mute)) 14%, transparent);
	color: var(--band, var(--mute));
	margin-bottom: 12px;
}
.timing-card__question { font-size: 13px; font-weight: 600; color: var(--mute); margin: 0 0 6px; }
.timing-card__headline { font-size: 16px; font-weight: 700; color: var(--text-dark); margin: 0 0 8px; line-height: 1.3; }
.timing-card__reason { font-size: 13px; line-height: 1.6; color: #5b5b6b; margin: 0; }
.timing-card__reason strong { color: var(--text-dark); }

/* ====================================================
   ESTADOS: carga y error
   ==================================================== */
.verdict-card.is-loading .card-body { padding: 30px; }
.skeleton-gauge {
	width: 160px; height: 160px;
	border-radius: 50%;
	margin: 0 auto 20px;
	background: linear-gradient(110deg, #eee 8%, #f5f5f5 18%, #eee 33%);
	background-size: 200% 100%;
	animation: shimmer 1.3s linear infinite;
}
.skeleton-line {
	height: 12px;
	border-radius: 6px;
	margin: 10px 0;
	background: linear-gradient(110deg, #eee 8%, #f5f5f5 18%, #eee 33%);
	background-size: 200% 100%;
	animation: shimmer 1.3s linear infinite;
}
.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-100 { width: 100%; }
@keyframes shimmer { to { background-position-x: -200%; } }

.panel-error {
	display: flex;
	align-items: center;
	gap: 16px;
	background: var(--bad-soft);
	border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent);
	border-radius: 14px;
	padding: 18px 22px;
	margin-top: 8px;
}
.panel-error .material-symbols-outlined { font-size: 34px; color: var(--bad); }
.panel-error strong { display: block; color: var(--text-dark); font-size: 15px; }
.panel-error p { margin: 2px 0 0; font-size: 13px; color: #5b5b6b; }
.panel-error button { margin-left: auto; white-space: nowrap; }

/* ====================================================
   PANEL DE DETALLE (lateral)
   ==================================================== */
.detail-dialog { position: fixed; inset: 0; z-index: 1090; }
.detail-dialog.is-hidden { display: none; }
.detail-dialog__backdrop { position: absolute; inset: 0; background: rgba(18, 18, 58, .42); backdrop-filter: blur(2px); }
.detail-dialog__panel {
	position: absolute;
	top: 0; right: 0; bottom: 0;
	width: min(460px, 100%);
	background: var(--card);
	box-shadow: -12px 0 40px rgba(20, 20, 60, .18);
	padding: 28px 26px;
	overflow-y: auto;
	animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.detail-dialog__close {
	position: absolute;
	top: 16px; right: 16px;
	border: 0;
	background: var(--mute-soft);
	color: var(--text-dark);
	width: 36px; height: 36px;
	border-radius: 10px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.detail__head { display: flex; gap: 14px; align-items: center; margin: 6px 0 22px; }
.detail__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px; height: 48px;
	border-radius: 13px;
	background: color-mix(in srgb, var(--tone, var(--primary)) 14%, transparent);
	color: var(--tone, var(--primary));
}
.detail__title { font-size: 19px; font-weight: 700; color: var(--text-dark); margin: 0 0 4px; }
.detail__meta { font-size: 13px; color: var(--mute); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.detail__section { margin-bottom: 18px; }
.detail__section h4 {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: var(--mute);
	margin: 0 0 6px;
}
.detail__section p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-dark); }
.detail__reading, .detail__action {
	background: color-mix(in srgb, var(--tone, var(--primary)) 8%, transparent);
	border-radius: 12px;
	padding: 14px 16px;
}
.detail__reading h4, .detail__action h4 { color: var(--tone, var(--primary)); }
.detail__action { background: var(--ok-soft); }
.detail__action h4 { color: var(--ok); }

body.detail-open { overflow: hidden; }

/* ====================================================
   RESPONSIVE
   ==================================================== */
@media (max-width: 575px) {
	.verdict-card__main { flex-direction: column; text-align: center; }
	.verdict-card__gauge { flex-basis: auto; width: 220px; margin: 0 auto; }
	.kpi-card__value { font-size: 26px; }
	.section-title { font-size: 19px; }
}

/* color-mix fallback para navegadores sin soporte */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
	.kpi-card__icon { background: rgba(55, 54, 175, .12); }
	.verdict-card__pyme { background: rgba(55, 54, 175, .06); }
}

/* ---------- "El detalle": indicadores colapsados ---------- */
.detalle {
	margin: 8px 0 28px;
	border-radius: 16px;
}
.detalle__summary {
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	list-style: none;
	padding: 16px 20px;
	background: var(--card, #fff);
	border: 1px solid rgba(126, 126, 143, .18);
	border-radius: 14px;
	box-shadow: 0 5px 18px rgba(20, 20, 60, .05);
	transition: border-color .15s ease, box-shadow .15s ease;
}
.detalle__summary:hover {
	border-color: rgba(55, 54, 175, .45);
	box-shadow: 0 8px 24px rgba(20, 20, 60, .08);
}
.detalle__summary::-webkit-details-marker { display: none; }
.detalle__chevron {
	font-size: 26px;
	color: var(--primary, #3736af);
	transition: transform .2s ease;
}
.detalle[open] .detalle__chevron { transform: rotate(180deg); }
.detalle__summary-text { font-weight: 600; font-size: 16px; color: var(--title, #1f2a44); }
.detalle__summary-sub {
	margin-left: auto;
	font-size: 12px;
	color: var(--mute);
	white-space: nowrap;
}
.detalle__body { padding-top: 18px; }
.detalle[open] .detalle__summary {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}
@media (max-width: 575px) {
	.detalle__summary-sub { display: none; }
}
