/* =================================
   GLOBAL STYLES & DESIGN PHILOSOPHY
   ================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --bg-color: #FAF9F6;
    --text-color: #333333;
    --primary-color: #C0392B;
    --container-bg: #FFFFFF;
    --border-color: #EAEAEA;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --header-height: 70px;
}

/* =================================
   STRUCTURAL LAYOUT & BODY STYLES
   ================================= */

/* This ensures the page structure can fill the screen height */
html {
    height: 100%;
}

/* This is the SINGLE, CORRECTED body rule */
body {
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    transition: background-color 0.3s, color 0.3s;
}

main {
    flex-grow: 1; /* Make the main content area grow to fill available space */
}

body.dark-theme {
    --bg-color: #121212;
    --text-color: #EAEAEA;
    --primary-color: #E74C3C;
    --container-bg: #1E1E1E;
    --border-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}


/* =================================
   HEADER & NAVIGATION
   ================================= */
header {
    background-color: var(--container-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s;
}

header .container {
    display: flex;
    justify-content: space-between; /* Normal pages keep original layout */
    align-items: center;
    height: 100%;
}

/* Logo for normal pages */
header .logo img {
    height: 50px;
    width: auto;
    display: block;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 25px;
}

/* HEADER TEXT SIZE INCREASED */
header nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 18px; /* Increased from 17px */
    padding: 5px 0;
    position: relative;
    transition: color 0.3s;
}

header nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

header nav a:hover {
    color: var(--primary-color);
}

header nav a:hover::after {
    width: 100%;
}

.switches {
    display: flex;
    align-items: center;
    gap: 20px;
}

#lang-switch button,
#theme-switch button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    font-size: 17px; /* Increased from 16px */
    font-weight: 600;
    opacity: 0.6;
    transition: opacity 0.3s, color 0.3s;
}

#lang-switch button.active {
    opacity: 1;
    color: var(--primary-color);
}

#theme-switch button {
    font-size: 24px; /* Increased from 22px */
}

/* =================================
   HERO SECTION (Logo only)
   ================================= */
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    min-height: 350px;
    background-color: var(--container-bg);
    transition: background-color 0.3s;
}

.hero-content {
    text-align: center;
}

.hero-center-logo {
    max-width: 280px;
    width: 100%;
    height: auto;
}

.dark-theme .hero-center-logo {
    filter: brightness(0) invert(1);
}

/* =================================
   GENERAL PAGE STYLES
   ================================= */
main {
    padding: 60px 0;
}
.homepage-main {
    padding-top: 0;
}

/* Normal pages need padding to not overlap with header */
.page-header {
    text-align: center;
    margin-bottom: 50px;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

article,
.library-section,
.info-box { 
    background: var(--container-bg);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: background-color 0.3s;
}

article h2,
.info-box h2 { 
    margin-bottom: 15px;
    font-size: 1.8rem;
    color: var(--primary-color);
}

/* =================================
   SLIDER FOR NEWS & EVENTS
   ================================= */
.slider-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}
.slider {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* Modern video/photo aspect ratio */
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 5px 15px var(--shadow-color);
}
.slide {
    display: none; /* Hide all slides by default */
    width: 100%;
    height: 100%;
    animation: fadeEffect 0.8s;
}
.slide.active {
    display: block; /* Show only the active slide */
}
.slide img, .slide video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Use 'contain' to avoid cropping video/photo */
    background-color: #000; /* Letterbox color for non-matching aspect ratios */
}

/* Next & previous buttons */
.slider-btn {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.3s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.4);
    border: none;
}
.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}
.slider-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Fade animation */
@keyframes fadeEffect {
    from {opacity: .4}
    to {opacity: 1}
}

.slide img, .slide video {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    background-color: #000;
}

/* =================================
   ACCORDION LIST FOR LIBRARY
   ================================= */
.accordion-item {
    background-color: var(--container-bg);
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px var(--shadow-color);
}
.accordion-header {
    display: block;
    width: 100%;
    padding: 20px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    position: relative;
    list-style: none; /* Removes default marker */
}
.accordion-header::-webkit-details-marker {
    display: none; /* Hides default marker in Chrome/Safari */
}
.accordion-header::after { /* Custom Arrow */
    content: '+';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}
.accordion-item[open] > .accordion-header::after {
    transform: translateY(-50%) rotate(45deg);
}
.accordion-content {
    padding: 0 20px 20px 20px;
}
.resource-list {
    list-style: none;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}
.resource-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}
.resource-list li:last-child {
    border-bottom: none;
}
.resource-info strong {
    font-size: 1.1rem;
    display: block;
    margin-bottom: 5px;
}
.resource-info p {
    font-size: 0.95rem;
    opacity: 0.8;
}

/* =================================
   FOOTER - REDUCED PADDING
   ================================= */
footer {
    background-color: var(--container-bg);
    border-top: 1px solid var(--border-color);
    text-align: center;
    padding: 20px 0; /* Reduced from 30px to 20px */
    margin-top: 0; /* Removed margin-top completely */
    transition: background-color 0.3s, border-top 0.3s;
}

footer .social-links a {
    text-decoration: none;
    color: var(--text-color);
    margin: 0 12px;
    font-size: 1.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

footer .social-links a:hover {
    color: var(--primary-color);
    transform: scale(1.2);
}

/* =================================
   MOBİL MENÜ (HAMBURGER) STYLES
   ================================= */
#mobile-menu-button {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
}

#mobile-menu-button span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    #mobile-menu-button {
        display: flex;
    }

    header nav {
        display: flex;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background-color: var(--container-bg);
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.5s ease-in-out;
        border-bottom: 1px solid var(--border-color);
        z-index: 999;
    }

    header nav.nav-active {
        max-height: 500px;
    }

    header nav ul {
        flex-direction: column;
        padding: 20px;
        width: 100%;
        text-align: center;
    }
    
    /* Homepage mobile fixes */
    .hero-top-logos {
        position: relative;
        top: 20px;
        display: flex;
        justify-content: space-between;
        padding: 0 20px;
    }
    
    .logo-top-left,
    .logo-top-right {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
    }
    
    .partner-logo {
        max-height: 100px; /* Smaller logos on mobile */
    }
    
    /* Mobile header adjustments */
    .header-transparent .switches {
        position: relative;
        right: auto;
    }
    
    .header-transparent #mobile-menu-button {
        position: relative;
        left: auto;
    }
    
    /* Ensure proper spacing */
    .main-hero {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
}

/* =================================
   HOMEPAGE SPECIFIC FIXES
   ================================= */
.homepage-main {
    padding-top: 0;
}

/* =================================
   INFO BOX SPECIFIC STYLES
   ================================= */
.info-box ul {
    margin-top: 20px;
    padding-left: 20px;
}

.info-box ul li {
    margin-bottom: 15px;
}

/* =================================
   PUBLISHER & BOOK GALLERY STYLES
   ================================= */

/* Publisher Logo and Title */
.publisher-logo {
    display: block;
    max-width: 200px;
    margin: 0 auto 20px;
}

.page-header h1 {
    font-size: 2rem;
}

/* Book Gallery Container */
.book-gallery {
    padding-top: 30px;
}

/* Grid layout for the books */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
}

/* Individual book item styling */
.book-item {
    background-color: var(--container-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    text-align: center;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.book-item a {
    text-decoration: none;
    color: var(--text-color);
    display: block;
    padding-bottom: 20px;
}

.book-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

.book-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 15px 10px 0;
    min-height: 40px;
}

/* =================================
   ISLAM PAGE - FEATURED ARTICLES
   ================================= */

.featured-articles {
    display: flex;
    justify-content: space-between;
    gap: 25px;
    flex-wrap: wrap;
}

.article-card {
    flex: 1;
    min-width: 280px;
    background-color: var(--container-bg);
    border-radius: 12px;
    box-shadow: 0 6px 15px var(--shadow-color);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.article-card a {
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.card-caption {
    padding: 20px;
    background-color: var(--container-bg);
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-caption h3 {
    font-size: 1.15rem;
    text-align: center;
    font-weight: 600;
}

/* More info link section */
.more-info-link {
    margin-top: 60px;
    padding: 30px;
    background-color: var(--container-bg);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 6px 15px var(--shadow-color);
}

.more-info-link p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.btn-more {
    display: inline-block;
    padding: 12px 25px;
    background-color: var(--primary-color);
    color: #FFFFFF;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.btn-more:hover {
    background-color: #A93226;
}

/* =================================
   HOMEPAGE - OTHER SECTIONS
   ================================= */

/* Section with Background Image */
.text-with-bg {
    position: relative;
    padding: 80px 20px;
    background-image: url('/images/Medrase.jpg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.text-with-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.framed-content {
    position: relative;
    z-index: 2;
    background-color: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 50px;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    color: #FFFFFF;
}

.framed-content h2 {
    color: #FFFFFF;
    margin-bottom: 20px;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
}

.framed-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
}

/* Homepage Features Section */
.features {
    padding: 60px 0;
    background-color: var(--bg-color);
}

.features .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.feature-card h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.feature-card .link {
    display: inline-block;
    margin-top: 20px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* =================================
   FINAL HOMEPAGE LAYOUT
   ================================= */

/* STRUCTURAL FIX FOR FOOTER GAP */
html, body { height: 100%; }
body { display: flex; flex-direction: column; }
main { flex-grow: 1; }

.homepage-main.new-layout {
    padding-top: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Full viewport height */
}

/* 1. Full-Screen Hero Section */
.main-hero {
    position: relative;
    flex-grow: 1;
    background-image: url('/images/Yaounde.jpg');
    background-size: cover;
    background-position: center;
    min-height: 100vh; /* Full viewport height to ensure no gap */
}

.main-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.8) 100%);
}

/* Transparent Header Styling - ONLY for Homepage */
header.header-transparent {
    background-color: transparent;
    box-shadow: none;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1001;
}

/* Homepage specific header container */
.header-transparent .container {
    justify-content: center; /* Center navigation for homepage only */
}

/* Homepage navigation centered */
.header-transparent .nav-centered {
    display: flex;
    align-items: center;
}

/* Homepage switches position */
.header-transparent .switches {
    position: absolute;
    right: 20px;
}

/* Homepage mobile menu position */
.header-transparent #mobile-menu-button {
    position: absolute;
    left: 20px;
}

/* White text for transparent header (homepage only) */
.header-transparent nav a,
.header-transparent #lang-switch button,
.header-transparent #mobile-menu-button span,
.header-transparent #theme-switch button {
    color: #FFFFFF;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Master container for all bottom content */
.hero-bottom-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 5% 4%;
    gap: 20px;
}

/* TOP LOGOS POSITIONING */
.hero-top-logos {
    position: absolute;
    top: 100px; /* Below header */
    left: 0;
    width: 100%;
    padding: 0 5%;
    z-index: 10;
}

.logo-top-left {
    position: absolute;
    left: 5%;
    top: 0;
}

.logo-top-right {
    position: absolute;
    right: 5%;
    top: 0;
}

/* Left Logo Container */
.hero-logos-container {
    flex-basis: 30%; /* Increased width for bigger logo */
    text-align: left;
}

/* Right Logo Container */
.hero-logos-container-right {
    flex-basis: 30%; /* Increased width for bigger logo */
    text-align: right;
}

/* LOGOS SIZE INCREASED */
.partner-logo {
    max-width: 100%;
    max-height: 220px; /* Increased from 180px */
    height: auto;
}

/* Dark mode filter for the specific logo */
.dark-theme .logo-inverts-dark {
    filter: brightness(0) invert(1);
}
.announcement-card {
    background: var(--container-bg);
    border-radius: 12px;
    box-shadow: 0 6px 20px var(--shadow-color);
    overflow: hidden;
    text-align: center;
    max-width: 900px; /* Maximum width for the card */
    margin: 0 auto; /* Center the card */
    padding: 20px; /* Add padding inside the card */
}

.announcement-card img {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    background-color: var(--bg-color);
    border-radius: 8px; /* Rounded corners for the image */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Subtle shadow for the image */
}
/* =================================
   MOBILE RESPONSIVE FIXES FOR HOMEPAGE
   ================================= */
@media (max-width: 768px) {
    /* Homepage logo positioning for mobile */
    .hero-top-logos {
        position: absolute;
        top: 80px; /* Closer to header on mobile */
        left: 0;
        width: 100%;
        padding: 0 10px;
        z-index: 10;
    }
    
    .logo-top-left {
        position: absolute;
        left: 10px;
        top: 0;
    }
    
    .logo-top-right {
        position: absolute;
        right: 10px;
        top: 0;
    }
    
    /* Smaller logos on mobile */
    .partner-logo {
        max-height: 100px; /* Much smaller on mobile */
    }
    
    /* Optional: Add white background for better visibility */
    .logo-top-left .partner-logo,
    .logo-top-right .partner-logo {
        background: rgba(255, 255, 255, 0.8);
        padding: 10px;
        border-radius: 8px;
    }
}

/* For very small screens */
@media (max-width: 480px) {
    .partner-logo {
        max-height: 80px; /* Even smaller */
    }
    
    .hero-top-logos {
        top: 70px;
    }
}