/* ============================================================
   OFFLINE / MAINTENANCE OVERLAY
   Adaptado del diseño v2 con paleta TocoPay.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif&family=JetBrains+Mono:wght@400;500&family=Inter+Tight:wght@400;500;600&display=swap');

/* === Variables (paleta TocoPay) === */
.maintenance-card,
.maintenance-blur,
.maintenance-scrim {
    --m-bg: #f3efe9;
    --m-ink: #1c1a16;
    --m-ink-2: #5a554c;
    --m-line: #d9d3c8;
    --m-paper: #faf7f2;
    --m-accent: #128c5e; /* verde esmeralda TocoPay */
    --m-accent-2: #e3a92c; /* dorado TocoPay */
}

/* === Bloqueo del sitio detrás === */
html.maintenance-mode,
html.maintenance-mode body {
    overflow: hidden !important;
    height: 100% !important;
}

html.maintenance-mode body > *:not(.maintenance-card):not(.maintenance-blur):not(.maintenance-scrim) {
    pointer-events: none;
    user-select: none;
}

/* === Capa 1: difumina el sitio real === */
.maintenance-blur {
    position: fixed;
    inset: 0;
    z-index: 9997;
    backdrop-filter: blur(14px) saturate(0.85);
    -webkit-backdrop-filter: blur(14px) saturate(0.85);
    background: rgba(243, 239, 233, 0.35);
    pointer-events: auto;
}

/* === Capa 2: scrim oscuro radial para enfocar la tarjeta === */
.maintenance-scrim {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: radial-gradient(120% 80% at 50% 40%,
    rgba(28, 26, 22, 0.18) 0%,
    rgba(28, 26, 22, 0.42) 70%,
    rgba(28, 26, 22, 0.50) 100%);
    pointer-events: auto;
}

/* === Tarjeta flotante === */
.maintenance-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(720px, 92vw);
    max-height: 92vh;
    overflow-y: auto;
    z-index: 9999;

    /* Oculta la scrollbar manteniendo el scroll funcional */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE / Edge legacy */

    background: var(--m-paper);
    border: 1px solid var(--m-line);
    border-radius: 22px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 30px 60px -20px rgba(28, 26, 22, 0.35),
    0 8px 20px -8px rgba(28, 26, 22, 0.25);

    font-family: "Inter Tight", system-ui, sans-serif;
    color: var(--m-ink);
    -webkit-font-smoothing: antialiased;
    animation: m-cardIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes m-cardIn {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Oculta scrollbar en Chrome, Safari y Edge */
.maintenance-card::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* === Strip superior con estado === */
.maintenance-card .m-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--m-ink-2);
    border-bottom: 1px solid var(--m-line);
    background: repeating-linear-gradient(135deg,
    transparent 0 10px,
    rgba(28, 26, 22, 0.025) 10px 11px);
}

.maintenance-card .m-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--m-accent);
    margin-right: 8px;
    vertical-align: middle;
    animation: m-pulse 1.8s ease-out infinite;
}

@keyframes m-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(18, 140, 94, 0.6);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(18, 140, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(18, 140, 94, 0);
    }
}

.maintenance-card .m-id {
    color: var(--m-ink-2);
}

/* === Stage con animación SVG === */
.maintenance-card .m-stage {
    position: relative;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(60% 80% at 50% 60%, rgba(0, 0, 0, 0.04), transparent 70%),
    linear-gradient(180deg, var(--m-paper), #f1ece4);
    overflow: hidden;
}

.maintenance-card .m-stage::before,
.maintenance-card .m-stage::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--m-line);
}

.maintenance-card .m-stage::before {
    top: 33.33%;
}

.maintenance-card .m-stage::after {
    top: 66.66%;
}

.maintenance-card .m-v {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--m-line);
}

/* === Escena SVG === */
.maintenance-card .m-scene {
    width: 200px;
    height: 200px;
    display: block;
}

.maintenance-card .m-cross {
    color: var(--m-ink-2);
    stroke-width: 1;
    animation: m-fade 2.4s ease-in-out infinite;
}
@keyframes m-fade {
    0%, 100% {
        opacity: 0.25;
    }
    50% {
        opacity: 0.7;
    }
}

.maintenance-card .m-ring-static {
    stroke: var(--m-line);
    stroke-width: 1;
}

.maintenance-card .m-arc-outer {
    transform-origin: 100px 100px;
    animation: m-spin 6s linear infinite;
    color: var(--m-accent);
    stroke-width: 2;
}

.maintenance-card .m-arc-mid {
    transform-origin: 100px 100px;
    animation: m-spin 4s linear infinite reverse;
}
.maintenance-card .m-arc-mid-c {
    stroke: var(--m-ink);
    stroke-width: 1.25;
    stroke-dasharray: 6 6;
    opacity: 0.55;
}

.maintenance-card .m-arc-inner {
    transform-origin: 100px 100px;
    animation: m-spin 9s linear infinite;
}
.maintenance-card .m-arc-inner-c {
    stroke: var(--m-ink-2);
    stroke-width: 1.25;
}

.maintenance-card .m-dashy {
    stroke: var(--m-ink-2);
    stroke-width: 1;
    stroke-dasharray: 3 5;
    opacity: 0.5;
    animation: m-dash 4s linear infinite;
}

@keyframes m-dash {
    to {
        stroke-dashoffset: -100;
    }
}

.maintenance-card .m-diamond {
    transform-origin: 100px 100px;
    animation: m-morph 3.4s ease-in-out infinite;
    color: var(--m-accent);
}
.maintenance-card .m-diamond-r {
    fill: currentColor;
    fill-opacity: 0.14;
    stroke: currentColor;
    stroke-width: 1.75;
}
.maintenance-card .m-diamond-c {
    fill: currentColor;
    stroke: none;
}
@keyframes m-morph {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(45deg) scale(0.78);
    }
    100% {
        transform: rotate(90deg) scale(1);
    }
}

.maintenance-card .m-runner {
    offset-path: path("M 28,100 a 72,72 0 1 1 144,0 a 72,72 0 1 1 -144,0");
    offset-rotate: 0deg;
    animation: m-trip 3.6s linear infinite;
}

@keyframes m-trip {
    to {
        offset-distance: 100%;
    }
}

.maintenance-card .m-runner-c {
    fill: var(--m-accent-2);
    stroke: none;
}
.maintenance-card .m-runner-halo {
    fill: var(--m-accent-2);
    fill-opacity: 0.22;
    stroke: none;
}

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

/* === Cuerpo de texto === */
.maintenance-card .m-body {
    padding: 32px 56px 36px;
    text-align: center;
}

.maintenance-card .m-title {
    font-family: "Instrument Serif", Georgia, serif;
    font-weight: 400;
    font-size: 36px;
    line-height: 1.05;
    letter-spacing: -0.01em;
    margin: 0 0 20px;
    color: var(--m-ink);
}

.maintenance-card .m-copy {
    font-size: 16px;
    line-height: 1.65;
    color: var(--m-ink-2);
    margin: 0 auto 14px;
    max-width: 58ch;
}

.maintenance-card .m-copy:last-of-type {
    margin-bottom: 20px;
}

.maintenance-card .m-copy a {
    color: var(--m-accent);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.maintenance-card .m-copy a:hover {
    opacity: 0.7;
}

.maintenance-card .m-signoff {
    font-family: "Instrument Serif", Georgia, serif;
    font-style: italic;
    font-size: 18px;
    color: var(--m-ink);
    margin: 20px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--m-line);
    max-width: 58ch;
}

/* === Barra de progreso animada === */
.maintenance-card .m-progress {
    margin: 22px 0 0;
    height: 6px;
    background: rgba(18, 140, 94, 0.12);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.maintenance-card .m-progress::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -30%;
    width: 35%;
    background: linear-gradient(90deg, transparent, var(--m-accent), transparent);
    animation: m-shimmer 2.2s linear infinite;
}
@keyframes m-shimmer {
    to {
        left: 100%;
    }
}

/* === Responsive === */
@media (max-width: 560px) {
    .maintenance-card {
        width: 94vw;
        border-radius: 18px;
    }
    .maintenance-card .m-strip {
        padding: 12px 16px;
        font-size: 10px;
    }
    .maintenance-card .m-id {
        font-size: 9.5px;
    }
    .maintenance-card .m-stage {
        height: 170px;
    }
    .maintenance-card .m-scene {
        width: 160px;
        height: 160px;
    }
    .maintenance-card .m-body {
        padding: 22px 22px 26px;
    }
    .maintenance-card .m-title {
        font-size: 26px;
        margin-bottom: 16px;
    }
    .maintenance-card .m-copy {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 12px;
    }
    .maintenance-card .m-signoff {
        font-size: 15px;
        margin-top: 16px;
        padding-top: 16px;
    }
}

@media (max-height: 640px) {
    .maintenance-card .m-stage {
        height: 140px;
    }
    .maintenance-card .m-scene {
        width: 130px;
        height: 130px;
    }
    .maintenance-card .m-body {
        padding: 20px 32px 24px;
    }
    .maintenance-card .m-title {
        font-size: 24px;
        margin-bottom: 12px;
    }
    .maintenance-card .m-copy {
        margin-bottom: 8px;
    }
}