/* ==========================================================================
   Loader — reusable across the whole project for any API call.
   Include loader.css + loader.js, then call:

       Loader.show();               // full-page overlay
       Loader.hide();

       Loader.button(btnEl, true);  // inline spinner inside a button
       Loader.button(btnEl, false); // restore the button's original label
   ========================================================================== */

.td-loader-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .72);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility 0s linear .25s;
}

.td-loader-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity .25s ease, visibility 0s linear 0s;
}

/* =========================================================
   TARGET LOADER — four blinking corner brackets
========================================================= */

.td-loader-target {
    position: relative;
    width: 30px;
    height: 30px;
}

.td-loader-target__corner {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--td-loader-color, #f9a06b);
    border-radius: 2px;
    animation: td-loader-blink 1s ease-in-out infinite;
}

.td-loader-target__corner::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 5px;
    background: var(--td-loader-color, #f9a06b);
}

.td-loader-target__corner--tl {
    top: 0;
    left: 0;
    border-radius: 2px 0 0 0;
}

.td-loader-target__corner--tl::after {
    right: -3px;
    bottom: -3px;
}

.td-loader-target__corner--tr {
    top: 0;
    right: 0;
    border-radius: 0 2px 0 0;
}

.td-loader-target__corner--tr::after {
    left: -3px;
    bottom: -3px;
}

.td-loader-target__corner--bl {
    bottom: 0;
    left: 0;
    border-radius: 0 0 0 2px;
}

.td-loader-target__corner--bl::after {
    right: -3px;
    top: -3px;
}

.td-loader-target__corner--br {
    bottom: 0;
    right: 0;
    border-radius: 0 0 2px 0;
}

.td-loader-target__corner--br::after {
    left: -3px;
    top: -3px;
}

@keyframes td-loader-blink {
    0%, 100% {
        opacity: .55;
        transform: scale(.85);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Small variant used inline inside buttons */
.td-loader-target--sm {
    width: 18px;
    height: 18px;
}

.td-loader-target--sm .td-loader-target__corner {
    width: 6px;
    height: 6px;
}

.td-loader-target--sm .td-loader-target__corner::after {
    width: 3px;
    height: 3px;
}

.td-loader-target--sm .td-loader-target__corner--tl::after {
    right: -2px;
    bottom: -2px;
}

.td-loader-target--sm .td-loader-target__corner--tr::after {
    left: -2px;
    bottom: -2px;
}

.td-loader-target--sm .td-loader-target__corner--bl::after {
    right: -2px;
    top: -2px;
}

.td-loader-target--sm .td-loader-target__corner--br::after {
    left: -2px;
    top: -2px;
}

/* White variant used on dark/orange backgrounds (e.g. inside a submit button) */
.td-loader-target--on-dark .td-loader-target__corner,
.td-loader-target--on-dark .td-loader-target__corner::after {
    background: #ffffff;
}

.td-btn-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
