/* --- SAGES Kilepal Brand Variables & Theming --- */
:root {
    /* --- Master Fonts --- */
    body { font-family: 'Inter', sans-serif; }
    h1, h2, h3, h4, h5, h6 { font-family: 'Poppins', sans-serif; color: var(--primary); }
    .logo-text, .loader-text, .badge, .btn, .nav-links a { font-family: 'Poppins', sans-serif; }
    
    /* Brand DNA Colors */
    --brand-dark-blue: #003399; 
    --brand-gold: #ffd700;      
    --brand-light-blue: #79a6d2; 
    
    /* Functional Mapping */
    --primary: var(--brand-dark-blue);
    --secondary: var(--brand-gold);
    --text-main: #1f2937;
    --text-muted: #4b5563;

    /* Backgrounds */
    --bg-main: #ffffff;
    --bg-alt: #f0f5fa; 
    --container-bg: rgba(121, 166, 210, 0.4); 
    
    /* Glassmorphism */
    --glass-border: rgba(0, 51, 153, 0.2);
    --shadow: 0 8px 32px rgba(0, 51, 153, 0.1);
    
    /* Logo Settings */
    --logo-height: 75px; 
    --logo-hover-scale: 1.05; 
}

[data-theme="dark"] {
    --text-main: #f9fafb;
    --text-muted: #d1d5db;
    --bg-main: #0a1526; 
    --bg-alt: #112240;
    --container-bg: rgba(121, 166, 210, 0.15); 
    --glass-border: rgba(255, 215, 0, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* ========================================= */
/* --- AGGRESSIVE OVERFLOW RESET --- */
/* ========================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box !important; /* Forces padding to stay strictly inside width limits */
    scroll-behavior: smooth;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important; /* Nuclear option for horizontal scrolling */
    position: relative; 
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

/* Prevents large images from breaking layouts */
img, video, iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3 { font-family: 'Poppins', sans-serif; color: var(--primary); }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: var(--secondary); }
a { text-decoration: none; color: inherit; transition: color 0.3s; }
ul { list-style: none; }

/* --- Layout Utilities --- */
.padding-container { padding: 5rem 10%; width: 100%; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.text-center { text-align: center; }
.w-100 { width: 100%; }
.bg-alt { background-color: var(--bg-alt); }

/* FIXED: min(100%, px) ensures grids never stretch past mobile screens */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 2rem; width: 100%; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 2rem; width: 100%; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 2rem; width: 100%; }

/* --- Buttons --- */
.btn { padding: 0.8rem 1.5rem; border-radius: 8px; border: none; cursor: pointer; font-weight: 700; transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.btn-primary { background-color: var(--brand-gold); color: var(--brand-dark-blue); }
.btn-primary:hover { background-color: #e6c200; }
.btn-secondary { background-color: var(--brand-dark-blue); color: var(--brand-gold); border: 2px solid var(--brand-gold); }
.btn-secondary:hover { background-color: #002266; }

/* --- Header & Nav --- */
.header { position: fixed; top: 0; left: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 10%; background: var(--brand-dark-blue); border-bottom: 4px solid var(--brand-gold); color: #ffffff; z-index: 1000; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.logo { display: flex; align-items: center; gap: 1rem; transition: transform 0.3s ease; cursor: pointer; }
.logo-image-container { height: var(--logo-height); width: var(--logo-height); min-width: var(--logo-height); border-radius: 50%; overflow: hidden; display: flex; justify-content: center; align-items: center; background: transparent; transition: transform 0.3s ease; }
.brand-logo { width: 100%; height: 100%; object-fit: cover; transform: scale(1.15); display: block; background: transparent; }
.logo-text { font-size: 1.6rem; font-weight: 700; font-family: 'Poppins', sans-serif; color: #ffffff; white-space: nowrap; transition: color 0.3s ease; }
.logo:hover .logo-image-container { transform: scale(var(--logo-hover-scale)); box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4); }
.logo:hover .logo-text { color: var(--secondary); }
[data-theme="dark"] .logo:hover .logo-image-container { box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
[data-theme="dark"] .logo-text { color: #ffd700; }

.nav-links { display: flex; gap: 1.5rem; font-weight: 500; }
.nav-links a { color: #ffffff; display: inline-block; transition: color 0.3s ease, transform 0.2s ease; }
.nav-links a:hover { color: var(--brand-gold); transform: scale(1.1); }
.header-actions { display: flex; gap: 1rem; align-items: center; }
#theme-toggle { background: none; border: none; font-size: 1.2rem; color: var(--brand-gold); cursor: pointer; }
.hamburger { display: none; font-size: 1.8rem; color: var(--brand-gold); cursor: pointer; z-index: 1001; }

/* FIXED: Changed right from -100% to -300px to stop off-screen overflow generation */
.mobile-menu { position: fixed; top: 0; right: -300px; width: 250px; height: 100%; background: var(--brand-dark-blue); border-left: 4px solid var(--brand-gold); box-shadow: -5px 0 15px rgba(0,0,0,0.5); z-index: 999; display: flex; flex-direction: column; padding: 5rem 2rem; gap: 2rem; transition: right 0.3s ease; }
.mobile-menu a { color: #ffffff; font-weight: 600; font-size: 1.2rem; }
.mobile-menu a:hover { color: var(--brand-gold); }
.mobile-menu.active { right: 0; }

/* --- Hero Section --- */
.hero { position: relative; height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; width: 100%; }
.slider { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
.slide { position: absolute; width: 100%; height: 100%; background-size: cover; background-position: center; opacity: 0; transition: opacity 1s ease; }
.slide.active { opacity: 1; }
.hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 51, 153, 0.5); z-index: 2; } 
.hero-content { position: relative; z-index: 3; text-align: center; color: white; max-width: 800px; padding: 0 1rem; width: 100%; }
.hero-content h1 { color: #ffffff; font-size: clamp(2rem, 3vw, 4rem); margin: 1rem 0; line-height: 1.2; text-shadow: 2px 2px 8px rgba(0,0,0,0.5); overflow-wrap: break-word; }
.badge { background: var(--brand-gold); color: var(--brand-dark-blue); padding: 0.4rem 1.2rem; border-radius: 20px; font-size: 0.9rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.hero-btns { margin-top: 2rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; justify-content: center; gap: 3rem; margin-top: 3rem; border-top: 1px solid rgba(255,215,0,0.4); padding-top: 2rem; flex-wrap: wrap; }
.hero-stats h3 { color: var(--brand-gold); font-size: 2.5rem; margin-bottom: -5px; }

/* --- Glass Cards & Containers --- */
.glass-card { background: var(--container-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 2.5rem; border-radius: 16px; border: 1px solid var(--glass-border); box-shadow: var(--shadow); width: 100%; max-width: 100%; }
.hover-effect:hover { transform: translateY(-5px); box-shadow: 0 12px 40px rgba(0,51,153,0.2); transition: 0.3s; border-color: var(--brand-gold); }

/* --- FIXED SECTION TITLES --- */
.section-title { text-align: center; font-size: clamp(1.8rem, 4vw, 2.5rem); margin-bottom: 2rem; position: relative; display: block; width: 100%; overflow-wrap: break-word; }
.section-title::after { content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 80px; height: 4px; background: var(--brand-gold); border-radius: 2px; }

.principal-img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin-bottom: 1.5rem; border: 4px solid var(--brand-gold); box-shadow: var(--shadow); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; width: 100%; }
.feature-item { padding: 1rem; background: var(--brand-light-blue); color: #000; border-radius: 8px; display: flex; align-items: center; gap: 0.8rem; font-weight: 600; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.feature-item i { color: var(--brand-dark-blue); font-size: 1.2rem; }
[data-theme="dark"] .feature-item { background: rgba(121, 166, 210, 0.2); color: #fff; border: 1px solid var(--glass-border); }
[data-theme="dark"] .feature-item i { color: var(--brand-gold); }

/* --- Masonry Gallery --- */
.masonry-gallery { column-width: 250px; column-count: 3; gap: 1.5rem; width: 100%; }
.masonry-gallery img { width: 100%; border-radius: 12px; margin-bottom: 1.5rem; break-inside: avoid; transition: transform 0.3s, box-shadow 0.3s; border: 2px solid transparent; }
.masonry-gallery img:hover { transform: scale(1.03); cursor: pointer; border-color: var(--brand-gold); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }

/* --- Forms & Inputs --- */
.contact-form { display: flex; flex-direction: column; gap: 1rem; width: 100%; }
.contact-form input, .contact-form textarea, .newsletter input { width: 100%; padding: 1rem; border-radius: 8px; border: 1px solid var(--glass-border); background: var(--bg-main); color: var(--text-main); font-family: inherit; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--brand-dark-blue); box-shadow: 0 0 0 3px rgba(121, 166, 210, 0.3); }

/* --- Timeline (Admissions) --- */
.timeline li { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--brand-dark-blue); overflow-wrap: break-word; }
[data-theme="dark"] .timeline li { border-bottom-color: var(--brand-gold); }
.timeline li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* --- FAQ Accordion --- */
.faq-item { margin-bottom: 1rem; border: 1px solid var(--brand-light-blue); border-radius: 8px; overflow: hidden; background: var(--bg-main); width: 100%; }
.faq-question { width: 100%; text-align: left; padding: 1.2rem; background: var(--container-bg); border: none; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; color: var(--text-main); font-size: 1.1rem; }
.faq-answer { padding: 0 1.2rem; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.faq-item.active .faq-answer { padding: 1.2rem; max-height: 500px; border-top: 1px solid var(--brand-light-blue); }
.faq-item.active .fa-chevron-down { transform: rotate(180deg); color: var(--brand-dark-blue); }
[data-theme="dark"] .faq-item.active .fa-chevron-down { color: var(--brand-gold); }

/* --- Footer --- */
.footer { background: var(--brand-dark-blue); color: #fff; padding-top: 4rem; border-top: 5px solid var(--brand-gold); width: 100%; }
.footer h3 { margin-bottom: 1.5rem; color: var(--brand-gold); font-size: 1.3rem; }
.footer p { color: #d1d5db; word-break: break-word; }
.footer i { color: var(--brand-gold); width: 25px; }
.footer-links li { margin-bottom: 0.8rem; }
.footer-links a { color: #d1d5db; }
.footer-links a:hover { color: var(--brand-gold); padding-left: 5px; }
[data-theme="dark"] footer .logo-text { color: #ffd700; }
.newsletter { display: flex; gap: 0.5rem; flex-wrap: wrap; width: 100%; }
.newsletter input { border: none; flex: 1; min-width: 0; }
.copyright { padding: 2rem 0; border-top: 1px solid rgba(255,255,255,0.1); color: #9ca3af; font-size: 0.9rem; margin-top: 2rem; width: 100%; text-align: center; }

/* --- Animations & Utilities --- */
.fade-up { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.fade-up.visible { opacity: 1; transform: translateY(0); }
.scroll-top { position: fixed; bottom: 30px; right: 30px; background: var(--brand-gold); color: var(--brand-dark-blue); border: none; width: 45px; height: 45px; border-radius: 50%; cursor: pointer; opacity: 0; transition: opacity 0.3s, transform 0.3s; z-index: 99; font-size: 1.2rem; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.scroll-top:hover { transform: translateY(-3px); }
.scroll-top.visible { opacity: 1; }

/* ========================================= */
/* --- MOBILE RESPONSIVE TWEAKS --- */
/* ========================================= */
@media (max-width: 768px) {
    .nav-links { display: none !important; }
    .header-actions .btn:not(.hamburger) { display: none !important; }
    .header-actions { display: flex !important; align-items: center !important; }
    
    .hamburger, .header .hamburger, .header-actions .hamburger { 
        display: block !important; visibility: visible !important; opacity: 1 !important; 
        position: relative !important; pointer-events: auto !important; z-index: 1001 !important; 
    }
    
    .header { padding: 0.5rem 5%; }
    .logo { gap: 0.5rem; }
    :root { --logo-height: 48px; } 
    .logo-text { font-size: 1.1rem; }
    
    .hero { height: auto; min-height: 85vh; padding-top: 100px; padding-bottom: 3rem; }
    .hero-stats { flex-direction: column; gap: 1.5rem; border-top: none; }
    
    .padding-container { padding: 3rem 5%; }
    
    .grid-2, .grid-3, .grid-4, .features-grid { display: flex; flex-direction: column; gap: 1.5rem; }
    .glass-card { padding: 1.5rem; }
    
    .newsletter { flex-direction: column; }
    .newsletter input { width: 100%; }
    
    .masonry-gallery { columns: 1 !important; gap: 1rem; } 
    .fade-up { opacity: 1; transform: none; transition: none; }
}

/* Dropdown Container */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Academics Button */
.dropdown-btn {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: 0.3s;
}

/* Dropdown Menu */
.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;

    background: #fffaf2;
    border-radius: 12px;
    overflow: hidden;

    box-shadow: 0 10px 30px rgba(0,0,0,0.12);

    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);

    transition: all 0.3s ease;
    z-index: 9999;
}

/* Dropdown Links */
.dropdown-content a {
    display: block;
    padding: 12px 18px;
    text-decoration: none;
    color: #333;
    font-size: 0.95rem;
    transition: 0.3s;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background: #f5ead8;
    color: #8b5e00;
    padding-left: 24px;
}

/* Show on Hover */
.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}



/* ========================================= */
/* --- PAGE LOADER --- */
/* ========================================= */
.loader-wrapper { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--brand-dark-blue); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 99999; transition: opacity 0.6s ease, visibility 0.6s ease; }
.loader-wrapper.hidden { opacity: 0; visibility: hidden; }
.loader-logo-container { height: 120px; width: 120px; border-radius: 50%; overflow: hidden; display: flex; justify-content: center; align-items: center; background: transparent; animation: pulseLogo 1.5s infinite alternate ease-in-out; }
.loader-brand-logo { width: 100%; height: 100%; object-fit: cover; transform: scale(1.15); }
.loader-text { margin-top: 2rem; font-family: 'Poppins', sans-serif; color: var(--brand-gold); font-weight: 700; font-size: 1.5rem; letter-spacing: 4px; animation: pulseText 1.5s infinite alternate ease-in-out; }

@keyframes pulseLogo { 0% { transform: scale(1); box-shadow: 0 0 15px rgba(255, 215, 0, 0.2); } 100% { transform: scale(1.08); box-shadow: 0 0 35px rgba(255, 215, 0, 0.6); } }
@keyframes pulseText { 0% { opacity: 0.5; } 100% { opacity: 1; } }

.new-loader-container { position: relative; width: 140px; height: 140px; display: flex; justify-content: center; align-items: center; margin-bottom: 1rem; }
.color-ring { position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 50%; border: 4px solid transparent; animation: spinAndColor 1.2s linear infinite; }
.ring-text { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.1rem; color: #ffffff; text-align: center; line-height: 1.2; letter-spacing: 2px; }

@keyframes spinAndColor { 0% { transform: rotate(0deg); border-top-color: #ffd700; } 33% { border-top-color: #003399; } 66% { border-top-color: #ffffff; } 100% { transform: rotate(360deg); border-top-color: #ffd700; } }


/* --- Blinking NEW Badge --- */
.new-badge {
    background-color: #dc2626; /* Bright Red */
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    letter-spacing: 1px;
    animation: blink 1s infinite;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 0 5px rgba(220, 38, 38, 0.5);
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.mobile-dropdown {
    width: 100%;
}

.mobile-dropdown-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    text-align: left;
    padding: 10px 0;
    cursor: pointer;
}

.mobile-dropdown-content {
    display: none;
    padding-left: 15px;
}

.mobile-dropdown-content a {
    display: block;
    padding: 8px 0;
    font-size: 0.95rem;
    color: #ddd;
}

.mobile-dropdown.active .mobile-dropdown-content {
    display: block;
}