/* Responsive Design pour Mobile - MobemboAdmin */

/* Variables pour mobile */
:root {
    --mobile-header-height: 60px;
    --mobile-breakpoint: 768px;
    --tablet-breakpoint: 992px;
}

/* Layout mobile */
@media (max-width: 768px) {
    .page {
        position: relative;
        overflow-x: hidden;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 1rem 0.75rem;
        min-height: calc(100vh - var(--mobile-header-height));
        padding-top: calc(var(--mobile-header-height) + 1rem);
    }
    
    /* Header mobile */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 999;
        background: #ffffff;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        height: var(--mobile-header-height);
        padding: 0 1rem;
        opacity: 1;
    }
    
    .header-left {
        gap: 15px;
    }
    
    .menu-toggle {
        display: flex !important;
        width: 44px;
        height: 44px;
        border-radius: 8px;
        background: var(--primary);
        color: white;
        font-size: 18px;
        border: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .menu-toggle:hover {
        background: var(--primary-dark);
        transform: scale(1.05);
    }
    
    /* User menu mobile */
    .user-menu {
        position: relative;
    }
    
    .user-btn {
        padding: 8px 12px;
        min-width: auto;
        height: 44px;
    }
    
    .user-info {
        display: none; /* Masquer sur très petit écran */
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .dropdown-menu {
        right: 0;
        left: auto;
        min-width: 200px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }
}

/* Sidebar mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px !important;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1100;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.mobile-active {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        width: 280px !important;
        transform: translateX(-100%);
    }
    
    .sidebar.collapsed.mobile-active {
        transform: translateX(0);
    }
    
    /* Header du sidebar mobile */
    .sidebar-header {
        height: var(--mobile-header-height);
        padding: 0 1.5rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: rgba(0, 0, 0, 0.1);
    }
    
    .mobile-close-btn {
        display: flex;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        border: none;
        color: white;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .mobile-close-btn:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: rotate(90deg);
    }
    
    /* Menu items mobile */
    .sidebar-menu {
        padding: 1rem 0;
        height: calc(100vh - var(--mobile-header-height) - 80px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .menu-item {
        padding: 1rem 1.5rem;
        min-height: 56px;
        display: flex;
        align-items: center;
        position: relative;
    }
    
    .menu-item:active {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .menu-icon {
        font-size: 1.3rem;
        min-width: 28px;
        margin-right: 15px;
    }
    
    .menu-text {
        font-size: 1rem;
        font-weight: 500;
    }
    
    /* Footer du sidebar mobile */
    .sidebar-footer {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(0, 0, 0, 0.1);
    }
    
    .collapse-btn {
        display: none; /* Pas nécessaire sur mobile */
    }
}

/* Overlay mobile */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
    cursor: pointer;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.page.mobile-menu-open {
    overflow: hidden;
}

.page.mobile-menu-open .main-content {
    filter: blur(2px);
    pointer-events: none;
}

/* Tablet (Portrait) - 769px à 992px */
@media (min-width: 769px) and (max-width: 992px) {
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }
    
    .header {
        position: sticky;
        top: 0;
        z-index: 998;
        background: #ffffff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        opacity: 1;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 300px !important;
    }
    
    .sidebar.mobile-active {
        transform: translateX(0);
    }
    
    .menu-toggle {
        display: flex !important;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .user-info {
        display: block;
    }
}

/* Desktop - Plus de 992px */
@media (min-width: 993px) {
    .menu-toggle {
        display: flex;
        width: 40px;
        height: 40px;
        border-radius: 6px;
        background: transparent;
        color: var(--text-muted);
        border: 1px solid var(--border);
        font-size: 16px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .menu-toggle:hover {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }
    
    .mobile-overlay {
        display: none;
    }
    
    .mobile-close-btn {
        display: none !important;
    }
}

/* Améliorations pour l'accessibilité */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .mobile-overlay,
    .menu-toggle,
    .mobile-close-btn {
        transition: none !important;
        animation: none !important;
    }
}

/* Support pour les écrans haute densité */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .logo-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Orientation paysage sur mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 240px !important;
    }
    
    .sidebar-menu {
        height: calc(100vh - 60px - 60px);
    }
    
    .menu-item {
        padding: 0.8rem 1.5rem;
        min-height: 48px;
    }
}

/* Très petits écrans - 320px à 480px */
@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem 0.5rem;
    }
    
    .header {
        padding: 0 0.75rem;
    }
    
    .user-btn {
        padding: 6px 8px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .sidebar {
        width: 260px !important;
    }
    
    .menu-item {
        padding: 0.9rem 1.2rem;
    }
    
    .menu-text {
        font-size: 0.95rem;
    }
}

/* Dark mode support pour mobile */
@media (prefers-color-scheme: dark) {
    .header {
        background: #ffffff;
        border-bottom: 1px solid var(--border-dark);
        opacity: 1;
    }
    
    .mobile-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
}

/* Focus states pour l'accessibilité */
.menu-toggle:focus,
.mobile-close-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Smooth scrolling pour le menu mobile */
.sidebar-menu {
    scroll-behavior: smooth;
}

/* Animation d'entrée pour le contenu */
@media (max-width: 768px) {
    .main-content {
        animation: slideInContent 0.3s ease-out;
    }
}

@keyframes slideInContent {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
