/* =========================================
   1. GLOBAL RESET & BASE STYLES
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa; /* Light grey to make white cards pop */
}

.welcome-text {
    font-size: 3rem;
    color: #333;
    margin-top: 40px;
    text-align: center;
}

/* =========================================
   2. GRADE CARDS SECTION
   ========================================= */
.grades-grid {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap; 
    padding: 40px 20px;
}

.grade-card {
    background: white;
    border-radius: 30px;
    padding: 30px;
    width: 250px;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: 0.3s ease;
    border: 8px solid white;
    display: block; /* Makes the entire card clickable */
}

.grade-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

/* Icon & Animation */
.card-icon {
    font-size: 5rem;
    margin-bottom: 15px;
    display: inline-block;
    transition: 0.3s;
}

.grade-card:hover .card-icon {
    transform: scale(1.2) rotate(5deg);
}

/* Card Button Look */
.grade-card .btn-enter {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 25px;
    background: #333;
    color: white !important;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    transition: 0.3s;
}

.grade-card:hover .btn-enter {
    background: #000;
}

/* Card Color Themes */
.kg-theme { border-color: #ff9999; color: #d32f2f; }
.g123-theme { border-color: #99ccff; color: #1976d2; }
.g45-theme { border-color: #99ff99; color: #388e3c; }

/* =========================================
   3. FOOTER SECTION
   ========================================= */
.kids-life-footer {
    background: #008080; /* Teal background color */
    color: #ffffff;
    padding: 40px 0 30px 0;
    border-top: 5px solid #e67e22; /* Orange accent top border */
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    flex-wrap: wrap;
}

.footer-left {
    font-size: 14px;
    opacity: 0.9;
}

.footer-left strong { color: #fff; }

.designer a {
    color: #e67e22;
    text-decoration: none;
    font-weight: bold;
}

.designer a:hover {
    text-decoration: underline;
}

/* Footer Right: Socials & Scroll */
.footer-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

.social-section {
    display: flex;
    align-items: center; 
    gap: 5px;
}

.follow-text {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

/* CSS-Only Curved Arrow (Replaces arrow-curve.png) */
.css-arrow-curve {
    width: 25px;
    height: 15px;
    border-bottom: 3px solid rgba(255, 255, 255, 0.7);
    border-right: 3px solid rgba(255, 255, 255, 0.7);
    border-radius: 0 0 15px 0;
    margin: 0 10px;
    position: relative;
    transform: rotate(-10deg);
    display: inline-block;
}

.css-arrow-curve::after {
    content: '';
    position: absolute;
    right: -5px;
    bottom: -7px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 7px solid rgba(255, 255, 255, 0.7);
    transform: rotate(-45deg);
}

/* Social Icons */
.social-icons {
    display: flex;
    gap: 12px;
}

.social-link {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    font-size: 18px;
}

.social-link:hover {
    transform: translateY(-5px);
}

.social-link.facebook:hover { background: #1877F2; }
.social-link.instagram:hover { background: #E4405F; }
.social-link.whatsapp:hover { background: #25D366; }

/* Scroll Top Button */
.scroll-top {
    background: #e67e22;
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    display: none; /* Initially hidden, shown via JavaScript */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.scroll-top:hover {
    background: #d35400;
    transform: scale(1.1);
}

/* =========================================
   4. RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 25px;
    }
    .footer-right {
        flex-direction: column;
        gap: 20px;
    }
    .css-arrow-curve {
        display: none; /* Hide decorative arrow on small screens */
    }
    .welcome-text {
        font-size: 2rem;
    }
}

/* --- Header Base Styles --- */
.main-header {
    background-color: #fff;
    padding: 10px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between; /* Keeps logo left, nav right */
    align-items: center;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
    gap: 15px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.school-logo-img {
    height: 50px;
    width: auto;
}

.logo-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #0056b3;
}

/* --- Navigation & Buttons --- */
.nav-links {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-item {
    text-decoration: none;
    color: #333;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

.login-btn {
    background-color: #0061bd;
    color: white;
    padding: 10px 18px;
    border-radius: 25px;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    transition: transform 0.2s, background 0.2s;
    white-space: nowrap; /* Prevents text inside button from breaking */
}

.login-btn:hover {
    background-color: #004485;
    transform: translateY(-2px);
}

.login-btn.admin {
    background-color: #004485; /* Slightly darker for distinction */
}

/* --- Responsive Media Queries --- */

/* Tablet and Small Laptops */
@media (max-width: 992px) {
    .header-container {
        justify-content: center; /* Center everything if it starts to cramp */
    }
}

/* Mobile Devices */
@media (max-width: 600px) {
    .header-container {
        flex-direction: column; /* Stack logo on top of nav */
        text-align: center;
    }

    .nav-links {
        justify-content: center;
        flex-direction: column; /* Stack buttons vertically */
        width: 100%;
        gap: 10px;
    }

    .login-btn {
        width: 100%; /* Make buttons full width on mobile */
        text-align: center;
        box-sizing: border-box;
    }
    
    .logo-text {
        font-size: 1.5rem; 
    }
}
/* Custom tweak for the numbers page if needed */
#numbersGrid .letter-block span {
    font-size: 3.5rem; /* Numbers usually need a bit more space */
    font-family: 'Fredoka', sans-serif;
}

/* If you want the title to be a different color for Math */
.page-title {
    color: #d32f2f; /* Reddish for Math */
    font-size: 2.5rem;
}

/* --- Tables Page Specifics --- */
.table-controls {
    text-align: center;
    margin-bottom: 30px;
}

.table-controls select {
    padding: 10px 20px;
    font-size: 1.2rem;
    border-radius: 15px;
    border: 2px solid #0061bd;
    font-family: 'Fredoka', sans-serif;
    outline: none;
    cursor: pointer;
}

.tables-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
}

.table-row {
    width: 100%;
    padding: 15px;
    border-radius: 15px;
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 5px 0 rgba(0,0,0,0.1);
    transition: all 0.1s ease;
    user-select: none;
    font-family: 'Fredoka', sans-serif;
}

.table-row:hover {
    transform: scale(1.02);
}

.table-row.pressed {
    transform: translateY(4px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .table-row {
        font-size: 1.4rem;
        padding: 10px;
    }
}
/* --- Shapes Page Styling --- */
.shape-block {
    flex-direction: column; /* Stack icon on top of text */
    gap: 5px;
}

.shape-icon {
    font-size: 3.5rem;
    line-height: 1;
}

.shape-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 1px;
}

/* Specific adjustment for shape grid to make blocks slightly larger */
#shapesGrid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

/* Mobile Tweak */
@media (max-width: 600px) {
    #shapesGrid {
        grid-template-columns: repeat(2, 1fr); /* 2 bigger shapes per row on mobile */
    }
    .shape-icon {
        font-size: 2.5rem;
    }
    .shape-name {
        font-size: 1rem;
    }
}
/* --- Addition Page Styling --- */
.addition-block {
    flex-direction: column;
    padding: 20px;
    min-height: 150px;
}

.math-problem {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

.math-answer {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.1);
    padding: 5px 15px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* Make addition grid a bit wider for math problems */
@media (min-width: 768px) {
    #additionGrid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    #additionGrid {
        grid-template-columns: repeat(2, 1fr);
    }
    .math-problem {
        font-size: 1.8rem;
    }
}
/* Ensure header is clean and responsive */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* This prevents the overlap you saw */
    padding: 10px 5%;
}

.top-nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Ensure the grid looks like the screenshot you shared */
.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 30px;
}
.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); /* Larger blocks for fun */
    gap: 20px;
    padding: 20px;
}

.letter-block {
    min-height: 150px; /* Make blocks square-ish */
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(0,0,0,0.1);
    transition: 0.1s;
    color: white;
    font-weight: bold;
}

.letter-block:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}
.g45-theme {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); /* Bright Cyan/Blue */
    border-bottom: 5px solid #00c6fb;
    transition: transform 0.2s ease-in-out;
}

.g45-theme:hover {
    transform: translateY(-5px); /* Gentle lift when hovering */
}
/* Card Icon Container Fix */
.grade-card .card-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

/* Specific styling for the logo inside the card */
.grade-icon-img {
    width: 80px; /* Reduced from 100px for better balance */
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

/* Fun hover effect for the logo */
.grade-card:hover .grade-icon-img {
    transform: scale(1.1) rotate(-5deg);
}

/* Kindergarten specific theme (consistent with your green style) */
.kg-theme {
    background: #ffffff;
    border: 3px solid #8AC926;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    display: block;
    box-shadow: 0 8px 0 #7fb822; /* Playful 3D look */
} 