/* =========================================================
   Modal vHost · Indecentes style (FIX + PROGRESS GLOW)
========================================================= */

/* Base modal */
#vhostModal.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;

    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(0px);

    align-items: center;
    justify-content: center;
    padding: 18px;

    opacity: 0;
    transition: opacity .35s ease, backdrop-filter .35s ease;
}

#vhostModal.modal.is-open {
    display: flex;
    opacity: 1;
    backdrop-filter: blur(8px);
}

/* Backdrop */
#vhostModal .modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 99998;
    background:
        radial-gradient(900px 500px at 20% 10%, rgba(255, 46, 166, .18), transparent 55%),
        radial-gradient(800px 450px at 80% 15%, rgba(34, 211, 238, .14), transparent 60%),
        rgba(0, 0, 0, .72);
}

/* Panel */
.vhost-panel {
    position: relative;
    z-index: 100000;

    width: min(560px, 92vw);
    max-height: calc(100vh - 36px);
    overflow: auto;

    padding: 20px 20px 16px;
    border-radius: 26px;

    background:
        radial-gradient(1100px 420px at 10% 10%, rgba(255, 46, 166, .18), transparent 55%),
        radial-gradient(900px 360px at 90% 12%, rgba(34, 211, 238, .16), transparent 60%),
        rgba(10, 12, 20, .88);

    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow:
        0 18px 60px rgba(0, 0, 0, .62),
        0 0 40px rgba(34, 211, 238, .10);

    color: rgba(255, 255, 255, .92);

    transform: translateY(30px) scale(.96);
    opacity: 0;
    animation: vhostEnter .45s cubic-bezier(.2, .8, .2, 1) forwards;
}

@keyframes vhostEnter {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(.96);
    }

    60% {
        opacity: 1;
        transform: translateY(-4px) scale(1.01);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Botón cerrar */
.vhost-x {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;

    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .85);
    font-size: 22px;

    cursor: pointer;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.vhost-x:hover {
    background: rgba(255, 255, 255, .10);
    transform: scale(1.04);
    box-shadow: 0 0 18px rgba(255, 46, 166, .14);
}

.vhost-x:active {
    transform: scale(.98);
}

/* Títulos */
.vhost-title {
    margin: 4px 0 6px;
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: .6px;

    display: flex;
    align-items: center;
    gap: 10px;
}

.vhost-sub {
    margin: 0 0 18px;
    font-size: .95rem;
    color: rgba(255, 255, 255, .78);
    line-height: 1.4;
}

/* =========================
   FORM LAYOUT (FIX DESORDEN)
   ========================= */

.vhost-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* grid de campos */
.vhost-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.vhost-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: .88rem;
    color: rgba(255, 255, 255, .80);
}

/* Inputs */
.vhost-input {
    padding: 12px 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(0, 0, 0, .32);
    color: #fff;
    outline: none;

    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.vhost-input::placeholder {
    color: rgba(255, 255, 255, .45);
}

.vhost-input:focus {
    border-color: rgba(255, 46, 166, .45);
    box-shadow: 0 0 0 3px rgba(255, 46, 166, .16);
    transform: translateY(-1px);
}

/* Hint */
.vhost-hint {
    margin-top: -4px;
    font-size: .82rem;
    color: rgba(255, 255, 255, .66);
}

/* Botón */
.vhost-btn {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: linear-gradient(135deg, rgba(255, 46, 166, .30), rgba(251, 146, 60, .22));
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}

.vhost-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 0 18px rgba(255, 46, 166, .18);
}

.vhost-btn:active {
    transform: scale(.99);
}

.vhost-btn.is-ok {
    background: linear-gradient(135deg, rgba(34, 197, 94, .35), rgba(16, 185, 129, .25));
    border-color: rgba(34, 197, 94, .35);
}

.vhost-btn.is-busy {
    opacity: .85;
    cursor: wait;
}

/* Mensaje */
.vhost-msg {
    min-height: 22px;
    padding-top: 2px;
    font-size: .92rem;
    color: rgba(255, 255, 255, .85);
}

/* Footer chips */
.vhost-footer {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.vhost-badge {
    font-size: .78rem;
    padding: 6px 10px;
    border-radius: 999px;
    color: rgba(255, 255, 255, .76);
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .06);
}

/* Honeypot */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* =========================
   CONSENTIMIENTO (con glow progresivo)
   ========================= */

.inde-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 6px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg,
            rgba(255, 46, 166, .10),
            rgba(34, 211, 238, .10));
    border: 1px solid rgba(255, 255, 255, .14);
    cursor: pointer;
}

/* ocultamos checkbox real */
.inde-consent input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* checkbox visual */
.inde-consent .checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, .45);
    background: rgba(0, 0, 0, .42);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: box-shadow .25s ease, border-color .25s ease, background .25s ease, transform .25s ease;
}

.inde-consent:hover .checkmark {
    transform: translateY(-1px);
}

/* checked */
.inde-consent input:checked+.checkmark::after {
    content: "✓";
    color: #000;
    font-weight: 900;
    font-size: 14px;
}

/* texto */
.inde-consent .consent-text {
    color: rgba(255, 255, 255, .88);
    font-size: .85rem;
    line-height: 1.35;
}

.inde-consent .consent-text a {
    color: #ff2ea6;
    font-weight: 700;
    text-decoration: none;
}

.inde-consent .consent-text a:hover {
    color: #fb923c;
    text-decoration: underline;
}

/* ====== estados progresivos ====== */

/* 🔴 inicio */
.vhost-consent.state-red .checkmark {
    border-color: rgba(239, 68, 68, .60);
    box-shadow: 0 0 14px rgba(239, 68, 68, .45);
}

/* 🟠 nick OK */
.vhost-consent.state-orange .checkmark {
    border-color: rgba(251, 146, 60, .70);
    box-shadow: 0 0 16px rgba(251, 146, 60, .50);
}

/* 🟡 vhost OK */
.vhost-consent.state-yellow .checkmark {
    border-color: rgba(250, 204, 21, .78);
    box-shadow: 0 0 16px rgba(250, 204, 21, .55);
}

/* 🟢 consentimiento OK */
.vhost-consent.state-green .checkmark {
    background: linear-gradient(135deg, rgba(34, 197, 94, .95), rgba(16, 185, 129, .85));
    border-color: transparent;
    box-shadow: 0 0 18px rgba(34, 197, 94, .75);
}

/* Mobile */
@media (max-width: 540px) {
    .vhost-panel {
        padding: 18px 16px 14px;
        border-radius: 22px;
    }

    .vhost-title {
        font-size: 1.3rem;
    }

    .vhost-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== vHost editor (contenteditable) FIX ===== */

.vhost-editor {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(0, 0, 0, .26);
    overflow: hidden;
}

/* toolbar arriba */
.vhost-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px;
    background: rgba(255, 255, 255, .04);
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.vhost-toolbar .tb {
    width: 34px;
    height: 30px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .88);
    cursor: pointer;
    transition: transform .15s ease, background .15s ease;
}

.vhost-toolbar .tb:hover {
    background: rgba(255, 255, 255, .10);
    transform: translateY(-1px);
}

.vhost-toolbar .tb:active {
    transform: scale(.98);
}

.tb-sep {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, .12);
    margin: 0 4px;
}

.vhost-status {
    font-size: .82rem;
    color: rgba(255, 255, 255, .65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* editable abajo: acá estaba el quilombo */
.vhost-editable {
    position: relative;
    /* clave para placeholder */
    min-height: 44px;
    /* para que exista el caret */
    padding: 12px 12px;
    /* aire para escribir */
    outline: none;
    cursor: text;

    color: rgba(255, 255, 255, .95);
    caret-color: #ff2ea6;
    /* caret visible */
    font-weight: 800;
    letter-spacing: .2px;

    /* evita que se “achique” */
    display: block;
    word-break: break-word;
}

/* focus visible */
.vhost-editable:focus {
    box-shadow: 0 0 0 3px rgba(255, 46, 166, .16);
}

/* placeholder cuando está vacío */
.vhost-editable:empty::before {
    content: attr(data-placeholder);
    position: absolute;
    left: 12px;
    top: 12px;
    color: rgba(255, 255, 255, .42);
    font-weight: 700;
    pointer-events: none;
    /* clave: no tapa el click/caret */
}

/* si meten un <br> solo, sigue considerándose vacío */
.vhost-editable:empty:focus::before {
    opacity: .28;
}

/* opcional: si el browser mete <br> al iniciar */
.vhost-editable br {
    display: none;
}

/* =========================================
   GLOW DEL CUADRO (CONSENT) POR ESTADO
   Rojo -> Naranja -> Amarillo -> Verde
========================================= */

/* Base: que el cuadro sea "gloweable" */
.vhost-consent {
    position: relative;
    border: 1px solid rgba(255, 255, 255, .14);
    transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
}

/* Aro exterior (suave) */
.vhost-consent::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    pointer-events: none;
    opacity: .0;
    transition: opacity .25s ease;
}

/* 🔴 RED */
.vhost-consent.state-red {
    border-color: rgba(239, 68, 68, .55);
    box-shadow:
        0 0 0 1px rgba(239, 68, 68, .20),
        0 0 22px rgba(239, 68, 68, .22),
        0 18px 55px rgba(0, 0, 0, .50);
    background: linear-gradient(135deg, rgba(239, 68, 68, .10), rgba(255, 46, 166, .08));
}

.vhost-consent.state-red::before {
    opacity: .55;
    box-shadow:
        0 0 24px rgba(239, 68, 68, .30),
        0 0 60px rgba(239, 68, 68, .12);
}

/* 🟠 ORANGE */
.vhost-consent.state-orange {
    border-color: rgba(251, 146, 60, .60);
    box-shadow:
        0 0 0 1px rgba(251, 146, 60, .22),
        0 0 24px rgba(251, 146, 60, .24),
        0 18px 55px rgba(0, 0, 0, .50);
    background: linear-gradient(135deg, rgba(251, 146, 60, .10), rgba(255, 46, 166, .08));
}

.vhost-consent.state-orange::before {
    opacity: .55;
    box-shadow:
        0 0 26px rgba(251, 146, 60, .30),
        0 0 60px rgba(251, 146, 60, .12);
}

/* 🟡 YELLOW */
.vhost-consent.state-yellow {
    border-color: rgba(250, 204, 21, .65);
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, .22),
        0 0 24px rgba(250, 204, 21, .22),
        0 18px 55px rgba(0, 0, 0, .50);
    background: linear-gradient(135deg, rgba(250, 204, 21, .10), rgba(251, 146, 60, .08));
}

.vhost-consent.state-yellow::before {
    opacity: .55;
    box-shadow:
        0 0 26px rgba(250, 204, 21, .28),
        0 0 60px rgba(250, 204, 21, .12);
}

/* 🟢 GREEN (cuando acepta) */
.vhost-consent.state-green {
    border-color: rgba(34, 197, 94, .65);
    box-shadow:
        0 0 0 1px rgba(34, 197, 94, .22),
        0 0 26px rgba(34, 197, 94, .26),
        0 18px 55px rgba(0, 0, 0, .50);
    background: linear-gradient(135deg, rgba(34, 197, 94, .10), rgba(16, 185, 129, .08));
}

.vhost-consent.state-green::before {
    opacity: .65;
    box-shadow:
        0 0 30px rgba(34, 197, 94, .35),
        0 0 70px rgba(34, 197, 94, .14);
}

/* Bonus: cuando el usuario pasa el mouse, sube un poquito el glow */
.vhost-consent:hover::before {
    opacity: .85;
}

/* Que el checkmark también acompañe (más limpio) */
.vhost-consent.state-red .checkmark {
    box-shadow: 0 0 14px rgba(239, 68, 68, .45);
    border-color: rgba(239, 68, 68, .65);
}

.vhost-consent.state-orange .checkmark {
    box-shadow: 0 0 16px rgba(251, 146, 60, .50);
    border-color: rgba(251, 146, 60, .70);
}

.vhost-consent.state-yellow .checkmark {
    box-shadow: 0 0 16px rgba(250, 204, 21, .55);
    border-color: rgba(250, 204, 21, .78);
}

.vhost-consent.state-green .checkmark {
    box-shadow: 0 0 18px rgba(34, 197, 94, .75);
    border-color: rgba(34, 197, 94, .75);
}

/* Asegura que el glow no se “pierda” */
.vhost-consent {
    position: relative;
    isolation: isolate;
    /* ayuda a que el glow se vea limpio */
}

/* Halo extra (más notorio) */
.vhost-consent::before {
    content: "";
    position: absolute;
    inset: -6px;
    /* más afuera */
    border-radius: 20px;
    pointer-events: none;
    opacity: 0;
    filter: blur(10px);
    /* glow real */
    z-index: -1;
    /* detrás del cuadro */
    transition: opacity .25s ease, background .25s ease;
}

/* Estados: subo intensidades */
.vhost-consent.state-red {
    box-shadow: 0 0 28px rgba(239, 68, 68, .20), 0 0 12px rgba(239, 68, 68, .18);
    border-color: rgba(239, 68, 68, .55);
}

.vhost-consent.state-red::before {
    opacity: .9;
    background: radial-gradient(circle at 30% 30%, rgba(239, 68, 68, .45), transparent 60%);
}

.vhost-consent.state-orange {
    box-shadow: 0 0 30px rgba(251, 146, 60, .22), 0 0 12px rgba(251, 146, 60, .18);
    border-color: rgba(251, 146, 60, .60);
}

.vhost-consent.state-orange::before {
    opacity: .9;
    background: radial-gradient(circle at 30% 30%, rgba(251, 146, 60, .45), transparent 60%);
}

.vhost-consent.state-yellow {
    box-shadow: 0 0 30px rgba(250, 204, 21, .20), 0 0 12px rgba(250, 204, 21, .16);
    border-color: rgba(250, 204, 21, .60);
}

.vhost-consent.state-yellow::before {
    opacity: .9;
    background: radial-gradient(circle at 30% 30%, rgba(250, 204, 21, .40), transparent 60%);
}

.vhost-consent.state-green {
    box-shadow: 0 0 34px rgba(34, 197, 94, .22), 0 0 14px rgba(34, 197, 94, .18);
    border-color: rgba(34, 197, 94, .60);
}

.vhost-consent.state-green::before {
    opacity: 1;
    background: radial-gradient(circle at 30% 30%, rgba(34, 197, 94, .50), transparent 60%);
}

/* opcional: el editor mono */
.vhost-editable.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* =========================================
   CONSENT vHost · Aura visible + estados
   Rojo -> Naranja -> Amarillo -> Verde
========================================= */

.vhost-consent {
    /* base */
    position: relative;
    overflow: visible;
    border-radius: 16px;

    display: flex;
    align-items: flex-start;
    gap: 12px;

    padding: 14px 16px;
    cursor: pointer;

    /* fondo */
    background: linear-gradient(135deg,
            rgba(255, 46, 166, .10),
            rgba(34, 211, 238, .10));
    border: 1px solid rgba(255, 255, 255, .14);

    /* color por estado (default rojo) */
    --glow: 239, 68, 68;
    /* red */
    --glow2: 255, 46, 166;
    /* pink apoyo */

    transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}

/* Aura principal (NO z-index negativo) */
.vhost-consent::before {
    content: "";
    position: absolute;
    inset: -10px;
    /* afuera */
    border-radius: 22px;
    pointer-events: none;

    /* Aura bien notoria */
    background:
        radial-gradient(circle at 30% 35%,
            rgba(var(--glow), .55),
            transparent 62%),
        radial-gradient(circle at 75% 60%,
            rgba(var(--glow2), .20),
            transparent 70%);

    filter: blur(16px);
    opacity: .95;

    /* Clave: detrás del contenido pero dentro del label */
    z-index: 0;
}

/* El contenido va arriba del aura */
.vhost-consent>* {
    position: relative;
    z-index: 1;
}

/* Hover: sube un toque */
.vhost-consent:hover::before {
    filter: blur(18px);
    opacity: 1;
}

/* -----------------------------------------
   Checkbox “invisible” + checkmark visible
----------------------------------------- */
.vhost-consent input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.vhost-consent .checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 6px;

    border: 2px solid rgba(255, 255, 255, .45);
    background: rgba(0, 0, 0, .42);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin-top: 2px;
    transition: transform .18s ease, box-shadow .25s ease, border-color .25s ease, background .25s ease;
}

.vhost-consent:hover .checkmark {
    transform: translateY(-1px);
}

.vhost-consent input:checked+.checkmark {
    background: linear-gradient(135deg, rgba(34, 197, 94, .95), rgba(16, 185, 129, .85));
    border-color: transparent;
    box-shadow: 0 0 18px rgba(34, 197, 94, .55);
}

.vhost-consent input:checked+.checkmark::after {
    content: "✓";
    color: #000;
    font-weight: 900;
    font-size: 14px;
}

/* texto */
.vhost-consent .consent-text {
    color: rgba(255, 255, 255, .88);
    font-size: .85rem;
    line-height: 1.35;
}

.vhost-consent .consent-text a {
    color: #ff2ea6;
    font-weight: 800;
    text-decoration: none;
}

.vhost-consent .consent-text a:hover {
    color: #fb923c;
    text-decoration: underline;
}

/* -----------------------------------------
   Estados: solo cambian variables
----------------------------------------- */
.vhost-consent.state-red {
    --glow: 239, 68, 68;
    /* rojo */
    --glow2: 255, 46, 166;
    border-color: rgba(239, 68, 68, .55);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, .12);
}

.vhost-consent.state-orange {
    --glow: 251, 146, 60;
    /* naranja */
    --glow2: 255, 46, 166;
    border-color: rgba(251, 146, 60, .60);
    box-shadow: 0 0 0 1px rgba(251, 146, 60, .14);
}

.vhost-consent.state-yellow {
    --glow: 250, 204, 21;
    /* amarillo */
    --glow2: 251, 146, 60;
    border-color: rgba(250, 204, 21, .62);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, .14);
}

.vhost-consent.state-green {
    --glow: 34, 197, 94;
    /* verde */
    --glow2: 16, 185, 129;
    border-color: rgba(34, 197, 94, .62);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, .14);
}

/* opcional: el borde del check acompaña el estado (antes de tildar) */
.vhost-consent.state-red .checkmark {
    border-color: rgba(239, 68, 68, .65);
    box-shadow: 0 0 14px rgba(239, 68, 68, .25);
}

.vhost-consent.state-orange .checkmark {
    border-color: rgba(251, 146, 60, .70);
    box-shadow: 0 0 14px rgba(251, 146, 60, .25);
}

.vhost-consent.state-yellow .checkmark {
    border-color: rgba(250, 204, 21, .75);
    box-shadow: 0 0 14px rgba(250, 204, 21, .22);
}

.vhost-consent.state-green .checkmark {
    border-color: rgba(34, 197, 94, .70);
}