/* ==========================================================================
   Movilízatic — Calculadora de fraude de clics (48 plataformas)
   --------------------------------------------------------------------------
   Sustituye al antiguo simulador de tres campos dentro de
   proteccion-anti-fraude-publicitario.html (#simulador).

   Todo va con prefijo `.cf-` para no colisionar nunca con css/style.css.
   Reutiliza los tokens del sitio (colores, radios, sombras y tipografías),
   así que no redefine variables globales ni duplica el sistema de diseño.

   El cálculo lo hace js/calculadora-fraude.js en el navegador. No hay
   peticiones de red, ni cookies, ni almacenamiento: cada visita empieza limpia.
   ========================================================================== */

.cf {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 20px;
    align-items: start;
    margin-top: 8px;
}

/* ---------- Panel ---------- */
.cf-panel {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface-solid, #FFFFFF);
    box-shadow: var(--sh-sm);
    padding: 20px;
}

.cf-panel--result {
    position: sticky;
    top: 92px;
}

.cf-panel__title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 16px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.cf-panel__title i { color: var(--brand-600); font-size: 11px; }

/* ---------- Bloques de control ---------- */
.cf-block { margin-bottom: 22px; }
.cf-block:last-child { margin-bottom: 0; }

.cf-block__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.cf-block__name {
    font-family: var(--font-display);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.cf-block__value {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--brand-700);
    white-space: nowrap;
}

.cf-block__hint {
    font-size: 11.8px;
    line-height: 1.45;
    color: var(--text-dim);
    margin: 0 0 10px;
}

/* ---------- Buscador de plataformas ---------- */
.cf-search {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.cf-search input {
    width: 100%;
    padding: 9px 34px 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: #FFFFFF;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text);
}

.cf-search input:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px rgba(5, 136, 236, 0.14);
}

.cf-search__clear {
    position: absolute;
    right: 6px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 12px;
}

.cf-search__clear:hover { background: rgba(5, 136, 236, 0.10); color: var(--brand-800); }

/* ---------- Lista de plataformas ---------- */
.cf-plats {
    max-height: 260px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 4px;
    background: #FFFFFF;
}

.cf-group + .cf-group { margin-top: 8px; }

.cf-group__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px 4px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.cf-group__hint {
    font-family: var(--font-sans);
    font-size: 9.5px;
    letter-spacing: 0;
    text-transform: none;
    opacity: 0.8;
}

.cf-plat {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 12.8px;
    color: var(--text-soft);
    text-align: left;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}

.cf-plat:hover { background: rgba(5, 136, 236, 0.07); color: var(--text); }

.cf-plat[aria-pressed="true"] {
    background: rgba(5, 136, 236, 0.12);
    color: var(--brand-900);
    font-weight: 600;
}

.cf-plat__box {
    flex: none;
    width: 15px;
    height: 15px;
    border: 1.5px solid var(--line-strong);
    border-radius: 4px;
    display: grid;
    place-items: center;
    font-size: 8px;
    color: transparent;
}

.cf-plat[aria-pressed="true"] .cf-plat__box {
    border-color: var(--brand-500);
    background: var(--brand-500);
    color: #FFFFFF;
}

.cf-plat__name { flex: 1 1 auto; min-width: 0; }

.cf-plat__rate {
    flex: none;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-dim);
}

.cf-plat[aria-pressed="true"] .cf-plat__rate { color: var(--brand-700); }

.cf-plat-empty {
    padding: 14px 8px;
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
}

/* ---------- Selector de sector ---------- */
.cf-sectors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cf-sector {
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #FFFFFF;
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text-soft);
    cursor: pointer;
    transition: all var(--t-fast);
}

.cf-sector:hover { border-color: var(--brand-400); color: var(--brand-800); }

.cf-sector[aria-pressed="true"] {
    border-color: transparent;
    background: var(--grad-brand, var(--brand-600));
    color: #FFFFFF;
    font-weight: 600;
}

/* ---------- Campos y rangos ---------- */
.cf-field { display: grid; gap: 8px; }

.cf-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.cf-input-wrap input[type="number"],
.cf-input-wrap select {
    width: 100%;
    padding: 9px 44px 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: #FFFFFF;
    font-family: var(--font-sans);
    font-size: 13.5px;
    color: var(--text);
    -moz-appearance: textfield;
}

.cf-input-wrap select { padding-right: 11px; }

.cf-input-wrap input[type="number"]::-webkit-outer-spin-button,
.cf-input-wrap input[type="number"]::-webkit-inner-spin-button { margin-left: 4px; }

.cf-input-wrap input:focus,
.cf-input-wrap select:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px rgba(5, 136, 236, 0.14);
}

.cf-affix {
    position: absolute;
    right: 11px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-dim);
    pointer-events: none;
}

.cf-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    background: transparent;
    cursor: pointer;
}

.cf-range::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-500) var(--cf-fill, 50%), var(--line) var(--cf-fill, 50%));
}

.cf-range::-moz-range-track {
    height: 5px;
    border-radius: 999px;
    background: var(--line);
}

.cf-range::-moz-range-progress {
    height: 5px;
    border-radius: 999px;
    background: var(--brand-500);
}

.cf-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 17px;
    height: 17px;
    margin-top: -6px;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    background: var(--brand-600);
    box-shadow: 0 1px 4px rgba(4, 38, 63, 0.35);
}

.cf-range::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    background: var(--brand-600);
    box-shadow: 0 1px 4px rgba(4, 38, 63, 0.35);
}

.cf-range:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 3px; }

/* ---------- Resultado principal ---------- */
.cf-hero {
    padding: 18px 20px;
    border-radius: var(--r-md, 14px);
    background: linear-gradient(160deg, rgba(4, 38, 63, 0.97), rgba(4, 18, 31, 0.99));
    color: #FFFFFF;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

.cf-hero::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(5, 136, 236, 0.9), transparent);
}

.cf-hero__label {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--text-soft-on-dark, #B7CFE0);
    margin: 0 0 6px;
}

.cf-hero__value {
    font-family: var(--font-display);
    font-size: clamp(30px, 4.4vw, 40px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.cf-hero__sub {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--text-soft-on-dark, #B7CFE0);
    line-height: 1.5;
}

/* ---------- Barra proporcional ---------- */
.cf-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
    margin-bottom: 8px;
}

.cf-bar__fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-500), var(--rose, #FB7185));
    transition: width 0.35s ease;
}

.cf-bar__txt {
    font-size: 11.5px;
    color: var(--text-dim);
    margin: 0 0 16px;
}

/* ---------- Lista de cifras ---------- */
.cf-list {
    display: grid;
    gap: 9px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.cf-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--text-soft);
}

.cf-list li:last-child { border-bottom: 0; padding-bottom: 0; }

.cf-list strong {
    font-family: var(--font-mono);
    font-size: 13.5px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cf-list .is-good { color: var(--mint-text, #0B7A57); }
.cf-list .is-bad { color: var(--rose-text, #B3123A); }

/* ---------- Tabla de desglose ---------- */
.cf-table-wrap { overflow-x: auto; margin-bottom: 14px; }

.cf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.cf-table th {
    padding: 0 0 8px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: right;
    white-space: nowrap;
}

.cf-table th:first-child,
.cf-table td:first-child { text-align: left; }

.cf-table td {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    text-align: right;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cf-table tr:last-child td { border-bottom: 0; }

.cf-table td:first-child {
    color: var(--text);
    font-weight: 600;
    white-space: normal;
}

.cf-table tfoot td {
    border-top: 1px solid var(--line-strong);
    border-bottom: 0;
    font-weight: 700;
    color: var(--text);
}

/* ---------- Escenarios ---------- */
.cf-scen {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.cf-scen__card {
    padding: 11px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: rgba(233, 241, 249, 0.45);
    text-align: center;
}

.cf-scen__card[data-active="true"] {
    border-color: var(--brand-400);
    background: rgba(5, 136, 236, 0.09);
}

.cf-scen__name {
    display: block;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 5px;
}

.cf-scen__rate {
    display: block;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.cf-scen__loss {
    display: block;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--brand-700);
    margin-top: 4px;
}

/* ---------- Acciones ---------- */
.cf-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.cf-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: #FFFFFF;
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand-800);
    cursor: pointer;
    transition: all var(--t-fast);
}

.cf-btn:hover {
    border-color: rgba(5, 136, 236, 0.5);
    background: rgba(5, 136, 236, 0.08);
}

.cf-btn--primary {
    border-color: transparent;
    background: var(--grad-brand, var(--brand-600));
    color: #FFFFFF;
}

.cf-btn--primary:hover { filter: brightness(1.06); background: var(--grad-brand, var(--brand-600)); }

.cf-btn i { font-size: 11px; }

/* ---------- Nota del modelo ---------- */
.cf-note {
    margin-top: 16px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand-400);
    border-radius: var(--r-sm);
    background: rgba(233, 241, 249, 0.5);
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-soft);
}

.cf-note strong { display: block; margin-bottom: 3px; color: var(--text); }

/* ---------- Aviso cuando no hay plataformas ---------- */
.cf-empty {
    padding: 22px 18px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md, 14px);
    text-align: center;
    font-size: 12.8px;
    line-height: 1.6;
    color: var(--text-dim);
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .cf { grid-template-columns: minmax(0, 1fr); }
    .cf-panel--result { position: static; }
    .cf-plats { max-height: 220px; }
}

@media (max-width: 560px) {
    .cf-panel { padding: 16px; }
    .cf-scen { grid-template-columns: minmax(0, 1fr); }
    .cf-hero { padding: 16px; }
    .cf-table { font-size: 11.8px; }
    .cf-actions .cf-btn { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .cf-bar__fill { transition: none; }
}

/* ==========================================================================
   BLOQUE DE AUDITORÍA GRATUITA
   --------------------------------------------------------------------------
   La calculadora NO pide datos para funcionar: este bloque es una petición
   voluntaria de informe, no un muro. Por eso vive debajo del resultado y no
   lo tapa.
   ========================================================================== */

.cf-audit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 20px;
    align-items: start;
    margin-top: 16px;
    padding: 20px;
    border: 1px solid rgba(5, 136, 236, 0.28);
    border-radius: var(--r-lg);
    background: linear-gradient(165deg, #F7FBFF 0%, #EDF6FD 100%);
}

.cf-audit__eyebrow {
    display: inline-block;
    margin-bottom: 11px;
    padding: 4px 10px;
    border: 1px solid rgba(5, 136, 236, 0.22);
    border-radius: var(--r-pill);
    background: rgba(5, 136, 236, 0.10);
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--brand-700);
}

.cf-audit__title {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.32;
    color: var(--text);
}

.cf-audit__intro p {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-soft);
}

.cf-audit__list {
    display: grid;
    gap: 7px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
}

.cf-audit__list li {
    display: flex;
    gap: 8px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-soft);
}

.cf-audit__list i {
    flex: none;
    margin-top: 3px;
    font-size: 11px;
    color: var(--mint-text, #0B7A57);
}

/* ---------- Formulario ---------- */
.cf-audit__form { display: grid; gap: 11px; }

.cf-audit__field { display: grid; gap: 5px; }

.cf-audit__field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.cf-audit__field input[type="text"],
.cf-audit__field input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: #FFFFFF;
    font-family: var(--font-sans);
    font-size: 13.5px;
    color: var(--text);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.cf-audit__field input:focus-visible {
    outline: 2px solid var(--brand-400);
    outline-offset: 1px;
    border-color: var(--brand-400);
}

.cf-audit__field input[aria-invalid="true"] { border-color: var(--rose-text, #B3123A); }

.cf-audit__error {
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--rose-text, #B3123A);
}

.cf-audit__error:empty { display: none; }

.cf-audit__consent {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    font-size: 11.8px;
    line-height: 1.55;
    color: var(--text-soft);
    cursor: pointer;
}

.cf-audit__consent input {
    flex: none;
    margin-top: 2px;
    accent-color: var(--brand-600);
}

.cf-audit__consent a { color: var(--brand-700); }

.cf-audit__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 3px;
}

.cf-audit__note {
    display: flex;
    gap: 6px;
    margin: 0;
    font-size: 11px;
    line-height: 1.55;
    color: var(--text-dim);
}

.cf-audit__note i { flex: none; margin-top: 2px; }

.cf-audit__ok {
    padding: 13px 15px;
    border: 1px solid rgba(11, 122, 87, 0.35);
    border-radius: var(--r-sm);
    background: rgba(11, 122, 87, 0.08);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--mint-text, #0B7A57);
}

.cf-audit__ok strong { display: block; margin-bottom: 3px; }
.cf-audit__ok p { margin: 0; }
.cf-audit__ok a { color: var(--mint-text, #0B7A57); text-decoration: underline; }

/* Honeypot: invisible para las personas, no ocupa hueco en la rejilla. */
.cf-audit .hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 960px) {
    .cf-audit {
        grid-template-columns: minmax(0, 1fr);
        padding: 16px;
    }
}

@media (max-width: 560px) {
    .cf-audit__actions .cf-btn { flex: 1 1 100%; justify-content: center; }
    .cf-audit__title { font-size: 1.05rem; }
}
