/* 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);
    -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 heart */
#ehayat-loading .ehayat-heart {
    font-size: 3rem;
    line-height: 1;
    color: #1e7e34;
    animation: ehayat-heartbeat 1.1s ease-in-out infinite;
    filter: drop-shadow(0 6px 14px rgba(30, 126, 52, .35));
}

@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: #1e7e34;
    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: #1f2937;
    letter-spacing: .02em;
}

@media (prefers-reduced-motion: reduce) {
    #ehayat-loading .ehayat-heart,
    #ehayat-loading .ehayat-ecg polyline {
        animation-duration: 3s;
    }
}
