/**
 * Sidebar Navigation - Design moderne cohérent avec la landing page
 * Style : Fond clair, glassmorphism, gradients bleus subtils
 */

/* =================================================================
   SIDEBAR CONTAINER
   ================================================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: linear-gradient(180deg,
        rgba(240, 249, 255, 0.95) 0%,
        rgba(224, 242, 254, 0.95) 50%,
        rgba(255, 255, 255, 0.95) 100%
    );
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(12, 129, 228, 0.1);
    box-shadow: var(--shadow-lg);
    color: var(--color-black);
    transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;}

.sidebar.sidebar--collapsed {
    width: 80px;
}

/* =================================================================
   HEADER
   ================================================================= */
.sidebar__header {
    position: relative;
    padding: var(--spacing-xl) var(--spacing-lg);
    border-bottom: 1px solid rgba(12, 129, 228, 0.08);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Bouton toggle - Positionné sur le bord droit */
.sidebar__toggle {
    position: absolute;
    top: 50%;
    right: -14px;
    transform: translateY(-50%);
    background: var(--color-white);
    border: 1px solid rgba(12, 129, 228, 0.15);
    outline: none;
    color: var(--color-primary);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-full);
    transition:
        transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1),
        background 300ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.sidebar__toggle:hover {
    background: var(--gradient-main);
    color: var(--color-white);
    box-shadow: var(--shadow-lg);
    transform: translateY(-50%) scale(1.08);
}

.sidebar__toggle:active {
    transform: translateY(-50%) scale(0.95);
}

.sidebar__toggle:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Icône chevron */
.sidebar__toggle-icon {
    width: 6px;
    height: 6px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(-135deg);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.sidebar--collapsed .sidebar__toggle-icon {
    transform: rotate(45deg);
}

/* Logo */
.sidebar__logo {
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
    padding: var(--spacing-sm) 0;
}

.sidebar__logo svg {
    max-width: 120px;
    height: auto;
    transition: max-width 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.sidebar--collapsed .sidebar__logo svg {
    max-width: 40px;
}

/* =================================================================
   MENU
   ================================================================= */
.sidebar__menu {
    list-style: none;
    padding: var(--spacing-md) 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Scrollbar personnalisée */
.sidebar__menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar__menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar__menu::-webkit-scrollbar-thumb {
    background: rgba(12, 129, 228, 0.2);
    border-radius: var(--border-radius-full);
}

.sidebar__menu::-webkit-scrollbar-thumb:hover {
    background: rgba(12, 129, 228, 0.3);
}

.sidebar__menu-item {
    margin: 0;
    padding: 0 var(--spacing-md) 0 var(--spacing-sm);
}

.sidebar__menu-link {
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    margin: var(--spacing-xs) 0;
    color: var(--color-gray-dark);
    text-decoration: none;
    border-radius: var(--border-radius-lg);
    transition:
        background 300ms cubic-bezier(0.4, 0, 0.2, 1),
        color 300ms cubic-bezier(0.4, 0, 0.2, 1),
        transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1),
        outline 200ms cubic-bezier(0.4, 0, 0.2, 1);
    gap: var(--spacing-md);
    position: relative;
    font-family: var(--font-secondary);
    font-weight: var(--font-weight-medium);
    outline: 2px solid transparent;
    outline-offset: -2px;
}

.sidebar__menu-link:hover {
    background: rgba(12, 129, 228, 0.12);
    color: var(--color-primary-dark);
    transform: translateX(2px);
}

.sidebar__menu-link:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.sidebar__menu-link:focus:not(:focus-visible) {
    outline: 2px solid transparent;
}

.sidebar__menu-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* État actif */
.sidebar__menu-link.active {
    background: linear-gradient(135deg,
        rgba(12, 129, 228, 0.15) 0%,
        rgba(58, 158, 235, 0.12) 100%
    );
    color: var(--color-primary-dark);
    font-weight: var(--font-weight-semibold);
    box-shadow: 0 2px 8px rgba(12, 129, 228, 0.15);
}

.sidebar__menu-link.active:hover {
    transform: translateX(1px);
    box-shadow: 0 4px 12px rgba(12, 129, 228, 0.2);
}

/* Icône */
.sidebar__menu-icon {
    font-size: var(--font-size-xl);
    width: 24px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar__menu-link:hover .sidebar__menu-icon {
    transform: scale(1.1);
}

.sidebar__menu-link.active .sidebar__menu-icon {
    transform: scale(1.05);
}

/* Styles pour les SVG dans les icônes */
.sidebar__menu-icon svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 1px 2px rgba(12, 129, 228, 0.1));
    transition: filter 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Couleurs par défaut - tons bleus subtils */
.sidebar__menu-icon svg .svg-primary {
    color: var(--color-primary);
    opacity: 0.85;
    transition:
        color 300ms cubic-bezier(0.4, 0, 0.2, 1),
        opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar__menu-icon svg .svg-secondary {
    color: var(--color-primary);
    opacity: 0.35;
    transition:
        color 300ms cubic-bezier(0.4, 0, 0.2, 1),
        opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover - icônes plus vives */
.sidebar__menu-link:hover .sidebar__menu-icon svg {
    filter: drop-shadow(0 2px 4px rgba(12, 129, 228, 0.2));
}

.sidebar__menu-link:hover .sidebar__menu-icon svg .svg-primary {
    color: var(--color-primary-dark);
    opacity: 1;
}

.sidebar__menu-link:hover .sidebar__menu-icon svg .svg-secondary {
    color: var(--color-primary);
    opacity: 0.5;
}

/* État actif - icônes pleines et éclatantes */
.sidebar__menu-link.active .sidebar__menu-icon svg {
    filter: drop-shadow(0 2px 6px rgba(12, 129, 228, 0.25));
}

.sidebar__menu-link.active .sidebar__menu-icon svg .svg-primary {
    color: var(--color-primary);
    opacity: 1;
}

.sidebar__menu-link.active .sidebar__menu-icon svg .svg-secondary {
    color: var(--color-primary-light);
    opacity: 0.6;
}

/* Texte */
.sidebar__menu-text {
    font-size: var(--font-size-sm);
    white-space: nowrap;
    transition:
        opacity 300ms cubic-bezier(0.4, 0, 0.2, 1),
        width 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Badge "À venir" */
.sidebar__menu-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.1) 0%, rgba(168, 85, 247, 0.08) 100%);
    color: rgb(147, 51, 234);
    border-radius: var(--border-radius-full);
    border: 1px solid rgba(147, 51, 234, 0.2);
    white-space: nowrap;
    margin-left: auto;
}

/* État désactivé */
.sidebar__menu-link--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    user-select: none;
}

.sidebar__menu-link--disabled:hover {
    background: transparent;
    transform: none;
}

.sidebar__menu-link--disabled .sidebar__menu-icon svg {
    filter: grayscale(100%) opacity(0.6);
}

.sidebar__menu-link--disabled .sidebar__menu-icon {
    transform: none !important;
}

/* Masquer le badge en mode collapsed */
.sidebar.sidebar--collapsed .sidebar__menu-badge {
    display: none;
}

/* État collapsed */
.sidebar.sidebar--collapsed .sidebar__menu-item {
    padding: 0;
}

.sidebar.sidebar--collapsed .sidebar__menu-link {
    justify-content: center;
    padding: var(--spacing-md);
    margin: var(--spacing-xs) var(--spacing-sm);
    gap: 0;
}

.sidebar.sidebar--collapsed .sidebar__menu-link:hover {
    transform: scale(1.08);
}

.sidebar.sidebar--collapsed .sidebar__menu-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.sidebar--collapsed .sidebar__footer .sidebar__menu-link {
    padding: var(--spacing-md);
    margin: var(--spacing-xs) var(--spacing-sm);
}

/* =================================================================
   FOOTER
   ================================================================= */
.sidebar__footer {
    border-top: 1px solid rgba(12, 129, 228, 0.08);
    padding: var(--spacing-md) 0;
    margin-top: auto;
}

.sidebar__footer .sidebar__menu-link {
    color: var(--color-gray-dark);
    margin: var(--spacing-xs) var(--spacing-md) var(--spacing-xs) var(--spacing-sm);
}

.sidebar__footer .sidebar__menu-link:hover {
    background: rgba(12, 129, 228, 0.12);
    color: var(--color-primary-dark);
    transform: translateX(2px);
}

/* Version */
.sidebar__version {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--color-text-light);
    font-size: var(--font-size-xs);
    font-family: var(--font-secondary);
    text-align: center;
    transition:
        opacity 300ms cubic-bezier(0.4, 0, 0.2, 1),
        height 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.sidebar--collapsed .sidebar__version {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

/* =================================================================
   LAYOUT PRINCIPAL
   ================================================================= */
.main-content {
    margin-left: 260px;
    transition: margin-left 400ms cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    padding: var(--spacing-2xl);
    background: var(--color-gray-light);
}

.sidebar.sidebar--collapsed ~ .main-content {
    margin-left: 80px;
}

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

/* Tablettes */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar:not(.sidebar--collapsed) {
        width: 260px;
    }

    .main-content {
        margin-left: 80px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* Sidebar réduite par défaut en mobile (comme collapsed) */
    .sidebar {
        width: 60px;
    }

    /* Si l'utilisateur l'ouvre, elle s'affiche en overlay */
    .sidebar:not(.sidebar--collapsed) {
        width: 260px;
        box-shadow: var(--shadow-xl);
    }

    /* Réduction de la taille des icônes et texte en mobile */
    .sidebar__menu-icon {
        font-size: var(--font-size-base);
        width: 20px;
        min-width: 20px;
        height: 20px;
    }

    .sidebar__menu-text {
        font-size: var(--font-size-sm);
    }

    .sidebar__logo svg {
        max-width: 48px;
    }

    .sidebar:not(.sidebar--collapsed) .sidebar__logo svg {
        max-width: 100px;
    }

    /* Masquer le texte par défaut (comme en mode collapsed) */
    .sidebar .sidebar__menu-text {
        opacity: 0;
        width: 0;
        overflow: hidden;
    }

    /* Afficher le texte quand la sidebar est ouverte */
    .sidebar:not(.sidebar--collapsed) .sidebar__menu-text {
        opacity: 1;
        width: auto;
    }

    /* Masquer la version par défaut */
    .sidebar .sidebar__version {
        opacity: 0;
        height: 0;
        padding: 0;
        overflow: hidden;
    }

    .sidebar:not(.sidebar--collapsed) .sidebar__version {
        opacity: 1;
        height: auto;
        padding: var(--spacing-md) var(--spacing-lg);
    }

    /* Centrer les icônes en mode réduit */
    .sidebar .sidebar__menu-link {
        justify-content: center;
        padding: var(--spacing-sm);
        margin: var(--spacing-xs) var(--spacing-xs);
        gap: 0;
    }

    /* Remettre le gap quand ouverte */
    .sidebar:not(.sidebar--collapsed) .sidebar__menu-link {
        justify-content: flex-start;
        padding: var(--spacing-sm) var(--spacing-md);
        gap: var(--spacing-md);
    }

    /* Décalage du contenu principal pour compenser la sidebar */
    .main-content {
        margin-left: 60px;
        padding: var(--spacing-lg);
    }

    .sidebar:not(.sidebar--collapsed) ~ .main-content {
        margin-left: 60px;
    }

    /* Overlay pour fermer la sidebar quand ouverte */
    .sidebar:not(.sidebar--collapsed)::before {
        content: '';
        position: fixed;
        top: 0;
        left: 260px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(4px);
        z-index: -1;
    }
}

/* Petit mobile */
@media (max-width: 480px) {
    /* Sidebar encore plus réduite sur petit écran */
    .sidebar {
        width: 56px;
    }

    .sidebar__menu-icon {
        width: 18px;
        min-width: 18px;
        height: 18px;
    }

    .sidebar .sidebar__menu-link {
        padding: 10px 6px;
        margin: 4px 2px;
    }

    .main-content {
        margin-left: 56px;
        padding: var(--spacing-md);
    }

    .sidebar:not(.sidebar--collapsed) ~ .main-content {
        margin-left: 56px;
    }

    .sidebar:not(.sidebar--collapsed)::before {
        left: 260px;
    }
}

/* =================================================================
   BOUTON DE DÉVELOPPEMENT - Ajout de tokens (dev seulement)
   ================================================================= */
.sidebar__dev-form {
    margin: 0;
    padding: 0 var(--spacing-md) 0 var(--spacing-sm);
}

.sidebar__menu-link--dev {
    /* Reset button styles */
    width: 100%;
    border: none;
    cursor: pointer;
    font: inherit;
    text-align: left;

    /* Apply sidebar link styles */
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    margin: var(--spacing-xs) 0;
    text-decoration: none;
    border-radius: var(--border-radius-lg);
    transition:
        background 300ms cubic-bezier(0.4, 0, 0.2, 1),
        color 300ms cubic-bezier(0.4, 0, 0.2, 1),
        transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1);
    gap: var(--spacing-md);
    position: relative;
    font-family: var(--font-secondary);
    font-weight: var(--font-weight-medium);

    /* Dev specific colors - Orange/Amber theme */
    background: linear-gradient(135deg,
        rgba(251, 191, 36, 0.12) 0%,
        rgba(245, 158, 11, 0.10) 100%
    );
    color: #d97706;
    box-shadow: 0 1px 3px rgba(251, 191, 36, 0.1);
}

.sidebar__menu-link--dev:hover {
    background: linear-gradient(135deg,
        rgba(251, 191, 36, 0.20) 0%,
        rgba(245, 158, 11, 0.18) 100%
    );
    color: #b45309;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.sidebar__menu-link--dev:active {
    transform: translateX(1px);
    box-shadow: 0 1px 4px rgba(251, 191, 36, 0.15);
}

.sidebar__menu-link--dev .sidebar__menu-icon {
    color: #f59e0b;
    width: 24px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar__menu-link--dev:hover .sidebar__menu-icon {
    transform: scale(1.1);
}

/* Collapsed state */
.sidebar.sidebar--collapsed .sidebar__dev-form {
    padding: 0 var(--spacing-sm);
}

.sidebar.sidebar--collapsed .sidebar__menu-link--dev {
    padding: var(--spacing-md) var(--spacing-sm);
    justify-content: center;
}

/* =================================================================
   ADMIN SECTION - Séparateur et Catégorie
   ================================================================= */

/* Séparateur avant la section admin */
.sidebar__menu-separator {
    height: 1px;
    background: linear-gradient(90deg,
        rgba(12, 129, 228, 0.08) 0%,
        rgba(12, 129, 228, 0.15) 50%,
        rgba(12, 129, 228, 0.08) 100%
    );
    margin: var(--spacing-lg) var(--spacing-lg);
    list-style: none;
}

/* Catégorie Administration */
.sidebar__menu-category {
    padding: var(--spacing-md) var(--spacing-lg);
    list-style: none;
}

.sidebar__menu-category .sidebar__menu-text {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(12, 129, 228, 0.6);
    opacity: 1;
    transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mode collapsed - masquer le séparateur et la catégorie */
.sidebar.sidebar--collapsed .sidebar__menu-separator {
    margin: var(--spacing-md) var(--spacing-md);
}

.sidebar.sidebar--collapsed .sidebar__menu-category {
    display: none;
}

/* Styles pour l'icône message.html.twig (duoicon) */
.sidebar__menu-icon svg.duoicon-message-3 {
    color: var(--color-primary) !important; /* Override du style inline */
}

.sidebar__menu-icon svg .duoicon-primary-layer {
    color: var(--color-primary);
    opacity: 0.85;
    transition:
        color 300ms cubic-bezier(0.4, 0, 0.2, 1),
        opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar__menu-icon svg .duoicon-secondary-layer {
    color: var(--color-primary);
    opacity: 0.35;
    transition:
        color 300ms cubic-bezier(0.4, 0, 0.2, 1),
        opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover */
.sidebar__menu-link:hover .sidebar__menu-icon svg .duoicon-primary-layer {
    color: var(--color-primary-dark);
    opacity: 1;
}

.sidebar__menu-link:hover .sidebar__menu-icon svg .duoicon-secondary-layer {
    color: var(--color-primary);
    opacity: 0.5;
}

/* État actif */
.sidebar__menu-link.active .sidebar__menu-icon svg .duoicon-primary-layer {
    color: var(--color-primary);
    opacity: 1;
}

.sidebar__menu-link.active .sidebar__menu-icon svg .duoicon-secondary-layer {
    color: var(--color-primary-light);
    opacity: 0.6;
}
