/* e-Hayat global loading overlay — ECG heartbeat theme.
   Shown by loading-overlay.js on navigation / form submit; hidden on pageshow. */

#ehayat-loading {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: rgba(249, 250, 251, 0.82);
    background: color-mix(in srgb, var(--eh-bg, #f9fafb) 82%, transparent);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}

#ehayat-loading.is-active {
    opacity: 1;
    visibility: visible;
}

/* Beating e-Hayat cross (the logo mark) — same double beat as the heart */
#ehayat-loading .ehayat-pulse-logo {
    display: block;
    width: 72px;
    height: 72px;
    animation: ehayat-heartbeat 1.1s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(135, 203, 40, .35));
}

#ehayat-loading .ehayat-pulse-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Dark theme: the navy outline would vanish on the dark backdrop, so the white-outline cross is shown */
#ehayat-loading .ehayat-pulse-logo--light { display: none !important; }
html[data-theme="dark"] #ehayat-loading .ehayat-pulse-logo--color { display: none !important; }
html[data-theme="dark"] #ehayat-loading .ehayat-pulse-logo--light { display: block !important; }

/* Beating heart — the original icon, kept so it can be switched back (PULSE = 'heart' in loading-overlay.js) */
#ehayat-loading .ehayat-heart {
    font-size: 3rem;
    line-height: 1;
    color: var(--eh-brand, #87cb28);
    animation: ehayat-heartbeat 1.1s ease-in-out infinite;
    filter: drop-shadow(0 6px 14px rgba(6, 56, 101, .25));
}

@keyframes ehayat-heartbeat {
    0%, 100% { transform: scale(1); }
    14%      { transform: scale(1.22); }
    28%      { transform: scale(1); }
    42%      { transform: scale(1.16); }
    56%      { transform: scale(1); }
}

/* ECG trace: the pulse line sweeps across like a cardiac monitor */
#ehayat-loading .ehayat-ecg {
    width: 240px;
    height: 56px;
    overflow: visible;
}

#ehayat-loading .ehayat-ecg polyline {
    fill: none;
    stroke: var(--eh-brand, #87cb28);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 420;
    stroke-dashoffset: 420;
    animation: ehayat-ecg-sweep 1.6s linear infinite;
}

@keyframes ehayat-ecg-sweep {
    0%   { stroke-dashoffset: 420; opacity: 1; }
    70%  { stroke-dashoffset: 0;   opacity: 1; }
    90%  { opacity: 0; }
    100% { stroke-dashoffset: 420; opacity: 0; }
}

#ehayat-loading .ehayat-loading-text {
    font-weight: 600;
    color: var(--eh-ink, #1f2937);
    letter-spacing: .02em;
}

@media (prefers-reduced-motion: reduce) {
    #ehayat-loading .ehayat-heart,
    #ehayat-loading .ehayat-pulse-logo,
    #ehayat-loading .ehayat-ecg polyline {
        animation-duration: 3s;
    }
}
