/**
 * Overlay de carga con la bombilla Olipep · Olipep Innovación, S.L.
 *
 * Se usa igual en el formulario público y en el panel. La bombilla se "enciende"
 * de abajo arriba recortando la versión iluminada sobre la apagada, así que el
 * logotipo real se mantiene intacto.
 */

.coi-overlay {
    --coi-primary: #526B70;
    --coi-accent: #00ADB7;

    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 50% 45%, rgba(82, 107, 112, .82) 0%, rgba(24, 34, 36, .92) 100%);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
    -webkit-backdrop-filter: blur(5px) saturate(120%);
    backdrop-filter: blur(5px) saturate(120%);
}

.coi-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.coi-overlay__card {
    position: relative;
    width: min(370px, 100%);
    padding: 34px 34px 30px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fff 0%, #f6fafb 100%);
    box-shadow:
        0 40px 80px -30px rgba(10, 18, 20, .6),
        0 0 0 1px rgba(255, 255, 255, .5) inset;
    text-align: center;
    transform: translateY(14px) scale(.97);
    transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}

.coi-overlay.is-visible .coi-overlay__card {
    transform: translateY(0) scale(1);
}

/* Filo superior con el degradado de marca. */
.coi-overlay__card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 26px;
    right: 26px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, transparent, var(--coi-accent), transparent);
}

/* ------------------------------------------------------------------ bulb */

.coi-bulb {
    position: relative;
    display: inline-block;
    width: 78px;
    height: 120px;
    margin-bottom: 20px;
}

.coi-bulb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Bombilla apagada: siempre visible, sirve de silueta. */
.coi-bulb__dim {
    filter: grayscale(1) opacity(.26);
}

/* Bombilla encendida: se revela de abajo arriba. */
.coi-bulb__lit {
    animation: coi-charge 1.9s cubic-bezier(.45, .05, .35, 1) infinite;
    filter: drop-shadow(0 0 9px rgba(0, 173, 183, .75));
    clip-path: inset(100% 0 0 0);
}

/* Halo que respira detrás de la bombilla. */
.coi-bulb__glow {
    position: absolute;
    top: 4px;
    left: 50%;
    width: 116px;
    height: 116px;
    margin-left: -58px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 173, 183, .34) 0%, rgba(0, 173, 183, 0) 68%);
    animation: coi-breathe 1.9s ease-in-out infinite;
    pointer-events: none;
}

/* Anillo que gira, para que se note que sigue trabajando. */
.coi-bulb::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 132px;
    height: 132px;
    margin: -66px 0 0 -66px;
    border: 2px solid transparent;
    border-top-color: var(--coi-accent);
    border-right-color: rgba(0, 173, 183, .28);
    border-radius: 50%;
    animation: coi-spin 1.15s linear infinite;
}

@keyframes coi-charge {
    0%   { clip-path: inset(100% 0 0 0); }
    45%  { clip-path: inset(0 0 0 0); }
    72%  { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(100% 0 0 0); }
}

@keyframes coi-breathe {
    0%, 100% { opacity: .35; transform: scale(.9); }
    50%      { opacity: 1;   transform: scale(1.06); }
}

@keyframes coi-spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ text */

.coi-overlay__title {
    margin: 0 0 6px;
    color: var(--coi-primary);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.3;
}

.coi-overlay__hint {
    margin: 0 0 20px;
    color: #7c8c90;
    font-size: .86rem;
    line-height: 1.45;
}

/* -------------------------------------------------------------- progress */

.coi-progress {
    position: relative;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4ecee;
    box-shadow: 0 1px 2px rgba(31, 42, 45, .12) inset;
}

.coi-progress__bar {
    position: relative;
    width: 6%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--coi-primary) 0%, var(--coi-accent) 100%);
    transition: width .45s cubic-bezier(.22, 1, .36, 1);
}

/* Brillo que barre la barra mientras avanza. */
.coi-progress__bar::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(
        100deg,
        transparent 0%,
        rgba(255, 255, 255, .55) 45%,
        rgba(255, 255, 255, .85) 50%,
        rgba(255, 255, 255, .55) 55%,
        transparent 100%
    );
    background-size: 220% 100%;
    animation: coi-sweep 1.25s linear infinite;
}

@keyframes coi-sweep {
    from { background-position: -120% 0; }
    to   { background-position: 220% 0; }
}

.coi-overlay__brand {
    margin: 16px 0 0;
    color: #9aa8ab;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

/* ------------------------------------------------- bombilla en pequeño */

.coi-bulb--inline {
    width: 17px;
    height: 26px;
    margin: 0 6px -6px 0;
    vertical-align: baseline;
}

.coi-bulb--inline::after {
    display: none;
}

.coi-bulb--inline .coi-bulb__glow {
    top: 0;
    width: 30px;
    height: 30px;
    margin-left: -15px;
}

/* --------------------------------------------------- movimiento reducido */

@media (prefers-reduced-motion: reduce) {
    .coi-bulb__lit {
        animation: none;
        clip-path: inset(0 0 0 0);
    }

    .coi-bulb__glow,
    .coi-bulb::after,
    .coi-progress__bar::after {
        animation: none;
    }

    .coi-overlay,
    .coi-overlay__card,
    .coi-progress__bar {
        transition: none;
    }
}
