/* ==========================================================================
   ST. LAWRENCE JUNIOR SCHOOL KABOWA — OPTION A LIGHT INSTITUTIONAL LOADER
   Single, unified global loader implementation across the entire website.
   ========================================================================== */

/* Import Institutional Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,400&family=Inter:wght@400;500;600;700&display=swap');

/* Prevent page scrolling while loader is active */
body.loader-active {
    overflow: hidden !important;
}

/* Base Full-Screen Overlay */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: #FFFFFF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    z-index: 99999;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

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

/* Center Content Container */
.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    padding: 40px 20px 20px 20px;
    box-sizing: border-box;
    text-align: center;
    z-index: 2;
    position: relative;
    margin-top: -15px; /* Subtle upper-middle alignment offset */
}

/* Official School Crest / Logo */
.loader-logo {
    width: 135px;
    height: auto;
    margin-bottom: 22px;
    flex-shrink: 0;
    animation: loaderLogoEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.loader-logo img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* School Name Title */
.loader-title {
    color: #0B2545;
    font-family: 'Cinzel', 'Playfair Display', Georgia, serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 3px;
    margin: 0 0 6px 0;
    padding: 0;
    text-align: center;
    text-transform: uppercase;
    line-height: 1.15;
    animation: loaderTextEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.12s forwards;
    opacity: 0;
}

/* Subtitle */
.loader-subtitle {
    color: #0B2545;
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 15px;
    font-weight: 400;
    opacity: 0.85;
    margin: 0 0 32px 0;
    padding: 0;
    text-align: center;
    line-height: 1.3;
    animation: loaderTextEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.22s forwards;
    opacity: 0;
}

/* Progress Indicator Section */
.loader-progress-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 260px;
    max-width: 82vw;
    margin: 0 auto;
    animation: loaderFadeIn 0.5s ease-out 0.3s forwards;
    opacity: 0;
}

.loader-progress-track {
    width: 100%;
    height: 4px;
    background-color: #E5E7EB;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.loader-progress-bar {
    height: 100%;
    width: 0%;
    background-color: #C9182B;
    border-radius: 9999px;
    transition: width 0.1s linear;
}

/* Small Uppercase Loading Label */
.loader-loading-text {
    color: #64748B;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 3.5px;
    text-transform: uppercase;
    margin-top: 14px;
}

/* Bottom Motto Area */
.loader-footer {
    width: 100%;
    max-width: 500px;
    padding: 0 24px 36px 24px;
    box-sizing: border-box;
    z-index: 2;
    position: relative;
    flex-shrink: 0;
}

.loader-motto {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    animation: loaderFadeIn 0.6s ease-out 0.35s forwards;
    opacity: 0;
}

.motto-line {
    height: 1px;
    flex: 1;
    background-color: rgba(11, 37, 69, 0.22);
    max-width: 90px;
}

.motto-text {
    color: #0B2545;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Subtle Authentic Campus Watermark Background Element */
.loader-watermark {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1100px;
    height: 38vh;
    max-height: 290px;
    background-image: url('../img/admin-campus-clean.jpg');
    background-position: bottom center;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.12;
    mix-blend-mode: multiply;
    filter: grayscale(100%) contrast(110%);
    mask-image: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 65%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 65%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Keyframe Animations */
@keyframes loaderLogoEntrance {
    0% {
        opacity: 0;
        transform: translateY(14px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loaderTextEntrance {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loaderFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* ========== RESPONSIVE STYLES ========== */

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .loader-logo {
        width: 145px;
        margin-bottom: 24px;
    }
    .loader-title {
        font-size: 32px;
        letter-spacing: 3.5px;
    }
    .loader-subtitle {
        font-size: 16px;
        margin-bottom: 36px;
    }
    .loader-progress-wrapper {
        width: 280px;
    }
}

/* Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    .loader-content {
        padding: 30px 16px 16px 16px;
        margin-top: -10px;
    }
    .loader-logo {
        width: 105px;
        margin-bottom: 16px;
    }
    .loader-title {
        font-size: 22px;
        letter-spacing: 2.2px;
        margin-bottom: 4px;
    }
    .loader-subtitle {
        font-size: 13px;
        margin-bottom: 24px;
    }
    .loader-progress-wrapper {
        width: 210px;
        max-width: 85vw;
    }
    .loader-loading-text {
        font-size: 10px;
        letter-spacing: 3px;
        margin-top: 12px;
    }
    .loader-footer {
        padding: 0 16px 24px 16px;
    }
    .loader-motto {
        gap: 10px;
    }
    .motto-line {
        max-width: 45px;
    }
    .motto-text {
        font-size: 10px;
        letter-spacing: 1.8px;
    }
    .loader-watermark {
        height: 30vh;
        max-height: 200px;
        opacity: 0.10;
    }
}

/* Extra Small Devices (320px - 360px) */
@media (max-width: 360px) {
    .loader-logo {
        width: 95px;
        margin-bottom: 12px;
    }
    .loader-title {
        font-size: 20px;
        letter-spacing: 1.8px;
    }
    .loader-subtitle {
        font-size: 12px;
        margin-bottom: 20px;
    }
    .loader-progress-wrapper {
        width: 190px;
    }
    .motto-line {
        max-width: 30px;
    }
    .motto-text {
        font-size: 9.5px;
        letter-spacing: 1.4px;
    }
}

/* Landscape Mobile (Short Height) */
@media (max-height: 520px) and (orientation: landscape) {
    .loader-content {
        padding: 15px 10px 5px 10px;
        margin-top: 0;
    }
    .loader-logo {
        width: 75px;
        margin-bottom: 8px;
    }
    .loader-title {
        font-size: 18px;
        letter-spacing: 2px;
    }
    .loader-subtitle {
        font-size: 12px;
        margin-bottom: 14px;
    }
    .loader-progress-wrapper {
        width: 180px;
    }
    .loader-loading-text {
        font-size: 9px;
        margin-top: 8px;
    }
    .loader-footer {
        padding-bottom: 12px;
    }
    .loader-watermark {
        display: none;
    }
}

/* ACCESSIBILITY: PREFERS-REDUCED-MOTION */
@media (prefers-reduced-motion: reduce) {
    .loader-logo,
    .loader-title,
    .loader-subtitle,
    .loader-progress-wrapper,
    .loader-motto {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    .page-loader {
        transition: opacity 0.2s ease !important;
    }

    .loader-progress-bar {
        transition: width 0.1s linear !important;
    }
}
