﻿/* ============================================================
   Freedom Sports Academy — Loader Styles
   loader.css — Page Load Animation (Dark + Light Themes)
   ============================================================ */

/* ─── Loader Overlay ─── */
#fsa-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--loader-bg);
    opacity: 1;
    transition: opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1),
                visibility 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}

#fsa-loader.loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ─── Loader Background Blur Orb ─── */
.loader-bg-orb {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: var(--glow-primary);
    filter: blur(100px);
    animation: loader-orb-pulse 3s ease-in-out infinite;
}

@keyframes loader-orb-pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50%       { transform: scale(1.3); opacity: 1; }
}

/* ─── Loader Athlete Wrapper ─── */
.loader-athlete-ring {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 180px;
}

/* Outer spinning ring */
.loader-ring-outer {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--color-primary-container);
    border-right-color: var(--color-primary-fixed);
    animation: ring-spin 2s linear infinite;
}

/* Inner spinning ring (opposite direction) */
.loader-ring-inner {
    position: absolute;
    inset: 16px;
    border-radius: 50%;
    border: 1px solid transparent;
    border-bottom-color: var(--color-primary);
    opacity: 0.5;
    animation: ring-spin 1.5s linear infinite reverse;
}

@keyframes ring-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Glass Icon Container */
.loader-icon-glass {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 45, 45, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    animation: icon-pulse 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
    overflow: hidden;
    position: relative;
}

html.dark .loader-icon-glass {
    background: rgba(15, 22, 24, 0.50);
    border-color: rgba(255, 45, 45, 0.50);
}

@keyframes icon-pulse {
    0%, 100% { transform: scale(1); border-color: rgba(255, 45, 45, 0.55); }
    50%       { transform: scale(1.04); border-color: rgba(255, 45, 45, 0.90); }
}

/* Speed Lines inside icon */
.loader-speed-lines {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 20px;
    opacity: 0.25;
    pointer-events: none;
}

.loader-speed-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, #ff2d2d, transparent);
    animation: speed-slide 2s linear infinite;
}

.loader-speed-line:nth-child(1) { width: 50%; align-self: flex-start; animation-delay: 0.1s; }
.loader-speed-line:nth-child(2) { width: 75%; align-self: flex-end;  animation-delay: 0.5s; }
.loader-speed-line:nth-child(3) { width: 55%; align-self: flex-start; animation-delay: 0.9s; }

@keyframes speed-slide {
    0%   { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

/* Inline SVG Athlete Icon */
.loader-icon-svg {
    width: 58px;
    height: 58px;
    color: #ff2d2d;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 8px rgba(255, 45, 45, 0.40));
}

html.light .loader-icon-svg {
    color: #c0160d;
    filter: drop-shadow(0 2px 6px rgba(92, 122, 0, 0.30));
}

/* ─── Loader Text Area ─── */
.loader-text-area {
    margin-top: 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loader-title {
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 700;
    font-family: 'Geist', sans-serif;
    color: var(--color-primary);
}

.loader-subtitle {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-on-surface-variant);
    font-family: 'Geist', sans-serif;
    max-width: 280px;
}

/* ─── Progress Bar ─── */
.loader-progress-track {
    width: 220px;
    height: 3px;
    background: var(--color-surface-container-highest);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-card-border);
    margin-top: 8px;
}

.loader-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--color-primary-container);
    border-radius: 9999px;
    box-shadow: 0 0 12px var(--color-primary-container);
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.loader-progress-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
    animation: shimmer-slide 1.8s linear infinite;
}

@keyframes shimmer-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ─── Progress Percentage ─── */
.loader-percentage {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-primary);
    opacity: 0.7;
    margin-top: 4px;
}

/* ─── Academy Name below loader ─── */
.loader-academy-name {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Geist', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-on-surface-variant);
    opacity: 0.6;
    white-space: nowrap;
}

/* ─── Loader Dots (decorative corner) ─── */
.loader-dots-corner {
    position: absolute;
    bottom: 60px;
    right: 40px;
    display: flex;
    gap: 6px;
    opacity: 0.4;
}

.loader-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.loader-dot:nth-child(1) { animation-delay: 0s; }
.loader-dot:nth-child(2) { animation-delay: 0.2s; }
.loader-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%            { transform: scale(1.2); opacity: 1; }
}
