@import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,700;0,900;1,700;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 992px) {
    .section {
        padding: 2.5rem;
    }
    
    .mission-vision {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .section {
        padding: 2rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .about-image {
        height: 300px;
    }
}

@media (max-width: 576px) {
    .section {
        padding: 1.5rem;
    }
    
    .stats {
        grid-template-columns: 1fr 1fr;
    }
    
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
    }
}

.hero-bg {
    background: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);
}

.subject-card {
    transition: all 0.3s ease;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.font-sinhala {
    font-family: 'Noto Serif Sinhala', serif;
}

@keyframes wave-animation {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(1.5deg); }
    50% { transform: rotate(0deg) translateX(1px); }
    75% { transform: rotate(-1.5deg); }
}

.waving-flag {
    animation: wave-animation 1.5s ease-in-out infinite;
    transform-origin: left center;
    filter: drop-shadow(0 3px 4px rgba(0,0,0,0.5));
}

.font-sinhala {
    font-family: 'Noto Serif Sinhala', serif;
}

h2 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .navbar-menu li {
        margin: 10px 0;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contact-card, .social-card {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.contact-card:nth-child(1) { animation-delay: 0.1s; }
.contact-card:nth-child(2) { animation-delay: 0.2s; }
.contact-card:nth-child(3) { animation-delay: 0.3s; }
.social-card:nth-child(1) { animation-delay: 0.1s; }
.social-card:nth-child(2) { animation-delay: 0.2s; }
.social-card:nth-child(3) { animation-delay: 0.3s; }
.social-card:nth-child(4) { animation-delay: 0.4s; }
.social-card:nth-child(5) { animation-delay: 0.5s; }
.social-card:nth-child(6) { animation-delay: 0.6s; }

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.responsive-ad-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(145deg, #1e1e1e, #292929);
    border: 2px solid #333;
    border-radius: 16px;
    overflow: hidden;
    max-width: 90%;
    margin: 30px auto;
    text-decoration: none;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    color: #eee;
    font-family: 'Poppins', sans-serif;
    animation: fadeIn 1s ease;
}

.responsive-ad-card:hover {
    box-shadow: 0 0 25px rgba(76, 175, 80, 0.5);
    transform: scale(1.02);
}

.responsive-ad-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-bottom: 1px solid #333;
}

.ad-text {
    padding: 20px;
    text-align: center;
}

.ad-text h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.ad-text p {
    margin-top: 10px;
    font-size: 15px;
    color: #bbb;
}

@media (min-width: 600px) {
    .responsive-ad-card {
        flex-direction: row;
    }

    .responsive-ad-card img {
        width: 240px;
        height: 100%;
        border-bottom: none;
        border-right: 1px solid #333;
    }

    .ad-text {
        text-align: left;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.waving-flag {
    animation: wave-animation 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes wave-animation-full {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(2deg) scale(1.05); }
    50% { transform: rotate(0deg) scale(1); }
    75% { transform: rotate(-2deg) scale(1.05); }
}

@media (max-width: 640px) {
    .waving-flag {
        animation: wave-mobile 3s ease-in-out infinite;
    }
}

@keyframes wave-mobile {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(3deg) scale(1.03); }
    50% { transform: rotate(0deg) scale(1); }
    75% { transform: rotate(-3deg) scale(1.03); }
}

@media (min-width: 768px) {
    .hover-scale:hover {
        transform: scale(1.1);
    }
}

.scroll-track {
    animation: scroll-left 20s linear infinite;
}

@keyframes scroll-left {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-50%);
    }
}

.scrollbar-visible::-webkit-scrollbar {
    height: 8px;
    background-color: #f3f4f6;
}

.scrollbar-visible::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 4px;
}

.scrollbar-visible::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

@media (max-width: 767px) {
    .subject-card {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
}

@media (min-width: 768px) {
    .scrollbar-visible {
        overflow-x: visible;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.custom-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 0.75rem;
    background: linear-gradient(to bottom right, #3b82f6, #8b5cf6);
    font-weight: bold;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.5), 0 4px 6px -2px rgba(139, 92, 246, 0.4);
    color: white;
    font-size: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.4s ease;
    white-space: nowrap;
    text-align: center;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .custom-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
        min-width: 80px;
    }
}

.custom-btn:hover {
    box-shadow: 0 12px 20px rgba(59, 130, 246, 0.7);
    transform: scale(1.02);
}

.custom-btn:active {
    transform: scale(0.95);
}

.subject-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.subject-btn {
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    min-width: 120px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.subject-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Color schemes for each subject */
.combined {
    background-color:#fef2f2;
    color:  #3b82f6;
    border-color: #3b82f6;
}

.physics {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #dc2626;
}

.chemistry {
    background-color: #f0fdf4;
    color: #16a34a;
    border-color: #16a34a;
}

.biology {
    background-color: #fdf2f8;
    color: #ec4899;
    border-color: #ec4899;
}

.ict {
    background-color: #f5f3ff;
    color: #7c3aed;
    border-color: #7c3aed;
}

@media (max-width: 767px) {
    .subject-buttons {
        max-width: 300px;
        margin: 0 auto;
    }
    
    .subject-btn {
        flex: 1 1 calc(50% - 12px);
    }
    
    .subject-btn:last-child:nth-child(odd) {
        flex: 1 1 100%;
        max-width: calc(50% + 6px);
    }
}

@media (min-width: 768px) {
    .subject-buttons {
        flex-wrap: nowrap;
    }
}

.transform-style-preserve-3d {
    transform-style: preserve-3d;
}

.perspective-1000 {
    perspective: 1000px;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

@keyframes float-slow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-float-slow {
    animation: float-slow 6s ease-in-out infinite;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-container {
    position: relative;
    background: rgb(255, 255, 255);
    border-radius: 10px;
    padding: 20px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.close-btn:hover {
    background: #ff6b81;
    transform: rotate(90deg);
}

.popup-image {
    width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgb(0, 0, 0);
    margin-bottom: 15px;
}

.popup-text {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
}

.popup-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #2c3e50;
}

.popup-description {
    font-size: 16px;
    line-height: 1.5;
    display: inline;
    position: relative;
}

.inline-gif {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    margin-left: 5px;
    margin-bottom: 0.2em;
    transition: transform 0.3s ease;
}

.inline-gif:hover {
    transform: scale(1.2);
}

@media (min-width: 1024px) {
    .popup-container {
        padding: 10px;
        max-width: 400px;
    }

    .popup-title {
        font-size: 28px;
    }

    .popup-description {
        font-size: 15px;
    }
}

.section-shadow {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

#countdown-days, 
#countdown-hours, 
#countdown-minutes, 
#countdown-seconds {
    transition: all 0.3s ease;
}

@media (max-width: 640px) {
    #countdown-days, 
    #countdown-hours, 
#countdown-minutes, 
#countdown-seconds {
        font-size: 1.5rem;
    }
    
    .countdown-container {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    #countdown-days, 
    #countdown-hours, 
#countdown-minutes, 
#countdown-seconds {
        font-size: 1.25rem;
    }
    
    #countdown-message {
        font-size: 0.7rem;
    }
    
    .countdown-container {
        padding: 0.5rem;
    }
}

#modalCloseBtn {
    position: absolute;
    top: -40px;
    right: 0;
}

@media (min-width: 768px) {
    #modalCloseBtn {
        top: -48px;
        right: -48px;
    }
}

@media (max-width: 480px) {
    #modalCloseBtn {
        top: -36px;
        right: 0;
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
}

#modalCloseBtn:hover {
    transform: scale(1.1);
}