/* =============================================================================
   components/loader.css
   Global full-screen loader and inline tab-level content loader.
   Extracted from js/app/ui/loader.js — no longer injected at runtime.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Global full-screen loader overlay
   ----------------------------------------------------------------------------- */

.global-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #fdfdff 0%, #f8f9ff 100%);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.global-loader-content {
    text-align: center;
    max-width: 300px;
    position: relative;
}

/* -----------------------------------------------------------------------------
   Spinner rings (shared by global and tab loaders)
   ----------------------------------------------------------------------------- */

.loader-spinner {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0 auto 2rem;
}

.spinner-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

.spinner-ring.primary {
    width: 72px;
    height: 72px;
    border-top: 2px solid var(--primary);
    animation: spin 2s linear infinite;
}

.spinner-ring.secondary {
    width: 54px;
    height: 54px;
    top: 9px;
    left: 9px;
    border-top: 2px solid rgba(0, 43, 191, 0.6);
    animation: spin 1.5s linear infinite reverse;
}

.spinner-ring.tertiary {
    width: 36px;
    height: 36px;
    top: 18px;
    left: 18px;
    border-top: 2px solid rgba(0, 43, 191, 0.3);
    animation: spin 1s linear infinite;
}

/* -----------------------------------------------------------------------------
   Message and loading dots
   ----------------------------------------------------------------------------- */

.loader-message {
    margin: 0 0 1rem;
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.4;
    font-weight: 400;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: dotPulse 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay:    0s;  }

/* Disable interaction while loading */
body.global-loader-active            { overflow: hidden; }
body.global-loader-active *          { pointer-events: none; }
.global-loader-overlay *             { pointer-events: auto; }

/* -----------------------------------------------------------------------------
   Tab-level inline loader
   ----------------------------------------------------------------------------- */

.tab-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
}

.tab-loader-content { text-align: center; }

.tab-loader-spinner {
    position: relative;
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
}

.tab-loader-spinner .spinner-ring {
    position: absolute;
    width: 48px;
    height: 48px;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.tab-loader-spinner .spinner-ring:nth-child(2) {
    width: 36px;
    height: 36px;
    top: 6px;
    left: 6px;
    border-top-color: rgba(0, 43, 191, 0.6);
    animation-duration: 1.5s;
    animation-direction: reverse;
}

.tab-loader-spinner .spinner-ring:nth-child(3) {
    width: 24px;
    height: 24px;
    top: 12px;
    left: 12px;
    border-top-color: rgba(0, 43, 191, 0.3);
    animation-duration: 0.8s;
}

.tab-loader-message {
    color: #6b7280;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 400;
}

.tab-loader.hiding { animation: fadeOut 0.2s ease forwards; }

/* -----------------------------------------------------------------------------
   Keyframes (fadeOut only — fadeIn, spin, dotPulse are in base/animations.css)
   ----------------------------------------------------------------------------- */

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.96); }
}

/* -----------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------------- */

@media (max-width: 480px) {
    .global-loader-content         { padding: 1rem; }
    .loader-message                { font-size: 0.9rem; }
    .loader-spinner                { width: 64px; height: 64px; }
    .spinner-ring.primary          { width: 64px; height: 64px; }
    .spinner-ring.secondary        { width: 48px; height: 48px; top: 8px; left: 8px; }
    .spinner-ring.tertiary         { width: 32px; height: 32px; top: 16px; left: 16px; }
}
