:root {
    --primary: #071530;
    --secondary: #3e4d6e;
    --accent: #ff3131;
    --white: #ffffff;
    --light-bg: rgba(255, 255, 255, 0.05);
    --card-bg: rgba(7, 21, 48, 0.95);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* Support pour iPhone - fond jusqu'en bas */
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* BACKGROUND FIXE POUR DESKTOP avec ::before */
html::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Support iPhone - descend jusqu'en bas */
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background-image: url("../images/photoAccueil.jpg");
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: -1;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.6;
    color: var(--white);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: transparent;
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* Support pour iPhone - descend jusqu'en bas de la barre */
    padding-bottom: env(safe-area-inset-bottom);
}

.main-header {
    background-color: var(--primary);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.main-header.scrolled {
    background-color: rgba(7, 21, 48, 0.95);
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    z-index: 1003;
    height: 100%;
}

.logo a {
    display: flex;
    align-items: center;
    height: 100%;
}

.logo img {
    display: block;
    height: 40px;
    filter: invert(1);
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 1rem;
}

.nav-links>a,
.nav-links>div {
    color: var(--white);
    text-decoration: none;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.nav-links a:hover {
    background-color: var(--secondary);
}

.search-container {
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
    height: 100%;
}

.search-bar {
    background: var(--light-bg);
    border: 1px solid var(--secondary);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    color: var(--white);
    min-width: 200px;
    width: 100%;
    max-width: 300px;
    height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

main {
    margin-top: 80px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.hero-section {
    text-align: center;
    padding: 4rem 2rem;
    margin: -2rem -2rem 2rem -2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/photoAccueil.jpg') center/cover;
    opacity: 0.1;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--white);
    margin-bottom: 1.5rem;
    animation: slideInFromTop 1s ease-out;
}

.hero-subtitle {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    animation: fadeIn 1s ease-out 0.5s both;
}

.hero-description {
    font-size: clamp(1rem, 2vw, 1.1rem);
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    animation: fadeIn 1s ease-out 1s both;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

.scroll-indicator i {
    color: var(--white);
    font-size: 2rem;
}

.latest-articles {
    margin: 3rem 0;
}

.latest-articles h2 {
    text-align: center;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: var(--white);
    margin-bottom: 2rem;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
    width: 100%;
}

.article-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.5s ease-out forwards;
}

.article-card:hover {
    transform: translateY(-5px);
}

.article-content-inner {
    padding: 1.5rem;
}

.article-category {
    display: inline-block;
    background: var(--secondary);
    color: var(--white);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.article-title {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    margin-bottom: 1rem;
    color: var(--white);
    word-wrap: break-word;
}

.article-title a {
    color: inherit;
    text-decoration: none;
}

.article-excerpt {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
    word-wrap: break-word;
    line-height: 1.6;
}

.article-meta {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.read-more {
    background: var(--secondary);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.read-more:hover {
    background: var(--accent);
}

.search-results {
    padding: 2rem 0;
    background: rgba(7, 21, 48, 0.9);
    margin: 2rem 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
}

.article-count {
    color: var(--white);
    font-size: 0.9em;
    margin-top: 0.5rem;
    text-align: center;
    opacity: 0.8;
}

.loading-articles {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    padding: 2rem;
}

footer {
    background: var(--primary);
    padding: 4rem 0 2rem;
    margin-top: 6rem;
    position: relative;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/photoAccueil.jpg') center/cover;
    opacity: 0.05;
    pointer-events: none;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    position: relative;
    z-index: 1;
}

.footer-section {
    display: flex;
    flex-direction: column;
}

.footer-section h4 {
    font-size: clamp(1.1rem, 2vw, 1.2rem);
    margin-bottom: 1.5rem;
    color: var(--white);
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 2px;
    background: var(--accent);
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-links a:hover {
    color: var(--accent);
    transform: translateX(5px);
}

.social-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.social-links a {
    color: var(--white);
    font-size: 1.5rem;
    transition: all 0.3s ease;
    opacity: 0.8;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.social-links a:hover {
    opacity: 1;
    background: var(--accent);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

@keyframes slideInFromTop {
    0% {
        transform: translateY(-50px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) translateX(-50%);
    }
    40% {
        transform: translateY(-20px) translateX(-50%);
    }
    60% {
        transform: translateY(-10px) translateX(-50%);
    }
}

/* ========================================
   RESPONSIVE MOBILE - SOLUTION QUI FONCTIONNE
   ======================================== */
@media (max-width: 768px) {
    /* REMPLACER L'IMAGE DE FOND PAR L'IMAGE MOBILE */
    html::before {
        background-image: url("../images/photoAccueilTel.jpg") !important;
        background-position: center center !important;
        background-size: cover !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    html {
        height: 100%;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        overflow-x: hidden;
        margin: 0;
        padding: 0;
    }
    
    body {
        background: transparent;
        overflow-x: hidden;
        width: 100%;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        margin: 0;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .nav-container {
        padding: 0.5rem 1rem;
        position: relative;
        height: 60px;
        justify-content: space-between;
        align-items: center;
    }

    #burgerMenu {
        display: block;
        position: absolute;
        top: 50%;
        right: 20px;
        transform: translateY(-50%);
        z-index: 1003;
        border-radius: 4px;
        padding: 2px;
    }

    #burger-icon {
        display: flex;
        flex-direction: column;
        width: 30px;
        height: 30px;
        justify-content: center;
        align-items: center;
    }

    #burger-icon span {
        display: block;
        width: 25px;
        height: 3px;
        margin: 2px 0;
        background-color: var(--white);
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    #burgerMenu.active #burger-icon span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    #burgerMenu.active #burger-icon span:nth-child(2) {
        opacity: 0;
    }

    #burgerMenu.active #burger-icon span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    /* BOUTON DE RECHERCHE MOBILE */
    .mobile-search-btn {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: var(--accent);
        border: none;
        border-radius: 50%;
        width: 45px;
        height: 45px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        z-index: 1002;
        cursor: pointer;
        font-size: 1.3rem;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(255, 49, 49, 0.3);
    }

    .mobile-search-btn.active {
        background: var(--secondary);
    }

    .mobile-search-expanded {
        position: fixed;
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 400px;
        z-index: 2000;
        display: none;
        animation: slideDown 0.3s ease-out;
    }

    .mobile-search-expanded.active {
        display: block;
    }

    .mobile-search-expanded .search-input {
        width: 100%;
        padding: 14px 18px;
        border-radius: 30px;
        border: 2px solid var(--accent);
        background: var(--primary);
        color: white;
        font-size: 1.1rem;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
        text-align: center;
    }

    .mobile-search-expanded .search-input:focus {
        outline: none;
        box-shadow: 0 0 0 4px rgba(255, 49, 49, 0.3);
    }

    .nav-links .search-container {
        display: none !important;
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(7, 21, 48, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 80px 2rem 2rem;
        transition: transform 0.3s ease, opacity 0.3s ease;
        transform: translateX(-100%);
        opacity: 0;
        z-index: 1001;
        overflow-y: auto;
    }

    .nav-links.active {
        transform: translateX(0);
        opacity: 1;
    }

    .nav-links > a,
    .nav-links > div {
        margin: 0.5rem 0;
        font-size: 1.1rem;
        width: 100%;
        text-align: left;
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    main {
        margin-top: 70px;
        padding: 1rem;
        width: 100%;
    }

    .hero-section {
        padding: 3rem 1rem;
        margin: -1rem -1rem 2rem -1rem;
        width: calc(100% + 2rem);
    }

    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin: 1.5rem 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
        padding: 0 1rem;
    }

    .footer-section h4::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .social-links {
        justify-content: center;
    }

    .footer-links {
        align-items: center;
    }

    body.menu-open,
    body.search-active {
        overflow: hidden;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    @keyframes slideDown {
        from {
            transform: translateX(-50%) translateY(-30px);
            opacity: 0;
        }
        to {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }
    }

    @keyframes pulse {
        0% {
            box-shadow: 0 4px 12px rgba(255, 49, 49, 0.3);
        }
        50% {
            box-shadow: 0 4px 20px rgba(255, 49, 49, 0.6);
        }
        100% {
            box-shadow: 0 4px 12px rgba(255, 49, 49, 0.3);
        }
    }

    .mobile-search-btn:not(.active) {
        animation: pulse 2s infinite;
    }
}

/* MOBILE PAYSAGE */
@media (max-width: 768px) and (orientation: landscape) {
    html::before {
        background-image: url("../images/photoAccueilTel.jpg") !important;
        background-position: center center !important;
        background-size: cover !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
    }
}