/* Base overlay */
#loading-overlay {
    --ol-color: #235b50;
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .65);
}

#loading-overlay.active {
    display: flex;
}

/* 0: Invisible */
#loading-overlay.ol-type-0 {
    background: transparent;
}

/* 1: Bootstrap spinner */
.ol-bootstrap {
    width: 3rem;
    height: 3rem;
    color: var(--ol-color);
}

/* 2: Google top bar */
#loading-overlay.ol-type-2 {
    background: transparent;
    align-items: flex-start;
}

.ol-google {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    overflow: hidden;
}

.ol-google::before {
    content: "";
    position: absolute;
    height: 100%;
    width: 35%;
    background: var(--ol-color);
    animation: ol-google-move 1.5s ease-in-out infinite;
}

@keyframes ol-google-move {
    0% { left: -40%; }
    100% { left: 110%; }
}

/* 3: Bouncing dots */
.ol-dots {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ol-dots span {
    width: 13px;
    height: 13px;
    background: var(--ol-color);
    border-radius: 50%;
    animation: ol-bounce 1s infinite ease-in-out;
}

.ol-dots span:nth-child(2) { animation-delay: .15s; }
.ol-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes ol-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-14px); }
}

/* 4: Pulsing circle */
.ol-pulse {
    width: 55px;
    height: 55px;
    background: var(--ol-color);
    border-radius: 50%;
    animation: ol-pulsing 1.3s infinite ease-in-out;
}

@keyframes ol-pulsing {
    0%, 100% { transform: scale(.7); opacity: .4; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* 5: Dual rotating rings */
.ol-rings {
    width: 55px;
    height: 55px;
    border: 4px solid #dce9e5;
    border-top-color: var(--ol-color);
    border-bottom-color: var(--ol-color);
    border-radius: 50%;
    animation: ol-spin 1s linear infinite;
}

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

/* 6: Animated vertical bars */
.ol-bars {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 50px;
}

.ol-bars span {
    width: 6px;
    height: 16px;
    border-radius: 5px;
    background: var(--ol-color);
    animation: ol-bars-grow 1s infinite ease-in-out;
}

.ol-bars span:nth-child(2) { animation-delay: .1s; }
.ol-bars span:nth-child(3) { animation-delay: .2s; }
.ol-bars span:nth-child(4) { animation-delay: .3s; }
.ol-bars span:nth-child(5) { animation-delay: .4s; }

@keyframes ol-bars-grow {
    0%, 100% { height: 12px; }
    50% { height: 42px; }
}

/* 7: Orbiting dots */
.ol-orbit {
    width: 60px;
    height: 60px;
    position: relative;
    animation: ol-spin 1.5s linear infinite;
}

.ol-orbit span {
    width: 14px;
    height: 14px;
    background: var(--ol-color);
    border-radius: 50%;
    position: absolute;
}

.ol-orbit span:nth-child(1) { top: 0; left: 23px; }
.ol-orbit span:nth-child(2) { bottom: 7px; left: 0; opacity: .65; }
.ol-orbit span:nth-child(3) { bottom: 7px; right: 0; opacity: .35; }

/* 8: Blurred overlay */
#loading-overlay.ol-type-8 {
    background: rgba(255, 255, 255, .45);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.ol-blur-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(35, 91, 80, .15);
    border-top-color: var(--ol-color);
    border-radius: 50%;
    animation: ol-spin .8s linear infinite;
}

/* 9: Blurred minimal progress bar */
#loading-overlay.ol-type-9 {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: flex-start;
}

.ol-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    overflow: hidden;
    background: rgba(35, 91, 80, 0.08);
}

.ol-line span {
    display: block;
    width: 30%;
    height: 100%;
    background: var(--ol-color);
    animation: ol-line-progress 1.2s ease-in-out infinite;
}

@keyframes ol-line-progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(450%); }
}

@media (prefers-reduced-motion: reduce) {
    #loading-overlay *,
    #loading-overlay *::before,
    #loading-overlay *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
