/* =============================================
   RESPONSIVE DESIGN - VERSION AMÉLIORÉE
   ============================================= */

/* Mobile */
@media (max-width: 768px) {
    /* TAILLES DE POLICE RÉDUITES POUR MOBILE */
    body {
        font-size: 15px;
    }
    
    h1 { 
        font-size: 1.6rem; 
        line-height: 1.2;
    }
    h2 { 
        font-size: 1.4rem; 
        line-height: 1.25;
    }
    h3 { 
        font-size: 1.2rem; 
        line-height: 1.3;
    }
    h4 { 
        font-size: 1.05rem; 
        line-height: 1.4;
    }
    
    p {
        font-size: 0.95rem;
    }
    
    .container {
        width: 94%;
    }
    
    /* HEADER RESPONSIVE */
    .site-header {
        height: var(--header-height-mobile, 60px);
        padding: 0;
    }
    
    .custom-logo {
        max-height: calc(var(--header-height-mobile, 60px) - 15px);
        width: auto;
    }
    
    .site-branding .site-title {
        font-size: 1.1rem;
    }
    
    .site-header .container {
        flex-wrap: wrap;
    }
    
    /* MENU HAMBURGER */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* MENU MOBILE - ALIGNEMENT À GAUCHE CORRIGÉ */
    .main-menu {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 75%; 
        max-width: 300px; 
        height: 100vh;
        height: 100dvh;
        background: #ffffff;
        box-shadow: 5px 0 30px rgba(0, 0, 0, 0.15);
        z-index: 1001;
        padding: 5rem 1.5rem 2rem;
        margin: 0;
        gap: 0;
        overflow-y: auto;
        overflow-x: hidden;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overscroll-behavior: contain;
        align-items: flex-start;
        text-align: left;
    }
    
    .main-menu.open {
        transform: translateX(0);
    }
    
    /* Items du menu - ALIGNEMENT À GAUCHE */
    .main-menu > .menu-item {
        border-bottom: 1px solid #f1f5f9;
        width: 100%;
        /* ALIGNEMENT À GAUCHE */
        text-align: left;
    }
    
    .main-menu > .menu-item:last-child {
        border-bottom: none;
    }
    
    /* Liens du menu - ALIGNEMENT À GAUCHE */
    .main-menu > .menu-item > a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.9rem 0;
        font-size: 1rem;
        font-weight: 500;
        color: #1a202c;
        border-radius: 0;
        background: transparent !important;
        width: 100%;
        /* ALIGNEMENT À GAUCHE FORCÉ */
        text-align: left !important;
        text-decoration: none;
    }
    
    .main-menu > .menu-item > a:hover,
    .main-menu > .menu-item > a:focus {
        background: transparent !important;
        color: var(--primary-color);
        text-decoration: none;
    }
    
    .main-menu > .menu-item.current-menu-item > a,
    .main-menu > .menu-item.current_page_parent > a {
        color: var(--primary-color);
        background: transparent !important;
        font-weight: 600;
    }
    
    /* Supprimer le centrage par défaut des liens */
    .main-menu > .menu-item > a .menu-text {
        text-align: left;
    }
    
    /* Flèche du sous-menu - toujours à droite */
    .main-menu .submenu-arrow {
        font-size: 0.8rem;
        transition: transform 0.3s ease;
        padding: 0.3rem;
        margin-left: auto;
        flex-shrink: 0;
    }
    
    /* Sous-menus mobile - ALIGNEMENT À GAUCHE AVEC INDENTATION */
    .main-menu .sub-menu {
        display: none;
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        min-width: auto;
        padding: 0 0 0.5rem 1rem;
        margin: 0;
        opacity: 1;
        transform: none;
        /* ALIGNEMENT À GAUCHE */
        text-align: left;
        width: 100%;
    }
    
    .main-menu .sub-menu.open {
        display: block;
    }
    
    .main-menu .sub-menu .menu-item {
        width: 100%;
        text-align: left;
    }
    
    .main-menu .sub-menu a {
        display: block;
        padding: 0.6rem 0;
        font-size: 0.9rem;
        color: #4a5568;
        /* ALIGNEMENT À GAUCHE FORCÉ */
        text-align: left !important;
        text-decoration: none;
    }
    
    .main-menu .sub-menu a:hover,
    .main-menu .sub-menu a:focus {
        background: transparent;
        padding-left: 0;
        color: var(--primary-color);
        text-decoration: none;
    }
    
    /* Désactiver le hover sur mobile */
    .main-menu .menu-item:hover > .sub-menu:not(.open),
    .main-menu .menu-item:focus-within > .sub-menu:not(.open) {
        display: none;
    }
    
    /* Menu item avec sous-menu - gestion du clic */
    .main-menu .menu-item.menu-item-has-children > a {
        cursor: pointer;
    }
    
    /* MÉTADONNÉES MOBILE */
    .entry-meta {
        gap: 0.5rem 0.8rem;
        font-size: 0.8rem;
        padding: 0.4rem 0;
    }
    
    .single .entry-header .entry-meta {
        padding: 0.5rem 0.8rem;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem 0.8rem;
    }
    
    .single .entry-header .entry-meta .meta-item {
        font-size: 0.8rem;
    }
    
    .single .entry-header .entry-meta .meta-item svg {
        width: 14px;
        height: 14px;
    }
    
    .meta-item {
        font-size: 0.8rem;
    }
    
    .meta-item svg {
        width: 12px;
        height: 12px;
    }
    
    /* POSTS */
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .post-content {
        padding: 1rem;
    }
    
    .post-content h2 {
        font-size: 1.1rem;
    }
    
    .post-thumbnail img {
        height: 180px;
    }
    
    /* SINGLE POST */
    .single-post .entry-title {
        font-size: 1.6rem;
        text-align: left;
    }
    
    .single-post .entry-content {
        font-size: 0.95rem;
    }
    
    .single-post .entry-content img {
        margin: 1rem 0;
    }
    
    /* FORMULAIRES MOBILE */
    input[type="text"],
    input[type="email"],
    input[type="url"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        padding: 0.6rem 0.8rem;
        font-size: 0.95rem;
        border-width: 1.5px;
    }
    
    .search-form {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .search-form input[type="search"] {
        padding: 0.6rem 0.8rem;
        font-size: 0.95rem;
    }
    
    .search-form button {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
        width: 100%;
    }
    
    input[type="submit"],
    button[type="submit"],
    .submit-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
        width: 100%;
    }
    
    /* COMMENTS MOBILE */
    .comment {
        padding: 1rem;
    }
    
    .comment-content {
        font-size: 0.9rem;
    }
    
    /* FOOTER MOBILE */
    .hide-on-mobile .footer-content,
    .hide-on-mobile {
        display: none !important;
    }
    
    .site-footer {
        margin-top: 0;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .footer-navigation ul {
        justify-content: center;
        gap: 0.8rem;
        font-size: 0.85rem;
    }
    
    .site-main {
        padding: 1rem 0;
    }
    
    .content-area {
        padding: 1rem 0;
    }
    
    .search-toggle {
        display: none;
    }
    
    .search-bar {
        display: none !important;
    }
    
    .search-toggle-mobile {
        display: flex;
        order: 0;
    }
    
    .mobile-search-panel {
        display: block;
    }
    
    .header-actions {
        gap: 0.3rem;
    }
    
    .menu-toggle {
        order: 0;
    }
    
    .search-toggle-mobile {
        order: 1;
    }
    
    .cart-icon {
        order: 2;
        margin-right: 0;
    }
    
    .cart-icon svg {
        width: 20px;
        height: 20px;
    }
    
    /* LAYOUT MOBILE */
    .layout-wrapper {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .layout-wrapper.with-sidebar .content-primary,
    .layout-wrapper.with-sidebar .sidebar-primary {
        flex: 1;
        max-width: 100%;
        width: 100%;
    }
    
    .sidebar-primary {
        padding: 1rem;
    }
    
    /* 404 */
    .error-404 h1 {
        font-size: 5rem;
    }
    
    .error-404 h2 {
        font-size: 1.5rem;
    }
    
    .error-404 {
        padding: 2rem 0;
    }
    
    /* PAGINATION */
    .page-numbers a,
    .page-numbers span {
        padding: 0.4rem 0.7rem;
        font-size: 0.85rem;
    }
}

/* Petit écran mobile */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.05rem; }
    h4 { font-size: 0.95rem; }
    
    .container {
        width: 96%;
    }
    
    .main-menu {
        width: 80%;
        max-width: 280px;    
        padding: 4rem 1rem 1.5rem;
    }
    
    .post-thumbnail img {
        height: 150px;
    }
    
    .post-content {
        padding: 0.8rem;
    }
    
    .post-content h2 {
        font-size: 1rem;
    }
    
    .entry-meta {
        font-size: 0.7rem;
        gap: 0.3rem 0.6rem;
    }
    
    .meta-item svg {
        width: 10px;
        height: 10px;
    }
    
    .single-post .entry-title {
        font-size: 1.4rem;
    }
    
    .tags-links {
        font-size: 0.8rem;
        gap: 0.3rem;
    }
    
    .tag-item {
        padding: 0.15rem 0.6rem;
        font-size: 0.7rem;
    }
}

/* Desktop */
@media (min-width: 769px) {
    .main-menu {
        display: flex !important;
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        box-shadow: none;
        padding: 0;
        overflow: visible;
        transform: none;
        flex-direction: row;
        /* Réinitialiser l'alignement pour desktop */
        align-items: center;
        text-align: center;
    }
    
    .menu-overlay {
        display: none !important;
    }
    
    .hide-on-desktop .footer-content,
    .hide-on-desktop {
        display: none !important;
    }
}

/* Tablette */
@media (min-width: 769px) and (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .layout-wrapper.with-sidebar {
        flex-direction: column;
    }
    
    .layout-wrapper.with-sidebar .content-primary,
    .layout-wrapper.with-sidebar .sidebar-primary {
        flex: 1;
        max-width: 100%;
    }
    
    .post-thumbnail img {
        height: 180px;
    }
}