/* ==========================================================================
   RESPONSIVE DESIGN - MEDAL OF HONOR V2
   ========================================================================== */

/* Variables responsive */
:root {
    /* Breakpoints */
    --bp-xs: 480px;
    --bp-sm: 768px;
    --bp-md: 1024px;
    --bp-lg: 1200px;
    --bp-xl: 1440px;
    
    /* Container widths */
    --container-xs: 100%;
    --container-sm: 540px;
    --container-md: 720px;
    --container-lg: 960px;
    --container-xl: 1140px;
    
    /* Responsive spacing */
    --space-responsive: clamp(1rem, 4vw, 2rem);
}

/* ==========================================================================
   MOBILE FIRST - BASE (320px+)
   ========================================================================== */

/* Layout de base mobile */
.container {
    width: 100%;
    padding-left: var(--moh-space-md);
    padding-right: var(--moh-space-md);
    margin-left: auto;
    margin-right: auto;
}

.row {
    margin-left: calc(-1 * var(--moh-space-sm));
    margin-right: calc(-1 * var(--moh-space-sm));
}

.col {
    padding-left: var(--moh-space-sm);
    padding-right: var(--moh-space-sm);
    width: 100%;
}

/* Navigation mobile */
.mobile-menu-toggle {
    display: block;
}

.main-navigation .nav-menu {
    display: none;
}

.mobile-menu {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--moh-bg-primary);
    border-bottom: 1px solid var(--moh-glass-border);
    box-shadow: var(--moh-shadow-md);
    z-index: 999;
}

.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: var(--moh-space-md) 0;
}

.mobile-nav-menu li {
    margin: 0;
}

.mobile-nav-menu a {
    display: block;
    padding: var(--moh-space-md) var(--moh-space-lg);
    color: var(--moh-text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--moh-glass-border);
    transition: all var(--moh-transition-fast);
}

.mobile-nav-menu a:hover {
    background: var(--moh-glass-bg);
    color: var(--moh-accent-primary);
}

.mobile-actions {
    padding: var(--moh-space-md) var(--moh-space-lg);
    border-top: 1px solid var(--moh-glass-border);
}

.mobile-actions .btn {
    margin-bottom: var(--moh-space-sm);
}

/* Header mobile */
.site-header .header-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: var(--moh-space-sm) 0;
}

.site-branding {
    flex: 1;
}

.site-title {
    font-size: var(--moh-text-lg);
    margin: 0;
}

.site-description {
    display: none;
}

.user-navigation {
    order: 2;
    margin-left: var(--moh-space-md);
}

.mobile-menu-toggle {
    order: 3;
}

/* Contenu mobile */
.site-main {
    padding: var(--moh-space-lg) 0;
}

/* Posts grid mobile */
.posts-grid {
    grid-template-columns: 1fr;
    gap: var(--moh-space-md);
}

.post-card {
    margin-bottom: var(--moh-space-md);
}

/* Sidebar mobile */
.content-area {
    order: 1;
}

.sidebar {
    order: 2;
    margin-top: var(--moh-space-xl);
    padding-left: 0;
}

/* Footer mobile */
.footer-widgets {
    grid-template-columns: 1fr !important;
    text-align: left;
    gap: var(--moh-space-lg);
}

.footer-content {
    text-align: left;
}

.footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: var(--moh-space-sm);
}

/* Formulaires mobile */
.form-row {
    flex-direction: column;
}

.form-inline {
    flex-direction: column;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: var(--moh-space-sm);
}

.btn-group .btn {
    width: 100%;
}

/* Modales mobile */
.modal {
    width: 95vw;
    max-width: none;
    margin: var(--moh-space-md);
}

.modal-body {
    max-height: 60vh;
}

/* Dashboard mobile */
.dashboard-stats {
    grid-template-columns: 1fr;
}

.dashboard-grid {
    grid-template-columns: 1fr;
}

/* ==========================================================================
   PETIT MOBILE - XS (480px+)
   ========================================================================== */

@media (min-width: 480px) {
    .container {
        max-width: var(--container-xs);
    }
    
    /* Amélioration des boutons */
    .btn-group {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .btn-group .btn {
        flex: 1;
        min-width: 140px;
    }
    
    /* Posts en 2 colonnes sur petits écrans */
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--moh-space-md);
    }
    
    /* Modal plus grande */
    .modal {
        width: 90vw;
    }
}

/* ==========================================================================
   TABLETTE - SM (768px+)
   ========================================================================== */

@media (min-width: 768px) {
    .container {
        max-width: var(--container-sm);
        padding-left: var(--moh-space-lg);
        padding-right: var(--moh-space-lg);
    }
    
    /* Navigation tablette */
    .mobile-menu-toggle {
        display: none;
    }
    
    .main-navigation .nav-menu {
        display: flex;
    }
    
    .mobile-menu {
        display: none !important;
    }
    
    /* Header tablette */
    .site-title {
        font-size: var(--moh-text-xl);
    }
    
    .site-description {
        display: block;
    }
    
    /* Layout tablette */
    .row {
        display: flex;
        flex-wrap: wrap;
        margin-left: calc(-1 * var(--moh-space-md));
        margin-right: calc(-1 * var(--moh-space-md));
    }
    
    .col {
        padding-left: var(--moh-space-md);
        padding-right: var(--moh-space-md);
    }
    
    /* Colonnes tablette */
    .col-sm-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-sm-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
    .col-sm-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-sm-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
    .col-sm-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-sm-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-sm-9 { flex: 0 0 75%; max-width: 75%; }
    .col-sm-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-sm-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Contenu + sidebar */
    .content-sidebar-wrap {
        display: flex;
        gap: var(--moh-space-xl);
    }
    
    .content-area {
        flex: 1;
        order: 0;
    }
    
    .sidebar {
        flex: 0 0 280px;
        order: 1;
        margin-top: 0;
        padding-left: 0;
    }
    
    /* Posts grid tablette */
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--moh-space-lg);
    }
    
    /* Footer tablette */
    .footer-widgets.columns-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-widgets.columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-widgets.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-bottom {
        flex-direction: row;
        text-align: left;
    }
    
    /* Formulaires tablette */
    .form-row {
        flex-direction: row;
    }
    
    .form-inline {
        flex-direction: row;
        align-items: end;
    }
    
    /* Dashboard tablette */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   DESKTOP - MD (1024px+)
   ========================================================================== */

@media (min-width: 1024px) {
    .container {
        max-width: var(--container-md);
    }
    
    /* Header desktop */
    .site-title {
        font-size: var(--moh-text-2xl);
    }
    
    /* Sidebar plus large */
    .sidebar {
        flex: 0 0 320px;
        padding-left: var(--moh-space-xl);
    }
    
    /* Posts grid 3 colonnes */
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Colonnes desktop */
    .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-md-9 { flex: 0 0 75%; max-width: 75%; }
    .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Footer desktop */
    .footer-widgets.columns-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .footer-widgets.columns-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Dashboard desktop */
    .dashboard-stats {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Hover effects desktop */
    .post-card:hover {
        transform: translateY(-8px);
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
}

/* ==========================================================================
   OVERRIDES: Deux états uniques (<=1024 mobile / >=1025 desktop)
   Ces règles priment sur les breakpoints intermédiaires précédents.
   ========================================================================== */

/* ==========================================================================
   BREAKPOINTS PROGRESSIFS - Remplace les anciens overrides restrictifs
   ========================================================================== */

/* Mobile First - 1 colonne sur petits écrans */
@media (max-width: 640px) {
    .posts-grid, .cards-grid, .medallions-grid, .medallion-grid,
    .stats-grid, .dashboard-grid, .search-results-grid, .support-grid,
    .legal-grid, .wc-block-grid__products, .wc-block-product-template, .shop-grid {
        grid-template-columns: 1fr !important;
        --columns: 1 !important;
    }

    .row { flex-direction: column !important; }
    .col, [class*="col-"] { flex: 0 0 100% !important; max-width: 100% !important; }
}

/* Tablette - 2 colonnes sur écrans moyens */
@media (min-width: 641px) and (max-width: 1024px) {
    .posts-grid, .cards-grid, .medallions-grid, .medallion-grid,
    .stats-grid, .dashboard-grid, .search-results-grid, .support-grid,
    .legal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        --columns: 2 !important;
    }

    /* Grilles spécialisées - plus de colonnes sur tablette paysage */
    .wc-block-grid__products, .wc-block-product-template, .shop-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        --columns: 3 !important;
    }

    .row { flex-direction: row !important; }
}

/* Desktop - 3 colonnes sur écrans moyens */
@media (min-width: 1025px) and (max-width: 1440px) {
    .posts-grid, .cards-grid, .medallions-grid, .medallion-grid,
    .stats-grid, .dashboard-grid, .search-results-grid, .support-grid, .legal-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        --columns: 3 !important;
    }

    .wc-block-grid__products, .wc-block-product-template, .shop-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        --columns: 4 !important;
    }
}

/* Large Desktop - 4 colonnes sur très grands écrans */
@media (min-width: 1441px) {
    .posts-grid, .cards-grid, .medallions-grid, .medallion-grid,
    .stats-grid, .dashboard-grid, .search-results-grid, .support-grid,
    .legal-grid, .wc-block-grid__products, .wc-block-product-template, .shop-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        --columns: 4 !important;
    }
}

/* ==========================================================================
   LARGE DESKTOP - LG (1200px+)
   ========================================================================== */

@media (min-width: 1200px) {
    .container {
        max-width: var(--container-lg);
        padding-left: var(--moh-space-xl);
        padding-right: var(--moh-space-xl);
    }
    
    /* Colonnes large desktop */
    .col-lg-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-lg-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-lg-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
    .col-lg-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-lg-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Posts grid 4 colonnes pour archive */
    .archive .posts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Dashboard large */
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================================================
   EXTRA LARGE - XL (1440px+)
   ========================================================================== */

@media (min-width: 1440px) {
    .container {
        max-width: var(--container-xl);
    }
    
    /* Spacing plus généreux */
    .site-main {
        padding: var(--moh-space-xxl) 0;
    }
}

/* ==========================================================================
   UTILITAIRES RESPONSIVE
   ========================================================================== */

/* Masquer/afficher selon la taille d'écran */
.d-sm-none { display: none !important; }
.d-sm-inline { display: inline !important; }
.d-sm-inline-block { display: inline-block !important; }
.d-sm-block { display: block !important; }
.d-sm-flex { display: flex !important; }
.d-sm-inline-flex { display: inline-flex !important; }

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-inline { display: inline !important; }
    .d-md-inline-block { display: inline-block !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    .d-md-inline-flex { display: inline-flex !important; }
}

@media (min-width: 1024px) {
    .d-lg-none { display: none !important; }
    .d-lg-inline { display: inline !important; }
    .d-lg-inline-block { display: inline-block !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
    .d-lg-inline-flex { display: inline-flex !important; }
}

/* Alignement de texte responsive */
.text-sm-left { text-align: left !important; }
.text-sm-center { text-align: center !important; }
.text-sm-right { text-align: right !important; }

@media (min-width: 768px) {
    .text-md-left { text-align: left !important; }
    .text-md-center { text-align: center !important; }
    .text-md-right { text-align: right !important; }
}

@media (min-width: 1024px) {
    .text-lg-left { text-align: left !important; }
    .text-lg-center { text-align: center !important; }
    .text-lg-right { text-align: right !important; }
}

/* Marges responsive */
.m-sm-0 { margin: 0 !important; }
.mt-sm-0 { margin-top: 0 !important; }
.mr-sm-0 { margin-right: 0 !important; }
.mb-sm-0 { margin-bottom: 0 !important; }
.ml-sm-0 { margin-left: 0 !important; }

@media (min-width: 768px) {
    .m-md-0 { margin: 0 !important; }
    .mt-md-0 { margin-top: 0 !important; }
    .mr-md-0 { margin-right: 0 !important; }
    .mb-md-0 { margin-bottom: 0 !important; }
    .ml-md-0 { margin-left: 0 !important; }
}

/* Responsive images et médias */
img {
    max-width: 100%;
    height: auto;
}

.img-responsive {
    width: 100%;
    height: auto;
}

/* Vidéos responsives */
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* Ratio 16:9 */
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Tables responsives */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    width: 100%;
    min-width: 600px;
}

/* Print styles */
@media print {
    .mobile-menu-toggle,
    .mobile-menu,
    .back-to-top,
    .modal-overlay,
    .toast-container {
        display: none !important;
    }
    
    .site-header {
        position: static !important;
        box-shadow: none !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
    
    a {
        text-decoration: underline !important;
    }
    
    .btn {
        border: 1px solid #000 !important;
        background: transparent !important;
        color: #000 !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --moh-text-primary: #000;
        --moh-text-secondary: #000;
        --moh-bg-primary: #fff;
        --moh-accent-primary: #0000ff;
    }
    
    .btn {
        border-width: 2px;
    }
    
    input, textarea, select {
        border-width: 2px;
    }
}

/* ==========================================================================
   STYLES MENU MOBILE - Boutons Connexion/Inscription
   ========================================================================== */

/* Section authentification dans le menu mobile - FUSIONNÉE */
.mobile-menu-section h3 {
    color: var(--moh-text-primary);
    font-size: var(--moh-text-base);
    font-weight: 600;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--moh-accent-primary);
}

/* Bouton de connexion/inscription fusionné */
.mobile-auth-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 14px 20px !important;
    margin: 8px 0 !important;
    border-radius: 10px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    transition: all 0.3s ease !important;
    border: 2px solid transparent !important;
    background: linear-gradient(135deg, #d4af37, #b8941f) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3) !important;
    position: relative !important;
    overflow: hidden !important;
}

.mobile-auth-button::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent) !important;
    transition: left 0.5s !important;
}

.mobile-auth-button:hover::before {
    left: 100% !important;
}

.mobile-auth-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4) !important;
    background: linear-gradient(135deg, #b8941f, #d4af37) !important;
}

.mobile-auth-button .auth-icon {
    font-size: 16px !important;
}

/* Masquer les anciens éléments individuels de connexion/inscription */
.mobile-menu-item[href*="inscription/?mode=login"],
.mobile-menu-item[href*="inscription/"] {
    display: none !important;
}

/* Section utilisateur connecté */
.mobile-user-avatar {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    border: 3px solid var(--moh-accent-primary) !important;
}

.mobile-user-details {
    flex: 1 !important;
}

.mobile-user-name {
    font-weight: 600 !important;
    color: var(--moh-text-primary) !important;
    margin-bottom: 2px !important;
}

/* Section déconnexion */
.mobile-logout {
    background: rgba(220, 53, 69, 0.1) !important;
    color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.mobile-logout:hover {
    background: rgba(220, 53, 69, 0.2) !important;
}

.mobile-logout i {
    color: #dc3545 !important;
}

