/* ALOG Certifica — estilos scopeados bajo .alog-certifica para no chocar con el tema.
   Diseño portado de public/index.php (standalone) con prefijos .alog-*. */

.alog-certifica {
    --alog-primary: #22b14c;
    --alog-primary-dark: #1e9a41;
    --alog-warning: #f5a623;
    --alog-warning-text: #8a5a00;
    --alog-dark: #1d3442;
    --alog-text: #2d3e4b;
    --alog-muted: #6b7a85;
    --alog-border: #e4e8eb;
    --alog-surface: #ffffff;
    --alog-bg: #f6f7f8;
    --alog-success-bg: #e7f7ec;
    --alog-warning-bg: #fff4df;
    --alog-danger-bg: #fde4e4;
    --alog-danger-text: #a32020;
    --alog-radius: 12px;
    --alog-shadow: 0 10px 30px rgba(29, 52, 66, 0.08);

    max-width: 720px;
    margin: 0 auto;
    background: var(--alog-surface);
    padding: 32px;
    border-radius: var(--alog-radius);
    box-shadow: var(--alog-shadow);
    color: var(--alog-text);
    font-family: inherit;
    line-height: 1.6;
}

.alog-certifica *,
.alog-certifica *::before,
.alog-certifica *::after {
    box-sizing: border-box;
}

.alog-certifica__title {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    color: var(--alog-dark);
}

.alog-certifica__lead {
    margin: 0 0 24px;
    color: var(--alog-muted);
    font-size: 15px;
}

.alog-certifica__lead code {
    background: var(--alog-bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--alog-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ─── Form ────────────────────────────────────────────────────────────── */

.alog-form__group {
    margin-bottom: 20px;
}

/* Captcha spacing — con appearance=interaction-only el widget está oculto
   la mayor parte del tiempo. Cuando aparece (challenge), el margen le da aire
   sin romper el layout. */
.alog-form__captcha,
.alog-arco-form__captcha {
    margin: 0 0 16px;
    min-height: 0;
}

.alog-form label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--alog-dark);
}

.alog-form input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--alog-border);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    color: var(--alog-dark);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.alog-form input[type="text"]:focus {
    outline: none;
    border-color: var(--alog-primary);
    box-shadow: 0 0 0 3px rgba(34, 177, 76, 0.15);
}

.alog-form input[aria-invalid="true"] {
    border-color: var(--alog-danger-text);
}

.alog-form__hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--alog-muted);
}

.alog-form__error {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--alog-danger-text);
    font-weight: 500;
}

.alog-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--alog-primary);
    background: var(--alog-primary);
    color: #fff;
    font-family: inherit;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.15s ease;
}

.alog-btn:hover {
    background: var(--alog-primary-dark);
    border-color: var(--alog-primary-dark);
}

.alog-btn:disabled,
.alog-btn.is-loading {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─── Result wrapper (sin resultados / errores) ──────────────────────── */

.alog-result-wrapper {
    margin-top: 28px;
}

.alog-result {
    padding: 28px;
    border-radius: var(--alog-radius);
    border: 1px solid var(--alog-border);
    background: var(--alog-bg);
}

.alog-result--empty {
    background: #fff8f8;
    border-color: #f0c9c9;
}

.alog-result h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--alog-dark);
    margin: 0;
}

.alog-result p {
    margin: 12px 0 0;
    color: var(--alog-text);
}

.alog-result a {
    color: var(--alog-primary);
    font-weight: 600;
}

/* ─── Report (resultado encontrado: diseño del standalone) ────────────── */

.alog-report {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.alog-participant-card {
    background: var(--alog-surface);
    border: 1px solid var(--alog-border);
    border-radius: var(--alog-radius);
    padding: 22px 26px;
    box-shadow: var(--alog-shadow);
}

.alog-participant-card__name {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
    color: var(--alog-dark);
}

.alog-participant-card__meta {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px 16px;
}

.alog-participant-card__meta > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14.5px;
}

.alog-participant-card__meta dt {
    margin: 0;
    color: var(--alog-dark);
    font-weight: 600;
    min-width: 64px;
}

.alog-participant-card__meta dd {
    margin: 0;
    color: var(--alog-text);
    font-weight: 500;
}

.alog-report-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.alog-report-section__title {
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--alog-border);
    font-size: 17px;
    font-weight: 700;
    color: var(--alog-dark);
}

/* Status card (porcentaje + barra horizontal) */
.alog-status-card {
    background: var(--alog-surface);
    border: 1px solid var(--alog-border);
    border-radius: var(--alog-radius);
    padding: 18px 22px;
    box-shadow: var(--alog-shadow);
    text-align: center;
}

.alog-status-card__badge {
    display: inline-block;
    padding: 8px 22px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    background: var(--alog-border);
    color: var(--alog-muted);
}

.alog-status-card__badge--completed {
    background: var(--alog-success-bg);
    color: var(--alog-primary-dark);
}

.alog-status-card__badge--in_progress {
    background: var(--alog-warning-bg);
    color: var(--alog-warning-text);
}

.alog-status-card__badge--pending {
    background: var(--alog-border);
    color: var(--alog-muted);
}

/* Metro stepper — etapas como estaciones conectadas por una línea.
   La línea base (gris) y la línea de progreso (verde) son pseudo-elementos
   del <ol>, posicionados detrás de los círculos. */
.alog-metro {
    --alog-metro-stations: 6;
    --alog-metro-progress: 0%;
    --alog-metro-dot-size: 34px;

    list-style: none;
    margin: 4px 0 0;
    padding: 22px 12px 18px;
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--alog-metro-stations), 1fr);
    gap: 4px;
    background: var(--alog-surface);
    border: 1px solid var(--alog-border);
    border-radius: var(--alog-radius);
    box-shadow: var(--alog-shadow);
}

.alog-metro::before,
.alog-metro::after {
    content: '';
    position: absolute;
    top: calc(22px + var(--alog-metro-dot-size) / 2 - 2px);
    height: 4px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 0;
}

.alog-metro::before {
    left:  calc((100% - 24px) / var(--alog-metro-stations) / 2 + 12px);
    right: calc((100% - 24px) / var(--alog-metro-stations) / 2 + 12px);
    background: var(--alog-border);
}

.alog-metro::after {
    left:  calc((100% - 24px) / var(--alog-metro-stations) / 2 + 12px);
    width: calc(((100% - 24px) - (100% - 24px) / var(--alog-metro-stations)) * var(--alog-metro-progress) / 100);
    background: linear-gradient(90deg, var(--alog-primary), var(--alog-primary-dark));
    transition: width 0.4s ease;
}

.alog-metro__station {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
}

.alog-metro__dot {
    width: var(--alog-metro-dot-size);
    height: var(--alog-metro-dot-size);
    border-radius: 50%;
    background: var(--alog-surface);
    border: 3px solid var(--alog-border);
    color: var(--alog-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.alog-metro__dot svg {
    width: 18px;
    height: 18px;
}

.alog-metro__dot-pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 0 currentColor;
    animation: alog-metro-pulse 1.6s ease-out infinite;
}

@keyframes alog-metro-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.alog-metro__station--completed .alog-metro__dot {
    background: var(--alog-primary);
    border-color: var(--alog-primary);
    color: #fff;
}

.alog-metro__station--in_progress .alog-metro__dot {
    background: var(--alog-warning);
    border-color: var(--alog-warning);
    color: #fff;
}

.alog-metro__label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--alog-dark);
    line-height: 1.25;
    word-break: break-word;
    hyphens: auto;
}

.alog-metro__status {
    display: block;
    font-size: 11.5px;
    color: var(--alog-muted);
    margin-top: 3px;
    font-weight: 500;
}

.alog-metro__station--completed .alog-metro__status { color: var(--alog-primary-dark); }
.alog-metro__station--in_progress .alog-metro__status { color: var(--alog-warning-text); }

/* Mobile: línea vertical, una estación por fila. */
@media (max-width: 720px) {
    .alog-metro {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 18px 18px 18px 22px;
    }
    .alog-metro::before {
        top: calc(18px + var(--alog-metro-dot-size) / 2);
        bottom: calc(18px + var(--alog-metro-dot-size) / 2);
        left: calc(22px + var(--alog-metro-dot-size) / 2 - 2px);
        right: auto;
        width: 4px;
        height: auto;
    }
    .alog-metro::after {
        top: calc(18px + var(--alog-metro-dot-size) / 2);
        bottom: auto;
        left: calc(22px + var(--alog-metro-dot-size) / 2 - 2px);
        right: auto;
        width: 4px;
        height: calc((100% - 36px - var(--alog-metro-dot-size)) * var(--alog-metro-progress) / 100);
        background: linear-gradient(180deg, var(--alog-primary), var(--alog-primary-dark));
    }
    .alog-metro__station {
        display: grid;
        grid-template-columns: var(--alog-metro-dot-size) 1fr auto;
        align-items: center;
        gap: 14px;
        text-align: left;
        padding: 8px 0;
    }
    .alog-metro__dot { margin-bottom: 0; }
    .alog-metro__label { font-size: 14px; }
    .alog-metro__status { margin-top: 0; white-space: nowrap; }
}

/* UCL card */
.alog-ucl-card {
    background: var(--alog-surface);
    border: 1px solid var(--alog-border);
    border-radius: var(--alog-radius);
    padding: 16px 22px 18px;
    box-shadow: var(--alog-shadow);
}

.alog-ucl-card__head {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--alog-dark);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--alog-border);
}

.alog-ucl-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alog-ucl-list__item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14.5px;
    color: var(--alog-text);
}

.alog-ucl-list__item--pending {
    color: var(--alog-dark);
    font-weight: 600;
}

.alog-ucl-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Alert callout */
.alog-alert-box {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--alog-surface);
    border: 1px solid var(--alog-border);
    border-radius: var(--alog-radius);
    padding: 16px 20px 18px;
    box-shadow: var(--alog-shadow);
}

.alog-alert-box__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin-top: 2px;
}
.alog-alert-box__icon svg {
    width: 100%;
    height: 100%;
}

.alog-alert-box__title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--alog-dark);
}

.alog-alert-box__text {
    margin: 0;
    font-size: 13.5px;
    color: var(--alog-muted);
    line-height: 1.5;
}

.alog-alert-box--success {
    border-color: rgba(34, 177, 76, 0.4);
    background: var(--alog-success-bg);
}

.alog-alert-box--warning {
    border-color: rgba(245, 166, 35, 0.4);
}

/* ─── Loading overlay (mientras corre el AJAX) ───────────────────────── */

.alog-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(29, 52, 66, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    padding: 24px;
}

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

.alog-loading-overlay__box {
    background: var(--alog-surface, #fff);
    border-radius: 12px;
    padding: 32px 36px;
    box-shadow: 0 10px 30px rgba(29, 52, 66, 0.18);
    text-align: center;
    max-width: 360px;
    width: 100%;
    font-family: inherit;
}

.alog-loading-overlay__title {
    margin: 16px 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: #1d3442;
}

.alog-loading-overlay__subtitle {
    margin: 0;
    font-size: 14px;
    color: #6b7a85;
}

.alog-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 4px solid #e4e8eb;
    border-top-color: #22b14c;
    border-radius: 50%;
    animation: alog-spin 0.9s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .alog-spinner { animation-duration: 2s; }
    .alog-metro__dot-pulse { animation-duration: 3s; }
}

@media (max-width: 600px) {
    .alog-certifica {
        padding: 24px 16px;
    }
}

/* ─── ARCO footer + modal (sin cambios) ─────────────────────────────── */

.alog-btn--ghost {
    background: transparent;
    color: var(--alog-muted);
    border-color: var(--alog-border);
}
.alog-btn--ghost:hover {
    background: var(--alog-bg);
    color: var(--alog-dark);
    border-color: var(--alog-border);
}

.alog-arco-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--alog-border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.alog-arco-footer__text {
    margin: 0;
    font-size: 13px;
    color: var(--alog-muted);
    line-height: 1.5;
    flex: 1 1 320px;
}

.alog-arco-footer__link {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--alog-primary-dark);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.alog-arco-footer__link:hover {
    text-decoration: underline;
}

.alog-arco-modal {
    --alog-primary: #22b14c;
    --alog-primary-dark: #1e9a41;
    --alog-dark: #1d3442;
    --alog-text: #2d3e4b;
    --alog-muted: #6b7a85;
    --alog-border: #e4e8eb;
    --alog-bg: #f6f7f8;
    --alog-danger-bg: #fde4e4;
    --alog-danger-text: #a32020;

    position: fixed;
    inset: 0;
    background: rgba(29, 52, 66, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    overflow-y: auto;
    font-family: inherit;
}
.alog-arco-modal[hidden] { display: none; }
.alog-arco-modal * { box-sizing: border-box; }

body.alog-arco-modal-open { overflow: hidden; }

.alog-arco-modal__dialog {
    position: relative;
    background: #fff;
    max-width: 640px;
    width: 100%;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    color: var(--alog-text);
    font-family: inherit;
    line-height: 1.5;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.alog-arco-modal__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #6b7a85;
    cursor: pointer;
    padding: 4px 8px;
}
.alog-arco-modal__close:hover { color: #1d3442; }

.alog-arco-modal__title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: #1d3442;
}

.alog-arco-modal__lead {
    margin: 0 0 20px;
    font-size: 14px;
    color: #6b7a85;
}

.alog-arco-form__group { margin-bottom: 16px; }

.alog-arco-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 540px) {
    .alog-arco-form__row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

.alog-arco-form label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: #1d3442;
}

.alog-arco-form input[type="text"],
.alog-arco-form input[type="email"],
.alog-arco-form input[type="tel"],
.alog-arco-form select,
.alog-arco-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e4e8eb;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #1d3442;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.alog-arco-form input:focus,
.alog-arco-form select:focus,
.alog-arco-form textarea:focus {
    outline: none;
    border-color: #22b14c;
    box-shadow: 0 0 0 3px rgba(34, 177, 76, 0.15);
}

.alog-arco-form input[aria-invalid="true"],
.alog-arco-form select[aria-invalid="true"],
.alog-arco-form textarea[aria-invalid="true"] { border-color: #a32020; }

.alog-arco-form textarea { resize: vertical; min-height: 90px; }

.alog-arco-form__hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7a85;
}

.alog-arco-form__honeypot {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.alog-arco-form__group--check { margin: 8px 0 16px; }

.alog-arco-form__check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 400;
    font-size: 13px;
    color: #2d3e4b;
    cursor: pointer;
}
.alog-arco-form__check input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
}

.alog-arco-form__error {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #fde4e4;
    border-radius: 6px;
    color: #a32020;
    font-size: 13px;
    font-weight: 500;
}

.alog-arco-form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.alog-arco-modal__success {
    text-align: center;
    padding: 12px 0;
}
.alog-arco-modal__success svg { margin-bottom: 12px; }
.alog-arco-modal__success h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #1d3442;
}
.alog-arco-modal__success p {
    margin: 0 0 20px;
    color: #6b7a85;
    font-size: 14px;
}
