/* =====================================================
   MENU MOBILE OPTIMISÉ - CamVox
   ===================================================== */

/* Variables CSS pour la cohérence */
:root {
    --mobile-menu-bg: #ffffff;
    --mobile-menu-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    --mobile-menu-border: #eee;
    --mobile-menu-text: #333;
    --mobile-menu-hover: #f5f5f5;
    --mobile-menu-icon: #888;
    --mobile-menu-transition: all 0.2s ease;
    --mobile-menu-radius: 8px;
}

/* =====================================================
   DRAWER MOBILE PRINCIPAL
   ===================================================== */

.mobile-drawer {
    background-color: var(--mobile-menu-bg);
    box-shadow: var(--mobile-menu-shadow);
    z-index: 1045;
    width: 320px !important;
    max-width: 85vw;
    border-radius: 0 16px 16px 0;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* =====================================================
   HEADER DU DRAWER
   ===================================================== */

.mobile-drawer .offcanvas-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 0 16px 0 0;
    flex-shrink: 0;
    min-height: 80px;
}

.drawer-brand {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.drawer-brand .drawer-logo-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-brand .drawer-logo-image {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    object-position: center center;
    transition: all 0.3s ease;
}

/* Responsive pour le logo du drawer (logo pleine largeur conservée) */
@media (max-width: 576px) {
    .drawer-brand .drawer-logo-image {
        min-height: 50px;
    }
}

/* Format intermédiaire : 475px (téléphones modernes) */
@media (max-width: 475px) {
    .drawer-brand .drawer-logo-image {
        min-height: 48px;
    }
    
    .mobile-drawer .offcanvas-header {
        min-height: 70px;
    }
    
    .drawer-close-btn {
        width: 29px;
        height: 29px;
    }
    
    .drawer-close-btn span {
        width: 19px;
    }
    
    .mobile-drawer .offcanvas-body {
        padding: 0.875rem;
    }
    
    .mobile-nav-item {
        padding: 0.65rem;
        font-size: 0.95rem;
    }
    
    .mobile-nav-item i {
        font-size: 1.15rem;
    }
    
    .region-filter-btn {
        font-size: 0.68rem;
        padding: 0.225rem 0.45rem;
    }
}

@media (max-width: 375px) {
    .drawer-brand .drawer-logo-image {
        min-height: 44px;
    }
    
    .mobile-drawer .offcanvas-header {
        min-height: 65px;
    }
    
    .drawer-close-btn {
        width: 28px;
        height: 28px;
    }
    
    .drawer-close-btn span {
        width: 18px;
    }
}

@media (max-width: 320px) {
    .drawer-brand .drawer-logo-image {
        min-height: 40px;
    }
    
    .mobile-drawer .offcanvas-header {
        min-height: 60px;
    }
    
    .drawer-close-btn {
        width: 25px;
        height: 25px;
    }
    
    .drawer-close-btn span {
        width: 16px;
    }
    
    .mobile-drawer .offcanvas-body {
        padding: 0.75rem;
    }
}

.drawer-close-btn {
    position: relative;
    z-index: 1;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

.drawer-close-btn span {
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: var(--mobile-menu-text);
    top: 50%;
    left: 50%;
    transition: var(--mobile-menu-transition);
}

.drawer-close-btn span:first-child {
    transform: translate(-50%, -50%) rotate(45deg);
}

.drawer-close-btn span:last-child {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* =====================================================
   CORPS DU DRAWER
   ===================================================== */

.mobile-drawer .offcanvas-body {
    padding: 1.25rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

.mobile-drawer .offcanvas-body::-webkit-scrollbar {
    width: 6px;
}

.mobile-drawer .offcanvas-body::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-drawer .offcanvas-body::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 3px;
}

.mobile-drawer .offcanvas-body::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* =====================================================
   RECHERCHE MOBILE
   ===================================================== */

.mobile-search {
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.mobile-search .input-group {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.mobile-search .input-group-text {
    background: #dc3545;
    border: none;
    color: #ffffff;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
}

.mobile-search .form-control {
    border: none;
    background: white;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    box-shadow: none;
}

.mobile-search .form-control:focus {
    box-shadow: none;
    border-color: transparent;
}

/* =====================================================
   FILTRES DE RÉGIONS MOBILE
   ===================================================== */

.mobile-regions-filter-container {
    margin-bottom: 1.5rem;
    padding: 0.5rem 0.5rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    justify-content: stretch;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.mobile-regions-filter {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    justify-content: stretch;
    width: 100%;
    min-width: 0;
}

.mobile-region-filter-btn {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 36px;
    padding: 0.3rem 0.35rem;
    border-radius: 18px;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #374151;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.mobile-region-filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: #111827;
    background: rgba(255, 255, 255, 1);
}

.mobile-region-filter-btn .region-name {
    font-weight: 600;
    font-size: 0.7rem;
}

/* =====================================================
   NAVIGATION MOBILE
   ===================================================== */

.mobile-nav {
    margin-top: 0.5rem;
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.2) transparent;
}

.mobile-nav::-webkit-scrollbar {
    width: 4px;
}

.mobile-nav::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-nav::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.2);
    border-radius: 2px;
}

.mobile-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.4);
}

.mobile-nav-section {
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    min-width: 0;
}

/* Section régions : exploiter toute la largeur pour les 3 boutons sur une ligne */
.mobile-nav-section:first-child .mobile-regions-filter-container {
    width: 100%;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mobile-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.5s ease;
}

.mobile-nav-item:hover::before {
    left: 100%;
}

.mobile-nav-item:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 197, 253, 0.1) 100%);
    color: #1e40af;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.mobile-nav-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    color: #6b7280;
    transition: all 0.3s ease;
}

.mobile-nav-item:hover i {
    color: #3b82f6;
    transform: scale(1.1);
}

/* =====================================================
   SOUS-MENUS DES CATÉGORIES
   ===================================================== */

.category-toggle .toggle-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
    color: #6b7280;
}

.category-toggle.active .toggle-icon {
    transform: rotate(180deg);
    color: #3b82f6;
}

.category-submenu {
    display: none;
    padding: 0.5rem 0 0 0;
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.category-submenu.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.submenu-item {
    padding: 0.75rem 1rem !important;
    margin: 0.25rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.submenu-item:hover {
    background: rgba(59, 130, 246, 0.1);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.submenu-item .category-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.submenu-item .item-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: #6b7280;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

/* =====================================================
   LIENS SOCIAUX
   ===================================================== */

.social-section + .social-links {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    margin: 0.5rem;
}

.social-links .social-link {
    font-size: 1.3rem;
    color: #6b7280;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.social-links .social-link:hover {
    color: #3b82f6;
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
    text-decoration: none;
}

/* =====================================================
   SECTION BOTTOM DU DRAWER
   ===================================================== */

.drawer-bottom-section {
    margin-top: auto;
    padding: 1.5rem 1rem 1rem 1rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(147, 197, 253, 0.05) 100%);
    border-radius: 16px 16px 0 0;
    border-top: 1px solid rgba(59, 130, 246, 0.1);
    position: relative;
    flex-shrink: 0;
}

.drawer-bottom-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 2px;
}

.drawer-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
}

.drawer-auth-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.drawer-auth-btn:hover::before {
    left: 100%;
}

.drawer-login-btn {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.3);
}

.drawer-login-btn:hover {
    background-color: #000;
}

.drawer-logout-btn {
    background-color: #dc2626;
    color: white;
    border: none;
    width: 100%;
}

.drawer-logout-btn:hover {
    background-color: #b91c1c;
}

/* Bouton S'abonner dans le drawer */
.drawer-subscribe-btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--mobile-menu-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin: 0.5rem 0;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.drawer-subscribe-btn:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
    text-decoration: none;
}

.drawer-subscribe-btn i {
    font-size: 1rem;
    color: white !important;
}

.drawer-subscribe-btn span {
    color: white !important;
    font-weight: 600;
}

/* =====================================================
   RESPONSIVE POUR ÉCRANS PLUS LARGES
   ===================================================== */

@media (min-width: 768px) {
    .mobile-drawer {
        width: 340px !important;
        max-width: 90vw;
    }
}

@media (min-width: 1024px) {
    .mobile-drawer {
        width: 340px !important;
        max-width: 85vw;
    }
}

@media (min-width: 1200px) {
    .mobile-drawer {
        width: 340px !important;
        max-width: 80vw;
    }
}

/* =====================================================
   RESPONSIVE POUR TRÈS PETITS ÉCRANS
   ===================================================== */

@media (max-width: 360px) {
    .mobile-drawer {
        width: 310px !important;
        max-width: 90vw;
        height: 100vh !important;
        max-height: 100vh !important;
    }
    
    .mobile-drawer .offcanvas-header {
        padding: 0.75rem 1rem;
    }
    
    .mobile-drawer .offcanvas-body {
        padding: 1rem;
    }
    
    .mobile-nav-section {
        padding: 0.375rem;
    }
    
    .mobile-nav-item {
        padding: 0.75rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .mobile-region-filter-btn {
        min-width: 0;
        height: 30px;
        padding: 0.2rem 0.35rem;
        font-size: 0.65rem;
    }
    
    .social-links .social-link {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .drawer-auth-btn {
        padding: 0.875rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 320px) {
    .mobile-drawer {
        width: 290px !important;
        max-width: 95vw;
        height: 100vh !important;
        max-height: 100vh !important;
    }
    
    .drawer-brand .drawer-logo-image {
        height: 35px;
        max-width: 140px;
    }
    
    .drawer-brand .drawer-logo-container {
        height: 35px;
    }
    
    .mobile-search {
        padding: 0.5rem;
    }
    
    .mobile-search .input-group-text,
    .mobile-search .form-control {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .mobile-regions-filter-container {
        padding: 0.4rem 0.5rem;
    }
    
    .mobile-region-filter-btn {
        min-width: 0;
        height: 28px;
        padding: 0.2rem 0.3rem;
        font-size: 0.65rem;
    }
    
    .mobile-region-filter-btn .region-name {
        font-size: 0.65rem;
    }
    
    .mobile-nav-item {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
        gap: 0.75rem;
    }
    
    .mobile-nav-item i {
        font-size: 1rem;
        width: 20px;
    }
    
    .submenu-item {
        padding: 0.625rem 0.875rem !important;
        font-size: 0.8rem;
    }
    
    .submenu-item .category-color-dot {
        width: 10px;
        height: 10px;
    }
    
    .submenu-item .item-count {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
        min-width: 20px;
    }
    
    .social-links .social-link {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .drawer-bottom-section {
        padding: 1.25rem 0.75rem 0.75rem 0.75rem;
    }
    
    .drawer-auth-btn {
        padding: 0.75rem;
        font-size: 0.8rem;
        gap: 0.5rem;
    }
}

/* =====================================================
   ÉTAT DU BODY QUAND LE DRAWER EST OUVERT
   ===================================================== */

body.drawer-open {
    overflow: hidden;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 576px) {
    .mobile-drawer .offcanvas-body {
        padding: 0.75rem;
    }
    
    .mobile-nav-item {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
    
    .mobile-nav-item i {
        font-size: 1.1rem;
    }
    
    .region-filter-btn {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
}
