/* ============================================================
   Softmor Loading — Componente global de carga
   Stack: Bootstrap 5 + jQuery
   Colores: #24695c (primary) / #ba895d (secondary)
   ============================================================ */

/* ---- Overlay ---- */
#softmorLoadingOverlay {
    position: fixed;
    inset: 0;                          /* top/right/bottom/left: 0 */
    z-index: 99990;                    /* debajo de page-loader (999999) pero encima de todo lo demás */
    background: rgba(20, 30, 28, 0.52);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    /* Entrada: controlada por JS con clase .sm-visible */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

#softmorLoadingOverlay.sm-visible {
    opacity: 1;
    pointer-events: all;
}

/* ---- Tarjeta central ---- */
.sm-loading-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    padding: 2.25rem 2.5rem 2rem;
    text-align: center;
    min-width: 220px;
    max-width: 320px;
    width: 90vw;
    transform: scale(0.9) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.34, 1.45, 0.64, 1), opacity 0.22s ease;
    opacity: 0;
    font-family: 'Montserrat', sans-serif;
}

#softmorLoadingOverlay.sm-visible .sm-loading-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ---- Spinner — cuatro arcos giratorios ---- */
.sm-loading-spinner-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.sm-loading-ring {
    display: inline-block;
    position: relative;
    width: 56px;
    height: 56px;
}

.sm-loading-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 48px;
    height: 48px;
    margin: 4px;
    border: 4px solid transparent;
    border-radius: 50%;
    animation: sm-ring-spin 1.1s cubic-bezier(0.5, 0.08, 0.25, 0.75) infinite;
}

/* Cuatro arcos con distintos colores y delays — degradado marca */
.sm-loading-ring div:nth-child(1) {
    border-top-color: #24695c;
    animation-delay: 0s;
}
.sm-loading-ring div:nth-child(2) {
    border-top-color: #2e8070;
    animation-delay: -0.28s;
    width: 42px;
    height: 42px;
    margin: 7px;
}
.sm-loading-ring div:nth-child(3) {
    border-top-color: #ba895d;
    animation-delay: -0.55s;
    width: 34px;
    height: 34px;
    margin: 11px;
}
.sm-loading-ring div:nth-child(4) {
    border-top-color: #d4a97a;
    animation-delay: -0.82s;
    width: 26px;
    height: 26px;
    margin: 15px;
}

@keyframes sm-ring-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---- Textos ---- */
.sm-loading-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.35rem;
    letter-spacing: 0.01em;
}

.sm-loading-subtitle {
    font-size: 0.825rem;
    font-weight: 400;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .sm-loading-card {
        padding: 1.75rem 1.5rem 1.5rem;
        min-width: unset;
    }
}

/* ---- Estado dark (si la plantilla lo usa) ---- */
body.dark-only #softmorLoadingOverlay {
    background: rgba(10, 18, 16, 0.65);
}
body.dark-only .sm-loading-card {
    background: #262932;
}
body.dark-only .sm-loading-title {
    color: #e5e7eb;
}
body.dark-only .sm-loading-subtitle {
    color: #9ca3af;
}
