/* ==========================================================================
   GLOBAL LOADING
   Prefijo exclusivo: tm-loading-
   ========================================================================== */


/* ==========================================================================
   OVERLAY
   ========================================================================== */

.tm-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}


/* Estado visible */

.tm-loading-overlay.tm-loading-is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}


/* ==========================================================================
   CONTENEDOR
   ========================================================================== */

.tm-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-width: 180px;
    padding: 25px 30px;

    text-align: center;
}


/* ==========================================================================
   ANIMACIONES BASE
   ========================================================================== */

.tm-loading-animation {
    display: none;
    align-items: center;
    justify-content: center;

    width: 70px;
    height: 70px;
}


/* ==========================================================================
   SPINNER
   ========================================================================== */

.tm-loading-animation--spinner {
    display: flex;
}

.tm-loading-spinner {
    width: 48px;
    height: 48px;

    border: 4px solid #dceff5;
    border-top-color: #0089ad;
    border-right-color: #e53232;

    border-radius: 50%;

    animation: tm-loading-spin 0.85s linear infinite;
}


@keyframes tm-loading-spin {
    to {
        transform: rotate(360deg);
    }
}


/* ==========================================================================
   DOTS
   ========================================================================== */

.tm-loading-dot {
    width: 11px;
    height: 11px;

    margin: 0 4px;

    background: #0089ad;
    border-radius: 50%;

    animation: tm-loading-dot-bounce 1.2s infinite ease-in-out;
}


.tm-loading-dot:nth-child(1) {
    animation-delay: -0.24s;
}

.tm-loading-dot:nth-child(2) {
    animation-delay: -0.12s;
}

.tm-loading-dot:nth-child(3) {
    animation-delay: 0;
}


@keyframes tm-loading-dot-bounce {
    0%,
    80%,
    100% {
        transform: scale(0.55);
        opacity: 0.45;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}


/* ==========================================================================
   PULSE
   ========================================================================== */

.tm-loading-pulse {
    position: relative;

    display: block;

    width: 45px;
    height: 45px;

    background: #0089ad;
    border-radius: 50%;

    animation: tm-loading-pulse-animation 1.3s infinite ease-out;
}


.tm-loading-pulse::after {
    content: "";

    position: absolute;
    inset: 0;

    border: 3px solid #0089ad;
    border-radius: 50%;

    animation: tm-loading-pulse-ring 1.3s infinite ease-out;
}


@keyframes tm-loading-pulse-animation {
    0% {
        transform: scale(0.85);
        opacity: 0.8;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.85);
        opacity: 0.8;
    }
}


@keyframes tm-loading-pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}


/* ==========================================================================
   BARS
   ========================================================================== */

.tm-loading-animation--bars {
    gap: 5px;
}


.tm-loading-bar {
    width: 6px;
    height: 38px;

    background: #0089ad;
    border-radius: 4px;

    animation: tm-loading-bars-animation 1s infinite ease-in-out;
}


.tm-loading-bar:nth-child(1) {
    animation-delay: -0.4s;
}

.tm-loading-bar:nth-child(2) {
    animation-delay: -0.3s;
}

.tm-loading-bar:nth-child(3) {
    animation-delay: -0.2s;
}

.tm-loading-bar:nth-child(4) {
    animation-delay: -0.1s;
}

.tm-loading-bar:nth-child(5) {
    animation-delay: 0;
}


@keyframes tm-loading-bars-animation {
    0%,
    40%,
    100% {
        transform: scaleY(0.5);
        opacity: 0.45;
    }

    20% {
        transform: scaleY(1);
        opacity: 1;
    }
}


/* ==========================================================================
   LOGO TAMIZMAS
   ========================================================================== */

.tm-loading-animation--logo {
    width: 80px;
    height: 80px;
}


.tm-loading-logo-mark {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 58px;
    height: 58px;

    border-radius: 50%;

    animation: tm-loading-logo-pulse 1.6s infinite ease-in-out;
}


.tm-loading-logo-letter {
    position: relative;
    z-index: 2;

    font-family: Arial, sans-serif;
    font-size: 34px;
    font-weight: 800;

    color: #0089ad;
}


.tm-loading-logo-ring {
    position: absolute;
    inset: 0;

    border: 4px solid #d9eff5;
    border-top-color: #0089ad;
    border-right-color: #e53232;

    border-radius: 50%;

    animation: tm-loading-logo-spin 1s linear infinite;
}


@keyframes tm-loading-logo-spin {
    to {
        transform: rotate(360deg);
    }
}


@keyframes tm-loading-logo-pulse {
    0%,
    100% {
        transform: scale(0.95);
    }

    50% {
        transform: scale(1.05);
    }
}


/* ==========================================================================
   MENSAJE
   ========================================================================== */

.tm-loading-message {
    margin-top: 15px;

    max-width: 280px;

    font-family: Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;

    color: #173b59;

    text-align: center;
}


/* ==========================================================================
   ANIMACIONES DE ENTRADA
   ========================================================================== */

.tm-loading-is-visible .tm-loading-container {
    animation: tm-loading-container-enter 0.3s ease-out;
}


@keyframes tm-loading-container-enter {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* ==========================================================================
   MODO: SOLO CONTENIDO
   ========================================================================== */

.tm-loading-overlay.tm-loading-inline {
    position: absolute;
}


/* ==========================================================================
   TAMAÑOS
   ========================================================================== */

.tm-loading-small .tm-loading-spinner {
    width: 28px;
    height: 28px;

    border-width: 3px;
}


.tm-loading-large .tm-loading-spinner {
    width: 65px;
    height: 65px;

    border-width: 5px;
}


/* ==========================================================================
   ACCESIBILIDAD
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .tm-loading-spinner,
    .tm-loading-dot,
    .tm-loading-pulse,
    .tm-loading-pulse::after,
    .tm-loading-bar,
    .tm-loading-logo-ring,
    .tm-loading-logo-mark {
        animation-duration: 2s;
    }
}


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 576px) {

    .tm-loading-container {
        min-width: 150px;
        padding: 20px;
    }

    .tm-loading-message {
        font-size: 14px;
        max-width: 240px;
    }
}