/**
 * Shared BIP loading indicator.
 * Default: Orbit ring. Compact / modal: Pulse dots (.bip-loading--dots).
 * Toggle visibility with .is-visible (no JS helper API).
 */
.bip-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: 100%;
    text-align: center;
    padding: 28px 16px;
}

.bip-loading.is-visible,
#loading_results.bip-loading.is-visible {
    display: flex;
    float: none;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.bip-loading--compact {
    gap: 12px;
    padding: 16px 12px;
}

.bip-loading--compact .bip-loading-title {
    font-size: 13px;
}

/* Inline (e.g. Finder Show more button) */
.bip-loading.bip-loading--inline {
    flex-direction: row;
    gap: 8px;
    width: auto;
    padding: 0;
    margin: 0;
}

.bip-loading.bip-loading--inline .bip-loading-copy {
    max-width: none;
}

.bip-loading.bip-loading--inline .bip-loading-title {
    font-size: 13px;
    font-weight: 500;
    color: inherit;
}

.bip-loading.bip-loading--inline .bip-loading-mark--dots {
    height: auto;
}

.bip-loading-copy {
    max-width: 280px;
}

.bip-loading-title {
    margin: 0;
    color: #1e293b;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.35;
}

.bip-loading-sub {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
}

/* ---------- Orbit ring (default) ---------- */
.bip-loading-mark--orbit {
    position: relative;
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
}

.bip-loading-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2.5px solid color-mix(in srgb, var(--main-color, #278f89) 18%, transparent);
    border-top-color: var(--main-color, #278f89);
    border-right-color: color-mix(in srgb, var(--main-color, #278f89) 55%, transparent);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--main-color, #278f89) 7%, transparent);
    animation: bip-loading-spin 0.85s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.bip-loading-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--main-color, #278f89);
    box-shadow: 0 0 12px color-mix(in srgb, var(--main-color, #278f89) 45%, transparent);
    animation: bip-loading-pulse 1.2s ease-in-out infinite;
}

.bip-loading--compact .bip-loading-mark--orbit {
    width: 36px;
    height: 36px;
}

.bip-loading--compact .bip-loading-core {
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
}

/* ---------- Pulse dots (modals / compact) ---------- */
.bip-loading-mark--dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 28px;
    flex: 0 0 auto;
}

.bip-loading-dot {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--main-color, #278f89);
    animation: bip-loading-dot 1s ease-in-out infinite;
}

.bip-loading-dot:nth-child(1) { animation-delay: 0s; }
.bip-loading-dot:nth-child(2) { animation-delay: 0.16s; }
.bip-loading-dot:nth-child(3) { animation-delay: 0.32s; }

.bip-loading--compact .bip-loading-mark--dots {
    gap: 6px;
    height: 22px;
}

.bip-loading--compact .bip-loading-dot {
    width: 8px;
    height: 8px;
}

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

@keyframes bip-loading-pulse {
    0%,
    100% {
        transform: scale(0.85);
        opacity: 0.65;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@keyframes bip-loading-dot {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    40% {
        transform: translateY(-7px);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bip-loading-ring,
    .bip-loading-core,
    .bip-loading-dot {
        animation: none;
    }

    .bip-loading-ring {
        border-top-color: var(--main-color, #278f89);
        border-right-color: var(--main-color, #278f89);
        opacity: 0.85;
    }

    .bip-loading-dot {
        opacity: 0.85;
        transform: none;
    }
}
