/* Tablettes (768px et moins) */
@media screen and (max-width: 768px) {
    /* Navigation */
    .navbar {
        padding: 0 20px;
        height: 70px;
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .logo {
        font-size: 20px;
        flex-shrink: 0;
    }

    /* Afficher le hamburger */
    .hamburger {
        display: flex;
        order: 3;
    }

    /* Menu caché par défaut sur mobile */
    .menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: calc(100vh - 70px);
        background-color: var(--primary-color);
        flex-direction: column;
        gap: 0;
        padding: 30px 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
        transition: left 0.3s ease;
        overflow-y: auto;
        z-index: 999;
    }

    /* Menu ouvert */
    .menu.active {
        left: 0;
    }

    .menu li {
        width: 100%;
        text-align: left;
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .menu a {
        display: block;
        padding: 15px 30px;
        font-size: 18px;
    }

    .menu a::after {
        display: none;
    }

    /* Overlay pour fermer le menu */
    .menu-overlay {
        display: none;
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .menu-overlay.active {
        display: block;
    }

    /* Barre de recherche sur tablette - champ visible */
    .search-container {
        order: 2;
        margin-right: auto;
        margin-left: 20px;
        flex: 1;
        max-width: 250px;
    }

    .search-input {
        width: 100%;
    }

    /* Contenu principal */
    .main-content {
        padding: 20px;
    }

    /* Carrousel */
    .carousel-container {
        height: 300px;
    }

    .carousel-slide h2 {
        font-size: 24px;
    }

    .carousel-btn {
        padding: 10px;
    }

    .carousel-btn.prev {
        left: 10px;
    }

    .carousel-btn.next {
        right: 10px;
    }

    /* Section deux colonnes */
    .two-column {
        flex-direction: column;
        margin-top: 10px;
        gap: 10px;
    }

    .mot-du-jour,
    .question-section {
        flex: 100%;
    }

    /* Historique */
    .history-section {
        padding: 20px;
    }

    .history-item {
        padding: 15px;
    }

    /* Pagination */
    .pagination {
        flex-direction: column;
        gap: 10px;
    }

    .pagination-btn {
        width: 100%;
    }

    /* Bannière de cookies */
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }

    .cookie-buttons {
        width: 100%;
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
    }

    /* Pages de contenu */
    .page-container {
        padding: 20px;
    }

    .page-container h2 {
        font-size: 24px;
    }

    .page-content h3 {
        font-size: 20px;
    }

    /* Détails */
    .slide-detail-header {
        height: 120px;
    }

    .slide-detail-header h2 {
        font-size: 24px;
    }

    .slide-detail-content,
    .mot-detail-container {
        padding: 20px;
    }
}

/* Mobiles (480px et moins) */
@media screen and (max-width: 480px) {
    /* Navigation - hauteur FIXE et RÉDUITE */
    .navbar {
        height: 60px;
        padding: 0 5px 0 10px;
        position: relative;
    }

    .logo {
        font-size: 18px;
        transition: opacity 0.3s ease;
    }

    /* Cacher le logo quand la recherche est active */
    .search-container.active ~ .logo,
    .navbar:has(.search-container.active) .logo {
        opacity: 0;
        pointer-events: none;
    }

    /* Container de recherche : couvre toute la navbar */
    .search-container {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background-color: var(--primary-color);
        display: flex;
        align-items: center;
        padding: 0 5px 0 10px;
        gap: 10px;
        z-index: 1002;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    /* Quand la recherche est active */
    .search-container.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Input de recherche mobile - même hauteur que les boutons */
    .search-input {
        flex: 1;
        min-width: 0;
        height: 40px;
        padding: 0 15px;
        background-color: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 8px;
        color: white;
        font-size: 15px;
        line-height: 40px;
        margin: 0;
    }

    .search-input::placeholder {
        color: rgba(255, 255, 255, 0.7);
    }

    .search-input:focus {
        background-color: rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.5);
        outline: none;
    }

    /* Bouton loupe en mode fermé */
    .search-btn-mobile {
        position: absolute;
        top: 50%;
        right: 55px;
        transform: translateY(-50%);
        z-index: 1001;
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Bouton loupe dans la barre */
    .search-container .search-btn {
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        flex-shrink: 0;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 40px;
    }

    .search-icon {
        width: 22px;
        height: 22px;
        stroke: white;
        display: block;
    }

    /* Bouton fermer (X) */
    .search-close {
        background: none;
        border: none;
        color: white;
        font-size: 28px;
        font-weight: 300;
        cursor: pointer;
        padding: 0;
        line-height: 1;
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hamburger - même alignement */
    .hamburger {
        margin-left: 0;
        margin-right: 0;
        flex-shrink: 0;
        height: 40px;
        display: flex;
        align-items: center;
    }

    /* Cacher l'erreur en mode mobile */
    .search-error {
        display: none;
    }

    /* Contenu principal - ESPACE RÉDUIT */
    .main-content {
        padding: 10px;
        margin-top: 60px;
        padding-top: 0;
    }

    /* Carrousel - ESPACE RÉDUIT EN HAUT */
    .carousel-container {
        height: 250px;
        border-radius: 10px;
        margin-top: 0;
    }

    .carousel-slide {
        padding: 20px;
    }

    .carousel-slide h2 {
        font-size: 20px;
    }

    .carousel-btn {
        padding: 8px;
    }

    .carousel-dots {
        bottom: 10px;
    }

    .dot {
        width: 10px;
        height: 10px;
    }

    /* Section mot du jour */
    .mot-du-jour,
    .question-section {
        padding: 15px;
        margin-top: 0;
    }

    .section-title {
        font-size: 20px;
    }

    .mot-content h3 {
        font-size: 18px;
    }

    /* Formulaire */
    .question-form input,
    .question-form textarea {
        padding: 10px;
        font-size: 14px;
    }

    .submit-btn {
        padding: 10px 30px;
        font-size: 14px;
    }

    /* Historique */
    .history-section {
        margin-top: 15px;
        padding: 15px;
    }

    .history-title {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .history-item {
        padding: 15px;
        margin-bottom: 10px;
    }

    .history-item h3 {
        font-size: 16px;
    }

    /* Footer */
    .footer {
        padding: 20px 15px;
        font-size: 14px;
        margin-top: 30px;
    }

    /* Bannière de cookies */
    .cookie-banner {
        padding: 15px 20px;
    }

    .cookie-text {
        font-size: 14px;
    }

    .cookie-btn {
        padding: 8px 20px;
        font-size: 13px;
    }

    /* Détails */
    .slide-detail-header {
        height: 100px;
        margin-top: 0;
    }

    .slide-detail-header h2 {
        font-size: 20px;
    }

    .slide-detail-content {
        padding: 15px;
        font-size: 15px;
        margin-top: 0;
    }

    .close-detail {
        padding: 8px 20px;
        font-size: 14px;
        margin-top: 5px;
        margin-bottom: 10px;
    }

    /* Pages de contenu */
    .page-container {
        padding: 10px;
        margin-top: 0;
        padding-top: 0;
    }

    .page-container h2 {
        font-size: 22px;
        margin-top: 10px;
        margin-bottom: 15px;
    }

    .page-content {
        font-size: 15px;
        margin-top: 0;
    }

    .page-content h3 {
        font-size: 18px;
        margin-top: 20px;
        margin-bottom: 10px;
    }

    .testimonial {
        padding: 15px;
    }

    .testimonial h3 {
        font-size: 18px;
    }

    /* Détail mot du jour */
    .mot-detail-container {
        padding: 20px;
        margin-top: 15px;
    }

    .mot-detail-container h2 {
        font-size: 22px;
    }

    .mot-detail-date {
        font-size: 13px;
    }

    /* Mentions légales */
    .mentions-container {
        padding: 20px;
        margin-top: 15px;
    }

    .mentions-container h2 {
        font-size: 22px;
    }

    .mentions-container h3 {
        font-size: 18px;
    }

    /* Menu qui slide depuis la gauche */
    .menu {
        top: 60px;
        height: calc(100vh - 60px);
    }

    .menu-overlay {
        top: 60px;
        height: calc(100vh - 60px);
    }
}



/* Très petits écrans (320px et moins) */
@media screen and (max-width: 320px) {
    .navbar {
        padding: 0 10px;
        height: 70px;
    }

    .logo {
        font-size: 16px;
    }

    .carousel-container {
        height: 200px;
    }

    .carousel-slide h2 {
        font-size: 18px;
    }

    .section-title {
        font-size: 18px;
    }

    .history-title {
        font-size: 20px;
    }

    .page-container h2 {
        font-size: 20px;
    }
}

/* Ordinateurs de bureau (1200px et plus) */
@media screen and (min-width: 1200px) {
    .main-content {
        max-width: 1400px;
        margin: 70px auto 0;
    }

    .carousel-container {
        height: 500px;
    }

    .carousel-slide h2 {
        font-size: 42px;
    }

    .cookie-content {
        max-width: 1400px;
    }
}

/* Mode paysage sur mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .carousel-container {
        height: 250px;
    }

    .navbar {
        height: 60px;
    }

    .main-content {
        margin-top: 60px;
    }

    .menu {
        top: 60px;
        height: calc(100vh - 60px);
    }

    .menu-overlay {
        top: 60px;
        height: calc(100vh - 60px);
    }

    .search-container {
        top: 60px;
    }

    .search-btn {
        top: 10px;
    }

    .cookie-banner {
        padding: 10px 20px;
    }

    .cookie-content {
        gap: 10px;
    }

    .cookie-text {
        font-size: 13px;
    }
}