/* --- Homepage Redesign (kid-space.css) --- */

/* Keyframe Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

@keyframes animateGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==========================================================================
   1. Hero Section
   ========================================================================== */
.hero-section-v3 {
    background: linear-gradient(135deg, var(--color-brand-secondary), var(--color-brand-primary));
    background-size: 200% 200%;
    animation: animateGradient 15s ease-in-out infinite;
    min-height: 70vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    color: var(--color-text-light, #ffffff);
    padding: var(--spacing-lg) 0;
}

.hero-grid-v3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: var(--spacing-xxl, 4rem);
    position: relative;
    z-index: 2;
    width: 100%;
}

.hero-text-content-v3 {
    animation: fadeInUp 0.8s ease-out;
    max-width: 100%;
}

.hero-text-content-v3 h1 {
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 4rem);
    text-shadow: 2px 2px 5px rgba(0,0,0,0.25);
    line-height: 1.2;
    margin: 0 0 var(--spacing-md, 1.5rem) 0;
    word-wrap: break-word;
}

.hero-text-content-v3 h1 .highlight-line {
    display: block;
    color: var(--color-brand-background-light);
}

.hero-text-content-v3 p {
    font-family: var(--font-family-system);
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    margin: 0 0 var(--spacing-xl, 2rem) 0;
    max-width: 500px;
    opacity: 0.95;
    line-height: 1.6;
    font-weight: 400;
}

.hero-cta-v3 {
    background-color: var(--color-white);
    color: var(--color-brand-primary);
    padding: var(--spacing-md, 1rem) var(--spacing-xl, 2rem);
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.2rem);
    box-shadow: 0 6px 0 #7c3a00;
    transition: all 0.15s ease-out;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    font-family: var(--font-family-system);
}

.hero-cta-v3:hover {
    transform: translateY(2px);
    box-shadow: 0 4px 0 #7c3a00;
    background-color: var(--color-brand-background-light);
}

.hero-cta-v3:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #7c3a00;
}

.hero-image-container-v3 {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeInDown 0.8s ease-out;
    width: clamp(250px, 35vw, 400px);
    margin: 0 auto;
    aspect-ratio: 1 / 1.3;
    border-radius: var(--border-radius-lg, 20px);
    overflow: hidden;
}

.hero-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.hero-background-shapes .shape {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    z-index: 1;
}

.shape-1 { width: 200px; height: 200px; top: 10%; left: 15%; animation: float 8s ease-in-out infinite; }
.shape-2 { width: 80px; height: 80px; top: 60%; left: 5%; animation: float 6s ease-in-out infinite reverse; }
.shape-3 { width: 50px; height: 50px; top: 20%; right: 10%; animation: float 7s ease-in-out infinite; }
.shape-4 { width: 120px; height: 120px; bottom: 10%; right: 20%; animation: float 9s ease-in-out infinite reverse; }

/* ==========================================================================
   2. Category Section
   ========================================================================== */
.kid-categories-v2 {
    background-color: var(--color-brand-background);
    padding: var(--spacing-xxl, 4rem) 0;
}

.section-header {
    text-align: center;
    margin-bottom: var(--spacing-xl, 3rem);
}

.section-header h2 {
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--color-text-dark, #333);
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
    margin: 0;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 4px;
    background: linear-gradient(to right, var(--color-brand-secondary), var(--color-brand-primary));
    border-radius: 2px;
}

.category-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-xl, 2rem);
    margin-top: var(--spacing-xl, 2rem);
}

.category-card-v2 {
    background-color: var(--color-white); /* <--- ADD THIS LINE */
    border-radius: var(--border-radius-md, 8px);
    padding: var(--spacing-lg, 2rem);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    transition: all 0.3s ease-out;
    text-decoration: none;
    color: inherit;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 200px;
    justify-content: center;
}

.category-card-v2:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.12);
    text-decoration: none;
    color: inherit;
}

.category-card-v2 .card-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md, 1rem);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.category-card-v2:hover .card-icon {
    transform: scale(1.1);
    animation: wiggle 0.5s ease;
}

.category-card-v2 .card-icon img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.category-card-v2 h3 {
    font-weight: 700;
    font-size: clamp(1.2rem, 1.5vw, 1.5rem);
    margin: 0 0 var(--spacing-sm, 0.5rem) 0;
    line-height: 1.3;
}

.category-card-v2 p {
    font-family: var(--font-family-system);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.5;
    margin: 0;
    opacity: 0.8;
    text-align: center;
    font-weight: 400;
}


/* ==========================================================================
   3. "Our Learning Hub" Section
   ========================================================================== */
.treehouse-section {
    background: linear-gradient(135deg, var(--color-treehouse-background-start), var(--color-treehouse-background-end));
    padding: var(--spacing-xxl, 4rem) 0;
}

.treehouse-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    align-items: center;
    gap: var(--spacing-xxl, 4rem);
}

.treehouse-illustration {
    position: relative;
    text-align: center;
}

.instructor-img {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: var(--border-radius-lg, 12px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    animation: float 5s ease-in-out infinite reverse;
}

.online-classes-badge {
    position: absolute;
    top: 15px;
    right: -10px;
    background: var(--color-brand-secondary);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 5px 15px var(--color-orange-cta-transparent-dark);
    transform: rotate(8deg);
    white-space: nowrap;
    font-family: var(--font-family-system);
}

.age-badge {
    display: block;
    font-size: 0.8rem;
    margin-top: 2px;
}

.treehouse-text-column h2 {
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.2rem);
    color: var(--color-treehouse-heading);
    margin-bottom: 5px;
    line-height: 1.2;
}

/* Shared tagline style for multiple sections */
.tagline {
    font-family: var(--font-family-system);
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 700;
    color: var(--color-treehouse-tagline);
    margin-bottom: var(--spacing-lg, 1.5rem);
    line-height: 1.3;
}

.treehouse-text-column p {
    font-family: var(--font-family-system);
    color: var(--color-treehouse-paragraph);
    line-height: 1.7;
    margin-bottom: var(--spacing-xl, 2rem);
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    font-weight: 400;
}

.treehouse-cta {
    background-color: var(--color-accent-green);
    color: white;
    font-family: var(--font-family-system);
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    font-weight: 700;
    padding: 15px 35px;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px var(--color-accent-green-transparent-light);
    display: inline-block;
}

.treehouse-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--color-accent-green-transparent-dark);
    text-decoration: none;
    color: white;
}

/* ==========================================================================
   4. "Why Choose Us?" Section
   ========================================================================== */
.unique-features-section {
    background-color: var(--color-brand-background-light);
    padding: var(--spacing-xxl, 4rem) 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-xl, 2rem);
}

.feature-item {
    padding: var(--spacing-lg, 2rem);
    text-align: center;
    border-radius: var(--border-radius-md, 8px);
    background-color: var(--color-white);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--box-shadow-light);
}

.feature-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--box-shadow-hover);
    border-color: var(--color-brand-secondary);
}

.feature-icon {
    margin: 0 auto 15px auto;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-icon img {
    width: 40px;
    height: 40px;
    filter: brightness(0) invert(1);
    object-fit: contain;
}

.feature-content h3 {
    font-weight: 700;
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    margin-bottom: 10px;
    line-height: 1.3;
    color: var(--color-brand-primary);
}

.feature-content p {
    font-family: var(--font-family-system);
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    color: var(--color-text-dark);
    line-height: 1.6;
    margin: 0;
    font-weight: 400;
}

/* ==========================================================================
   5. "A Partnership with Parents" Section
   ========================================================================== */
.parental-guidance-section {
    background-color: var(--color-parental-background-start);
    padding: var(--spacing-xxl, 4rem) 0;
}

.parental-content-wrapper {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    align-items: center;
    gap: var(--spacing-xxl, 4rem);
}

.parental-text-column h2 {
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 2.8rem);
    color: var(--color-parental-heading);
    margin-bottom: 5px;
    line-height: 1.2;
}

.parental-text-column p {
    font-family: var(--font-family-system);
    line-height: 1.7;
    color: var(--color-parental-text);
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    margin-bottom: var(--spacing-xl, 2rem);
    font-weight: 400;
}

.parental-text-column ul {
    list-style: none;
    padding-left: 0;
    margin: var(--spacing-lg, 1.5rem) 0;
}

.parental-text-column li {
    padding-left: 28px;
    position: relative;
    margin-bottom: var(--spacing-md, 1rem);
    font-weight: 600;
    color: var(--color-text-dark, #333);
    line-height: 1.5;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    font-family: var(--font-family-system);
}

.parental-text-column li::before {
    content: '⭐';
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 1.2em;
    color: var(--color-brand-secondary);
}

.parental-cta {
    background-color: var(--color-white);
    color: var(--color-brand-primary); /* Changed from white */
    border: 2px solid var(--color-brand-primary); /* Added border */
    font-family: var(--font-family-system);
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    font-weight: 700;
    padding: 14px 30px;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); /* Softened shadow */
    display: inline-block;
    margin-top: var(--spacing-md, 1rem);
}

.parental-cta:hover {
    transform: translateY(-3px);
    background: linear-gradient(45deg, var(--color-parental-cta-start), var(--color-parental-cta-end)); /* Gradient on hover */
    color: white; /* Text color changes to white */
    border-color: transparent; /* Hide border on hover */
    box-shadow: 0 8px 20px var(--color-parental-cta-transparent-dark);
    text-decoration: none;
}

.parental-image-column {
    text-align: center;
}

.parental-img {
    max-width: 100%;
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: var(--border-radius-lg, 12px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* ==========================================================================
   6. FAQ Section
   ========================================================================== */
.faq-section {
    background-color: var(--color-brand-background);
    padding: var(--spacing-xxl, 4rem) 0;
}

.faq-section .section-content-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.faq-header {
    text-align: center;
    margin-bottom: var(--spacing-xl, 2rem);
}

.faq-header h2 {
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 2.5rem);
    color: var(--color-brand-primary);
    margin: 0;
    line-height: 1.2;
}

.faq-container {
    max-width: 700px;
    margin: 0 auto;
}

.faq-item {
    background: #ffffff;
    border: 1px solid #e0d9d1;
    margin-bottom: var(--spacing-md, 1rem);
    border-radius: var(--border-radius-md, 8px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    overflow: hidden;
}

.faq-item.active {
    border-color: var(--color-brand-secondary);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.faq-question {
    font-family: var(--font-family-system);
    font-weight: 600;
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    color: var(--color-text-dark);
    padding: 18px 25px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1.4;
}

.faq-question:hover {
    background-color: var(--color-brand-background-light);
}

.faq-arrow {
    color: var(--color-brand-secondary);
    transition: transform 0.3s ease;
    font-size: 1.2em;
    margin-left: 1rem;
    flex-shrink: 0;
}

.faq-item.active .faq-arrow {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background-color: #fff;
}

.faq-answer p {
    padding: 0 25px 25px 25px;
    font-family: var(--font-family-system);
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    color: var(--color-text-dark);
    line-height: 1.7;
    margin: 0;
    border-top: 1px solid var(--color-brand-background);
    padding-top: 20px;
    font-weight: 400;
}

.faq-item.active .faq-answer {
    max-height: 300px; /* Adjust as needed for content length */
}

/* ==========================================================================
   7. Call to Action (CTA) Section
   ========================================================================== */
.cta-section {
    background: linear-gradient(135deg, var(--color-brand-primary), var(--color-brand-secondary));
    padding: var(--spacing-xxl, 4rem) 0;
    text-align: center;
    color: var(--color-text-light);
    animation: animateGradient 15s ease-in-out infinite;
    background-size: 200% 200%;
}

.cta-content-wrapper h2 {
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.2;
    margin-bottom: var(--spacing-md, 1rem);
}

.cta-content-wrapper p {
    font-family: var(--font-family-system);
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    line-height: 1.5;
    margin-bottom: var(--spacing-xl, 2rem);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-btn-main {
    background-color: var(--color-white);
    color: var(--color-brand-primary);
    padding: var(--spacing-md, 1rem) var(--spacing-xl, 2rem);
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.2rem);
    box-shadow: 0 6px 0 #7c3a00;
    transition: all 0.15s ease-out;
    display: inline-block;
}

.cta-btn-main:hover {
    transform: translateY(2px);
    box-shadow: 0 4px 0 #7c3a00;
    background-color: var(--color-brand-background-light);
}

.cta-btn-main:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #7c3a00;
}

/* ==========================================================================
   8. CSS Sprite Integration
   ========================================================================== */
/* Common class for the sprite element */
.sprite {
    display: inline-block;
    background-image: url('../../../assets/images/library/css_sprites.webp');
    background-repeat: no-repeat;
}

/* Remove background/shadow from original icon containers */
.feature-icon {
    background: none;
    box-shadow: none;
}

.category-card-v2 .card-icon {
    background-color: transparent;
}

/* Category Icons (New size: 60x60px) */
.category-card-v2 .sprite {
    width: 60px;
    height: 60px;
    background-size: 240px 180px; /* Scaled by 0.6 */
}

/* Feature Icons (New size: 50x50px) */
.feature-item .sprite {
    width: 50px;
    height: 50px;
    background-size: 200px 150px; /* Scaled by 0.5 */
}

/* Sprite Positions for Category Icons */
.sprite-book { background-position: -0px -60px; }
.sprite-qaida { background-position: -120px -60px; }
.sprite-quran { background-position: -60px -120px; }
.sprite-duas { background-position: -60px -60px; }
.sprite-audio { background-position: -0px -0px; }
.sprite-prophet { background-position: -0px -120px; }
.sprite-manners { background-position: -120px -0px; }

/* Sprite Positions for Feature Icons */
.sprite-authentic { background-position: -100px -100px; }
.sprite-focus { background-position: -150px -50px; }
.sprite-fun { background-position: -150px -0px; }
.sprite-safe { background-position: -150px -100px; }

/* ==========================================================================
   NEW: Featured Content Section
   ========================================================================== */
.featured-section {
    background-color: var(--color-brand-background);
    padding: var(--spacing-xxl, 4rem) 0;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl, 2rem);
}

.featured-card {
    display: flex;
    flex-direction: column;
    background-color: var(--color-white);
    border-radius: var(--border-radius-md, 12px);
    box-shadow: var(--box-shadow-light);
    overflow: hidden;
    text-decoration: none;
    color: var(--color-text-dark);
    transition: all 0.3s ease;
}

.featured-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--box-shadow-hover);
    text-decoration: none;
    color: var(--color-text-dark);
}

.featured-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.featured-card-content {
    padding: var(--spacing-lg, 1.5rem);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.featured-card-content h3 {
    font-size: clamp(1.2rem, 2vw, 1.4rem);
    margin: 0 0 var(--spacing-sm, 0.75rem) 0;
}

.featured-card-content p {
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.6;
    margin: 0 0 var(--spacing-md, 1rem) 0;
    flex-grow: 1;
}

.featured-card-cta {
    display: inline-block;
    align-self: flex-start;
    background-color: var(--color-brand-secondary);
    color: var(--color-white);
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.featured-card:hover .featured-card-cta {
    background-color: var(--color-brand-primary);
}

/* ==========================================================================
   9. Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
    .hero-grid-v3,
    .treehouse-content-wrapper,
    .parental-content-wrapper {
        gap: var(--spacing-xl, 2rem);
    }
    
    .category-grid-v2 {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--spacing-lg, 1.5rem);
    }
}

@media (max-width: 768px) {
    .hero-section-v3 {
        min-height: 60vh;
        padding: var(--spacing-xl, 2rem) 0;
        text-align: center;
    }
    
    .hero-grid-v3 {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg, 1.5rem);
    }
    
    .hero-text-content-v3 p {
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-image-container-v3 {
        order: -1;
        width: clamp(200px, 45vw, 280px);
    }
    
    .category-grid-v2,
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg, 1.5rem);
    }
    
    .category-card-v2,
    .feature-item {
        padding: var(--spacing-md, 1rem);
        min-height: auto;
    }
    
    .treehouse-content-wrapper,
    .parental-content-wrapper {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--spacing-lg, 1.5rem);
    }
    
    .treehouse-image-column { 
        order: -1; 
    }
    
    .parental-text-column li {
        text-align: left;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .faq-question {
        padding: 15px 20px;
    }
    
    .faq-answer p {
        padding: 0 20px 20px 20px;
    }
}

@media (max-width: 480px) {
    .hero-background-shapes .shape {
        display: none;
    }
    
    .online-classes-badge {
        position: static;
        transform: none;
        margin-top: var(--spacing-sm, 0.5rem);
        display: inline-block;
    }
    
    .category-card-v2 .card-icon {
        width: 70px;
        height: 70px;
    }
    
    .category-card-v2 .card-icon img {
        width: 35px;
        height: 35px;
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
    }
    
    .feature-icon img {
        width: 30px;
        height: 30px;
    }
}

/* ==========================================================================
   10. Print Styles
   ========================================================================== */
@media print {
    .hero-section-v3 {
        background: white;
        color: black;
    }
    
    .hero-section-v3 * {
        color: black !important;
    }

    .hero-background-shapes,
    .treehouse-cta,
    .parental-cta,
    .cta-section {
        display: none;
    }
}