/**
 * MEDASEL Sidebar Styles
 * Design moderne et responsive
 * Version: 2.0
 */

/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
    --sidebar-width: 280px;
    --sidebar-bg: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    --sidebar-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --sidebar-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --menu-item-hover: rgba(255, 255, 255, 0.15);
    --menu-item-active: rgba(255, 255, 255, 0.25);
    --menu-text-color: rgba(255, 255, 255, 0.95);
    --menu-text-muted: rgba(255, 255, 255, 0.7);
    
    --profile-bg: rgba(255, 255, 255, 0.1);
    --profile-border: rgba(255, 255, 255, 0.2);
    
    --badge-bg: rgba(255, 255, 255, 0.2);
    --badge-color: white;
    
    --mobile-breakpoint: 768px;
}

/* ============================================
   SIDEBAR PRINCIPAL
   ============================================ */
.medasel-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    box-shadow: var(--sidebar-shadow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--sidebar-transition);
}

/* Scrollbar personnalisée */
.medasel-sidebar::-webkit-scrollbar {
    width: 6px;
}

.medasel-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.medasel-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.medasel-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================
   HEADER
   ============================================ */
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
    line-height: 1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo-text h1 {
    font-size: 22px;
    font-weight: 700;
    color: white;
    margin: 0;
    letter-spacing: 0.5px;
}

.logo-text p {
    font-size: 12px;
    color: var(--menu-text-muted);
    margin: 2px 0 0 0;
    font-weight: 500;
}

/* ============================================
   PROFIL UTILISATEUR
   ============================================ */
.sidebar-profile {
    padding: 12px 20px;
    background: var(--profile-bg);
    border-bottom: 1px solid var(--profile-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
}

.profile-email {
    font-size: 11px;
    color: var(--menu-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

.badge-admin {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #764ba2;
}

.badge-user {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ============================================
   NAVIGATION
   ============================================ */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--menu-text-color);
    text-decoration: none;
    transition: var(--sidebar-transition);
    cursor: pointer;
    position: relative;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: var(--menu-item-hover);
    padding-left: 24px;
}

.menu-item.active {
    background: var(--menu-item-active);
    border-left-color: white;
    font-weight: 600;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    right: 20px;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.menu-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.menu-label {
    flex: 1;
    font-size: 14px;
}

.menu-badge {
    background: var(--badge-bg);
    color: var(--badge-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Divider */
.menu-divider {
    margin: 16px 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.divider-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--menu-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   FOOTER / DÉCONNEXION
   ============================================ */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-logout-btn {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--sidebar-transition);
}

.sidebar-logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.logout-icon {
    font-size: 18px;
}

/* ============================================
   MAIN CONTENT ADJUSTMENT
   ============================================ */
.main-content.has-sidebar {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

/* ============================================
   MOBILE MENU
   ============================================ */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    width: 56px;
    height: 56px;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    align-items: center;
    justify-content: center;
    transition: var(--sidebar-transition);
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.hamburger-icon {
    display: block;
    line-height: 1;
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .medasel-sidebar {
        transform: translateX(-100%);
    }
    
    .medasel-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    }
    
    .main-content.has-sidebar {
        margin-left: 0;
        padding-left: 80px !important;
    }
    
    body.menu-open {
        overflow: hidden;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.medasel-sidebar.mobile-open {
    animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay.show {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   DARK MODE SUPPORT (optionnel)
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --sidebar-bg: linear-gradient(180deg, #4a5568 0%, #2d3748 100%);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .medasel-sidebar,
    .mobile-menu-toggle,
    .sidebar-overlay {
        display: none !important;
    }
    
    .main-content.has-sidebar {
        margin-left: 0 !important;
    }
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */
.menu-item:focus,
.sidebar-logout-btn:focus,
.mobile-menu-toggle:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.sidebar-hidden {
    transform: translateX(-100%);
}

.sidebar-visible {
    transform: translateX(0);
}