/* Comparador Miphone — estilos autocontenidos, prefijo .cmx- */

.cmx-app {
	/* Tokens del lenguaje de diseño Miphone (morado marca + CTA rosa + Montserrat) */
	--cmx-accent: #5b00aa;
	--cmx-cta: #ff2e63;
	--cmx-dark: #1c0533;
	--cmx-bg: #ffffff;
	--cmx-surface: #f0f5fa;
	--cmx-border: #e4e7ec;
	--cmx-text: #334155;
	--cmx-heading: #1e293b;
	--cmx-muted: #64748b;
	--cmx-green: #16a34a;
	--cmx-amber: #d97706;
	--cmx-red: #dc2626;
	--cmx-radius: 16px;
	color: var(--cmx-text);
	max-width: 1100px;
	margin: 0 auto;
	padding: 8px;
}

.cmx-app *, .cmx-app *::before, .cmx-app *::after { box-sizing: border-box; }

/* ---------- Header ---------- */
.cmx-header { text-align: center; margin-bottom: 20px; }
.cmx-title { font-size: 1.7rem; margin: 0 0 6px; font-weight: 800; color: var(--cmx-heading); }
.cmx-subtitle { color: var(--cmx-muted); margin: 0 auto; max-width: 640px; font-size: 0.98rem; }

/* ---------- Buscador ---------- */
.cmx-search-wrap { position: relative; max-width: 560px; margin: 0 auto 14px; }
.cmx-search {
	width: 100%; padding: 13px 18px; font-size: 1rem;
	border: 2px solid var(--cmx-border); border-radius: 999px;
	outline: none; transition: border-color .15s;
	background: var(--cmx-bg); color: var(--cmx-text);
}
.cmx-search:focus { border-color: var(--cmx-accent); }
.cmx-search-results {
	position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0;
	background: var(--cmx-bg); border: 1px solid var(--cmx-border);
	border-radius: var(--cmx-radius); box-shadow: 0 12px 32px rgba(16,24,40,.12);
	overflow: hidden; max-height: 380px; overflow-y: auto;
}
.cmx-search-item {
	display: flex; align-items: center; gap: 12px; width: 100%;
	padding: 10px 14px; border: 0; background: none; cursor: pointer;
	text-align: left; font: inherit; color: var(--cmx-text);
}
.cmx-search-item:hover:not([disabled]) { background: var(--cmx-surface); }
.cmx-search-item[disabled] { opacity: .5; cursor: default; }
.cmx-search-item img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: var(--cmx-surface); flex: 0 0 44px; }
.cmx-search-name { flex: 1; font-weight: 600; font-size: .95rem; }
.cmx-search-price { font-size: .85rem; color: var(--cmx-muted); white-space: nowrap; }
.cmx-search-added { font-size: .75rem; color: var(--cmx-green); font-weight: 700; }
.cmx-search-empty { padding: 16px; color: var(--cmx-muted); font-size: .92rem; text-align: center; }

/* ---------- Selección ---------- */
.cmx-selected { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 40px; margin-bottom: 12px; }
.cmx-hint { color: var(--cmx-muted); font-size: .9rem; }
.cmx-chip {
	display: inline-flex; align-items: center; gap: 8px;
	background: var(--cmx-surface); border: 1px solid var(--cmx-border);
	border-radius: 999px; padding: 5px 8px 5px 5px; font-size: .88rem; font-weight: 600;
}
.cmx-chip img { width: 30px; height: 30px; object-fit: contain; border-radius: 50%; background: #fff; }
.cmx-chip-remove {
	border: 0; background: var(--cmx-border); color: var(--cmx-text);
	width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
	font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.cmx-chip-remove:hover { background: var(--cmx-red); color: #fff; }

/* ---------- Botones ---------- */
.cmx-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 26px; flex-wrap: wrap; }
.cmx-btn {
	display: inline-block; padding: 12px 26px; border-radius: 999px;
	font-weight: 700; font-size: .95rem; cursor: pointer; border: 2px solid transparent;
	text-decoration: none; text-align: center; transition: transform .1s, box-shadow .15s;
	font-family: inherit;
}
.cmx-btn:hover { transform: translateY(-1px); }
.cmx-btn-primary {
	background: var(--cmx-cta); color: #fff !important;
	box-shadow: 0 8px 24px rgba(255, 46, 99, .35);
}
.cmx-btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.cmx-btn-ghost { background: transparent; color: var(--cmx-accent) !important; border-color: var(--cmx-accent); }
.cmx-btn-wa { background: #25d366; color: #fff !important; box-shadow: 0 8px 24px rgba(37, 211, 102, .3); }

/* ---------- Veredicto ---------- */
.cmx-verdict {
	/* Gradiente del hero de Miphone */
	background: linear-gradient(125deg, var(--cmx-dark) 0%, var(--cmx-accent) 55%, var(--cmx-cta) 130%);
	color: #fff; border-radius: var(--cmx-radius); padding: 22px 24px; margin-bottom: 22px;
}
.cmx-verdict h3 { margin: 0 0 10px; color: #fff; font-size: 1.15rem; }
.cmx-verdict ul { margin: 0; padding-left: 20px; }
.cmx-verdict li { margin-bottom: 6px; font-size: .97rem; line-height: 1.45; }

/* ---------- Cards ---------- */
.cmx-cards { display: grid; gap: 14px; margin-bottom: 24px; grid-template-columns: repeat(2, 1fr); }
.cmx-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cmx-cols-4 { grid-template-columns: repeat(4, 1fr); }
.cmx-card {
	background: var(--cmx-bg); border: 1px solid var(--cmx-border);
	border-radius: var(--cmx-radius); padding: 16px; text-align: center;
	display: flex; flex-direction: column; gap: 8px;
}
.cmx-card-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.cmx-badge {
	background: color-mix(in srgb, var(--cmx-accent) 12%, #fff);
	color: var(--cmx-accent); font-size: .7rem; font-weight: 800;
	padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em;
}
.cmx-badge-verified { background: #ecfdf3; color: #067647; }
.cmx-card-img { width: 100%; max-height: 170px; object-fit: contain; }
.cmx-card-name { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.3; }
.cmx-card-price { font-size: 1.05rem; font-weight: 800; color: var(--cmx-accent); }
.cmx-card-price del { color: var(--cmx-muted); font-weight: 400; font-size: .85rem; }
.cmx-card-price small { color: var(--cmx-muted); font-weight: 400; }
.cmx-stock { font-size: .78rem; font-weight: 700; }
.cmx-stock-in { color: var(--cmx-green); }
.cmx-stock-out { color: var(--cmx-red); }
.cmx-card-score { border-radius: 10px; padding: 8px; font-size: .78rem; font-weight: 600; }
.cmx-card-score strong { font-size: 1.35rem; }
.cmx-score-high { background: #ecfdf3; color: #067647; }
.cmx-score-mid { background: #fffaeb; color: #b54708; }
.cmx-score-low { background: #fef3f2; color: #b42318; }
.cmx-card-meta { font-size: .78rem; color: var(--cmx-muted); margin: 0; }
.cmx-warning {
	background: #fffaeb; border: 1px solid #fedf89; color: #93370d;
	font-size: .78rem; border-radius: 8px; padding: 7px 9px; margin: 0; text-align: left;
}
.cmx-card-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.cmx-card-actions .cmx-btn { padding: 10px 14px; font-size: .88rem; }

/* ---------- Secciones colapsables ---------- */
.cmx-section {
	border: 1px solid var(--cmx-border); border-radius: var(--cmx-radius);
	margin-bottom: 12px; overflow: hidden; background: var(--cmx-bg);
}
.cmx-section-toggle {
	width: 100%; display: flex; justify-content: space-between; align-items: center;
	padding: 15px 18px; background: var(--cmx-surface); border: 0; cursor: pointer;
	font: inherit; font-weight: 700; font-size: 1rem; color: var(--cmx-text);
}
.cmx-caret { width: 9px; height: 9px; border-right: 2px solid var(--cmx-muted); border-bottom: 2px solid var(--cmx-muted); transform: rotate(45deg); transition: transform .15s; }
.cmx-section.is-open .cmx-caret { transform: rotate(-135deg); }
.cmx-section-body { display: none; padding: 14px; }
.cmx-section.is-open .cmx-section-body { display: block; }

/* ---------- Tabla ---------- */
.cmx-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cmx-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 520px; }
.cmx-table th, .cmx-table td { padding: 10px 12px; border-bottom: 1px solid var(--cmx-border); text-align: left; vertical-align: top; }
.cmx-table thead th { font-size: .82rem; color: var(--cmx-muted); font-weight: 700; position: sticky; top: 0; background: var(--cmx-bg); }
.cmx-table tbody th { font-weight: 600; color: var(--cmx-muted); font-size: .84rem; width: 180px; }
.cmx-cell-best { background: #f0fdf4; }
.cmx-best-tag { font-size: .68rem; font-weight: 800; color: var(--cmx-green); text-transform: uppercase; }
.cmx-yes { color: var(--cmx-green); font-weight: 700; }
.cmx-no { color: var(--cmx-red); font-weight: 700; }
.cmx-nodata { color: #cbd5e1; }
.cmx-note { font-size: .82rem; color: var(--cmx-muted); margin: 12px 4px 0; }

/* Barras de score */
.cmx-bar { background: var(--cmx-surface); border-radius: 999px; height: 8px; overflow: hidden; margin-bottom: 4px; min-width: 90px; }
.cmx-bar-fill { height: 100%; border-radius: 999px; }
.cmx-bar-fill.cmx-score-high { background: var(--cmx-green); }
.cmx-bar-fill.cmx-score-mid { background: var(--cmx-amber); }
.cmx-bar-fill.cmx-score-low { background: var(--cmx-red); }
.cmx-bar-num { font-weight: 700; font-size: .85rem; }

/* ---------- Pros y contras ---------- */
.cmx-proscons { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.cmx-proscons.cmx-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cmx-proscons.cmx-cols-4 { grid-template-columns: repeat(4, 1fr); }
.cmx-proscons-col h5 { margin: 0 0 8px; font-size: .92rem; }
.cmx-proscons-col ul { list-style: none; margin: 0; padding: 0; }
.cmx-proscons-col li { font-size: .85rem; margin-bottom: 5px; line-height: 1.4; }
.cmx-pro { color: #067647; }
.cmx-con { color: #b42318; }

/* ---------- Footer CTA ---------- */
.cmx-footer-cta { text-align: center; margin: 24px 0; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ---------- Asistente de recomendación ---------- */
.cmx-wizard {
	max-width: 720px; margin: 0 auto 26px;
	border: 1px solid var(--cmx-border); border-radius: var(--cmx-radius);
	background: var(--cmx-surface); padding: 0;
}
.cmx-wizard summary {
	cursor: pointer; font-weight: 700; padding: 15px 18px;
	color: var(--cmx-accent); list-style-position: inside;
}
.cmx-wizard-form { padding: 4px 18px 16px; }
.cmx-wizard-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.cmx-wizard-grid label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; }
.cmx-wizard-grid select, .cmx-wizard-grid input[type="text"] {
	padding: 9px 12px; border: 1px solid var(--cmx-border); border-radius: 8px;
	font: inherit; font-weight: 400; background: var(--cmx-bg); color: var(--cmx-text);
}
.cmx-wizard-checks { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.cmx-wizard-checks label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }

.cmx-reco-list { display: flex; flex-direction: column; gap: 12px; padding: 0 18px 18px; }
.cmx-reco { background: var(--cmx-bg); border: 1px solid var(--cmx-border); border-radius: 12px; padding: 14px; }
.cmx-reco-top { border-color: var(--cmx-accent); box-shadow: 0 4px 16px rgba(91, 0, 170, .12); }
.cmx-reco-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cmx-reco-head img { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: var(--cmx-surface); flex: 0 0 56px; }
.cmx-reco-head > div:nth-child(2) { flex: 1; }
.cmx-reco-name { font-weight: 700; color: var(--cmx-text) !important; text-decoration: none; font-size: .95rem; }
.cmx-reco-price { font-weight: 700; color: var(--cmx-accent); font-size: .9rem; }
.cmx-reco-price del { color: var(--cmx-muted); font-weight: 400; font-size: .8rem; }
.cmx-reco-match { border-radius: 10px; padding: 6px 10px; font-size: .72rem; font-weight: 600; text-align: center; }
.cmx-reco-match strong { font-size: 1.1rem; display: block; }
.cmx-reco-reasons { list-style: none; margin: 0 0 10px; padding: 0; }
.cmx-reco-reasons li { font-size: .85rem; margin-bottom: 4px; }
.cmx-reco-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cmx-reco-actions .cmx-btn { padding: 9px 16px; font-size: .85rem; }

/* ---------- Rankings SEO ---------- */
.cmx-ranking-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.cmx-ranking-item {
	display: flex; align-items: center; gap: 14px;
	border: 1px solid var(--cmx-border); border-radius: 12px;
	padding: 12px 16px; margin-bottom: 10px; background: var(--cmx-bg);
}
.cmx-ranking-pos {
	width: 34px; height: 34px; border-radius: 50%; background: var(--cmx-accent);
	color: #fff; font-weight: 800; display: inline-flex; align-items: center;
	justify-content: center; flex: 0 0 34px;
}
.cmx-ranking-item img { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: var(--cmx-surface); flex: 0 0 56px; }
.cmx-ranking-info { flex: 1; }
.cmx-ranking-name { font-weight: 700; color: var(--cmx-text) !important; text-decoration: none; }
.cmx-ranking-price { color: var(--cmx-accent); font-weight: 700; font-size: .9rem; }
.cmx-ranking-price del { color: var(--cmx-muted); font-weight: 400; font-size: .8rem; }
.cmx-ranking-score { font-size: .8rem; color: var(--cmx-muted); white-space: nowrap; }
.cmx-ranking-score strong { font-size: 1.15rem; color: var(--cmx-text); }

/* ---------- Estados ---------- */
.cmx-loading, .cmx-error { text-align: center; padding: 32px; color: var(--cmx-muted); font-size: .95rem; }
.cmx-error { color: var(--cmx-red); }

/* ---------- Móvil ---------- */
@media (max-width: 760px) {
	.cmx-title { font-size: 1.35rem; }
	.cmx-cards, .cmx-cols-3, .cmx-cols-4 { grid-template-columns: repeat(2, 1fr); }
	.cmx-card { padding: 10px; }
	.cmx-card-img { max-height: 110px; }
	.cmx-card-name { font-size: .85rem; }
	.cmx-card-price { font-size: .92rem; }
	.cmx-proscons, .cmx-proscons.cmx-cols-3, .cmx-proscons.cmx-cols-4 { grid-template-columns: 1fr; }
	.cmx-table tbody th { width: 110px; font-size: .78rem; }
	.cmx-table th, .cmx-table td { padding: 8px; font-size: .82rem; }
	.cmx-wizard-grid { grid-template-columns: 1fr; }
	.cmx-ranking-item { flex-wrap: wrap; }
}
