/* ================================
   PATRIMAPP NAVIGATION - HYBRID MODE
   Navbar horizontale (visiteurs) + Sidebar verticale (utilisateurs connectés)
   Design System PM - Version 2.0
   ================================ */

/* Design tokens: centralized in base.css */
:root {
    --sidebar-width: 272px;
    --sidebar-collapsed-width: 68px;
    --navbar-bg: var(--pm-primary, #8B7AB8);
    --navbar-bg-dark: var(--pm-primary-dark, #6B5B95);
    --navbar-accent: var(--pm-secondary, #FF9A76);
    --navbar-accent-dark: var(--pm-secondary-dark, #E67E5C);
    --navbar-hover: rgba(255, 255, 255, 0.08);
    --navbar-active: rgba(255, 154, 118, 0.18);
    --navbar-text: rgba(255, 255, 255, 0.92);
    --navbar-text-dim: rgba(255, 255, 255, 0.6);
    --navbar-border: rgba(255, 255, 255, 0.08);
    --navbar-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    --transition-speed: 0.25s;
}

/* ============================================
   PARTIE 1: NAVBAR HORIZONTALE (NON CONNECTÉ)
   ============================================ */

.main-navbar {
    background: linear-gradient(135deg, var(--navbar-bg) 0%, var(--navbar-bg-dark) 100%) !important;
    box-shadow: var(--pm-shadow-md, var(--navbar-shadow));
    padding: 0.5rem 0;
    border-bottom: none;
    position: relative;
    z-index: 1030;
}

.main-navbar .container-fluid {
    overflow-x: visible !important;
    position: relative !important;
}

.navbar-collapse {
    overflow: visible !important;
}

.navbar-scrolled {
    box-shadow: var(--pm-shadow-lg) !important;
}

/* ============= NAVBAR - BRAND ============= */
.brand-link {
    color: white !important;
    font-weight: 700;
    font-size: 1.3rem;
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    letter-spacing: -0.01em;
}

.brand-link:hover {
    color: var(--navbar-accent) !important;
    transform: none;
    opacity: 0.9;
}

.brand-logo {
    height: 56px;
    width: auto;
    transition: transform var(--transition-speed) ease;
}

.brand-link:hover .brand-logo {
    transform: scale(1.04);
}

.brand-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
}

/* ============= NAVBAR - TOGGLER ============= */
.custom-toggler {
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--pm-radius-md, 6px);
    transition: all var(--transition-speed) ease;
    padding: 0.4rem 0.6rem;
}

.custom-toggler:focus {
    box-shadow: 0 0 0 3px rgba(255, 154, 118, 0.25);
}

.custom-toggler:hover {
    background-color: var(--navbar-accent);
    border-color: var(--navbar-accent);
}

.toggler-active {
    transform: rotate(90deg);
}

/* ============= NAVBAR - LINKS ============= */
.nav-link-custom {
    color: var(--navbar-text) !important;
    font-weight: 500;
    padding: 0.625rem 0.875rem !important;
    border-radius: var(--pm-radius-md, 6px);
    transition: all var(--transition-speed) ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0.125rem;
    text-decoration: none;
    font-size: 0.9375rem;
}

.nav-link-custom:hover {
    color: white !important;
    background-color: var(--navbar-hover);
    transform: none;
}

.nav-icon {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-text {
    font-weight: 500;
}

/* ============= NAVBAR - AUTH LINKS ============= */
.auth-link {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--pm-radius-full, 9999px);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1.25rem !important;
}

.auth-link:hover {
    background-color: var(--navbar-accent);
    color: white !important;
    border-color: var(--navbar-accent);
    box-shadow: 0 2px 8px rgba(255, 154, 118, 0.3);
}

/* ============= NAVBAR - DROPDOWN ============= */
.auth-dropdown .dropdown-menu {
    min-width: 280px !important;
    max-width: 320px !important;
    right: 0 !important;
    left: auto !important;
    padding: 0.5rem 0;
    border-radius: var(--pm-radius-lg, 8px);
    box-shadow: var(--pm-shadow-xl);
    border: 1px solid var(--pm-border-light, #dee2e6);
    background: white;
    margin-top: 0.5rem;
    animation: pm-slideDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1060 !important;
    overflow: hidden;
}

@keyframes pm-slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-dropdown .dropdown-header {
    padding: 0.75rem 1rem 0.625rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pm-primary, #8B7AB8);
    border-bottom: 1px solid var(--pm-border-light, #dee2e6);
    margin-bottom: 0.5rem;
    background-color: var(--pm-surface-2, #f8f9fa);
}

.registration-option {
    padding: 0.875rem 1rem !important;
    margin: 0.25rem 0.5rem !important;
    width: calc(100% - 1rem) !important;
    box-sizing: border-box;
    border-radius: var(--pm-radius-md, 6px) !important;
    transition: all var(--transition-speed) ease !important;
    border: 1.5px solid transparent;
    position: relative;
    overflow: hidden !important;
    color: var(--pm-dark, #343a40);
    text-decoration: none;
    display: block;
    white-space: normal;
}

.registration-option::before {
    display: none;
}

.registration-option:hover {
    background-color: var(--pm-primary-light, rgba(139, 122, 184, 0.1));
    border-color: var(--pm-primary, #8B7AB8);
    transform: none !important;
    box-shadow: none !important;
}

.pro-option:hover {
    background-color: var(--pm-secondary-light, rgba(255, 154, 118, 0.15));
    border-color: var(--pm-secondary, #FF9A76);
}

.auth-dropdown .fa-gift {
    color: var(--pm-primary, #8B7AB8) !important;
    font-size: 1.125rem;
    width: 24px;
    flex-shrink: 0;
}

.auth-dropdown .fa-crown {
    color: var(--pm-secondary, #FF9A76) !important;
    font-size: 1.125rem;
    width: 24px;
    flex-shrink: 0;
    animation: none;
}

.dropdown-divider {
    border-color: var(--pm-border-light, #dee2e6);
    opacity: 1;
    margin: 0.5rem 0.75rem;
}

/* ============================================
   PARTIE 2: SIDEBAR VERTICALE (CONNECTÉ)
   ============================================ */

.sidebar-wrapper {
    position: relative;
}

.main-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--navbar-bg) 0%, var(--navbar-bg-dark) 100%);
    box-shadow: var(--pm-shadow-lg);
    border-right: none;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed) ease, width var(--transition-speed) ease;
}

/* Scrollbar */
.main-sidebar::-webkit-scrollbar {
    width: 4px;
}

.main-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.main-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.main-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ============= SIDEBAR - HEADER ============= */
.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--navbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.sidebar-header .brand-logo {
    height: 44px;
}

.sidebar-header .brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.2rem;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Toggle collapse button */
.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    width: 32px;
    height: 32px;
    border-radius: var(--pm-radius-md, 6px);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-toggle-btn:active {
    transform: scale(0.95);
}

.sidebar-toggle-btn i {
    transition: transform var(--transition-speed) ease;
}

.main-sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

/* Close button */
.sidebar-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--pm-radius-sm, 4px);
    transition: all var(--transition-speed) ease;
    display: none;
}

.sidebar-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ============= SIDEBAR - NAVIGATION ============= */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-title {
    color: var(--navbar-text-dim);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem 1.25rem 0.5rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 1px 0.5rem;
}

/* Sidebar Links */
.sidebar-nav .nav-link-custom {
    padding: 0.625rem 0.875rem !important;
    gap: 0.75rem;
    position: relative;
    width: 100%;
    border-radius: var(--pm-radius-md, 6px);
    font-size: 0.875rem;
}

.sidebar-nav .nav-link-custom:hover {
    transform: none;
    background-color: var(--navbar-hover);
}

.sidebar-nav .nav-link-custom.active {
    background-color: var(--navbar-active);
    border-left: 3px solid var(--navbar-accent);
    font-weight: 600;
}

.sidebar-nav .nav-icon {
    width: 1.25rem;
    font-size: 0.9375rem;
}

/* ============= SIDEBAR - DROPDOWN ============= */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    position: relative;
    cursor: pointer;
}

.dropdown-arrow {
    font-size: 0.625rem;
    margin-left: auto;
    transition: transform var(--transition-speed) ease;
    opacity: 0.5;
}

.dropdown-toggle[aria-expanded="true"] .dropdown-arrow,
.dropdown-toggle:not(.collapsed) .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-submenu {
    background-color: rgba(0, 0, 0, 0.12);
    border-radius: var(--pm-radius-md, 6px);
    margin: 0.25rem 0.5rem;
    overflow: hidden;
}

.submenu-list {
    list-style: none;
    padding: 0.375rem 0;
    margin: 0;
}

.submenu-item {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.5rem 0.875rem 0.5rem 2.25rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    border-radius: var(--pm-radius-sm, 4px);
    margin: 1px 0.375rem;
    font-size: 0.8125rem;
}

.submenu-item:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.08);
}

.submenu-item i {
    width: 1rem;
    text-align: center;
    font-size: 0.8125rem;
    opacity: 0.7;
}

.submenu-item.disabled {
    color: rgba(255, 255, 255, 0.3) !important;
    cursor: not-allowed;
    opacity: 0.5;
}

.submenu-item.disabled:hover {
    background-color: transparent;
}

.submenu-divider {
    border-color: rgba(255, 255, 255, 0.08);
    margin: 0.375rem 0;
}

/* ============= SIDEBAR - FOOTER ============= */
.sidebar-footer {
    border-top: 1px solid var(--navbar-border);
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.08);
}

.user-profile-section {
    position: relative;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--pm-radius-md, 6px);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    color: white;
}

.user-profile-trigger:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
}

.user-profile-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: 1;
    overflow: hidden;
}

.user-icon {
    font-size: 1.75rem;
    color: var(--navbar-accent);
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* Badges */
.plan-badge,
.admin-badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: var(--pm-radius-sm, 4px);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    letter-spacing: 0.02em;
}

.admin-badge {
    background: rgba(220, 53, 69, 0.2);
    color: #FF9A76;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* User Menu */
.user-menu-collapse {
    margin-top: 0.5rem;
    background-color: white;
    border-radius: var(--pm-radius-lg, 8px);
    box-shadow: var(--pm-shadow-xl);
    overflow: hidden;
}

.user-menu-header {
    padding: 0.875rem 1rem;
    background-color: var(--pm-surface-2, #f8f9fa);
    color: var(--pm-dark, #343a40);
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--pm-border-light, #dee2e6);
}

.user-menu-list {
    list-style: none;
    padding: 0.375rem 0;
    margin: 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    color: var(--pm-dark, #343a40);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    font-size: 0.875rem;
}

.user-menu-item:hover {
    background-color: var(--pm-primary-light, rgba(139, 122, 184, 0.1));
    color: var(--pm-primary-dark, #6B5B95);
}

.user-menu-item i {
    width: 1.125rem;
    text-align: center;
    font-size: 0.875rem;
    opacity: 0.7;
}

.user-menu-divider {
    border-color: var(--pm-border-light, #dee2e6);
    margin: 0.25rem 0;
}

.logout-link {
    color: var(--pm-danger, #dc3545) !important;
}

.logout-link:hover {
    background-color: var(--pm-danger-light, rgba(220, 53, 69, 0.1)) !important;
    color: var(--pm-danger, #dc3545) !important;
}

/* ============= MOBILE TOGGLE ============= */
.mobile-sidebar-toggle {
    position: fixed;
    top: 0.875rem;
    left: 0.875rem;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--navbar-bg) 0%, var(--navbar-bg-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--pm-radius-md, 6px);
    font-size: 1.125rem;
    cursor: pointer;
    z-index: 1040;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: none;
    align-items: center;
    justify-content: flex-start;
    gap: 0.625rem;
    box-shadow: var(--pm-shadow-md);
    transition: all var(--transition-speed) ease;
}

.mobile-sidebar-toggle__burger {
    width: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.mobile-sidebar-toggle__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.mobile-sidebar-toggle__logo {
    height: 28px;
    width: auto;
    display: block;
    flex: 0 0 auto;
}

.mobile-sidebar-toggle__text {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
    white-space: nowrap;
}

.mobile-sidebar-toggle__burger,
.mobile-sidebar-toggle__brand,
.mobile-sidebar-toggle__logo,
.mobile-sidebar-toggle__text {
    pointer-events: none;
}

.mobile-sidebar-toggle:hover {
    box-shadow: var(--pm-shadow-lg);
    transform: scale(1.05);
}

/* ============= SIDEBAR OVERLAY ============= */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1025;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============= BODY ADJUSTMENT ============= */
body.user-logged-in {
    padding-left: var(--sidebar-width);
    transition: padding-left var(--transition-speed) ease;
}

body.user-logged-in.sidebar-collapsed {
    padding-left: var(--sidebar-collapsed-width);
}

/* ============= COLLAPSED MODE ============= */
.main-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.main-sidebar.collapsed .brand-text,
.main-sidebar.collapsed .nav-text,
.main-sidebar.collapsed .nav-section-title,
.main-sidebar.collapsed .user-details,
.main-sidebar.collapsed .dropdown-arrow {
    opacity: 0;
    width: 0;
    overflow: hidden;
    display: none;
}

.main-sidebar.collapsed .nav-link-custom {
    justify-content: center;
    padding: 0.75rem 0.5rem !important;
}

.main-sidebar.collapsed .dropdown-toggle {
    cursor: default !important;
    pointer-events: auto !important;
}

.main-sidebar.collapsed .dropdown:hover .dropdown-toggle {
    pointer-events: auto !important;
}

.main-sidebar.collapsed .nav-icon {
    margin: 0;
}

.main-sidebar.collapsed .user-profile-trigger {
    justify-content: center;
    padding: 0.625rem 0.5rem !important;
    min-height: 52px;
    cursor: default !important;
    pointer-events: auto !important;
}

.main-sidebar.collapsed .user-icon {
    margin: 0;
    font-size: 1.5rem !important;
    width: 1.5rem;
    height: 1.5rem;
}

.main-sidebar.collapsed .user-profile-info {
    justify-content: center;
}

.main-sidebar.collapsed .sidebar-header {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.875rem 0.375rem;
}

.main-sidebar.collapsed .sidebar-header-actions {
    width: 100%;
    justify-content: center;
}

.main-sidebar.collapsed .brand-logo {
    height: 36px;
    margin: 0 auto;
}

.main-sidebar.collapsed .brand-link {
    justify-content: center;
}

/* ============= COLLAPSED - POPUPS ============= */
.main-sidebar.collapsed .dropdown {
    position: relative;
}

.sidebar-nav .dropdown-toggle::after {
    display: none !important;
}

.main-sidebar.collapsed .dropdown-submenu {
    visibility: hidden !important;
    opacity: 0 !important;
    position: fixed !important;
    left: var(--sidebar-collapsed-width) !important;
    top: auto;
    width: 200px !important;
    background-color: white !important;
    border-radius: var(--pm-radius-lg, 8px) !important;
    box-shadow: var(--pm-shadow-xl) !important;
    z-index: 9999 !important;
    margin: 0 !important;
    border: 1px solid var(--pm-border-light, #dee2e6) !important;
    pointer-events: auto !important;
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    transition: opacity 0.15s ease, visibility 0s linear 0.15s !important;
}

.main-sidebar.collapsed .dropdown-submenu[style] {
    display: block !important;
}

.main-sidebar.collapsed .dropdown:hover > .dropdown-submenu,
.main-sidebar.collapsed .dropdown-submenu:hover,
.main-sidebar.collapsed .dropdown:hover > .dropdown-submenu.show,
.main-sidebar.collapsed .dropdown:hover > .dropdown-submenu.collapsing {
    visibility: visible !important;
    opacity: 1 !important;
    transition-delay: 0s !important;
}

.main-sidebar.collapsed .submenu-item {
    color: var(--pm-dark, #333) !important;
    padding: 0.5rem 0.875rem !important;
    background-color: white !important;
    display: flex !important;
    margin: 1px 0.375rem !important;
    font-size: 0.8125rem;
}

.main-sidebar.collapsed .submenu-item:hover {
    background-color: var(--pm-primary-light, rgba(139, 122, 184, 0.1)) !important;
    color: var(--pm-primary-dark, #6B5B95) !important;
}

.main-sidebar.collapsed .submenu-list {
    padding: 0.375rem 0;
    margin: 0;
    background-color: white;
}

.main-sidebar.collapsed .submenu-divider {
    border-color: var(--pm-border-light, #dee2e6);
    opacity: 1;
}

.main-sidebar.collapsed .user-profile-section {
    position: relative;
}

.main-sidebar.collapsed .user-menu-collapse {
    visibility: hidden !important;
    opacity: 0 !important;
    position: fixed !important;
    left: var(--sidebar-collapsed-width) !important;
    bottom: 0.75rem;
    width: 230px;
    margin: 0 !important;
    z-index: 9999 !important;
    pointer-events: auto !important;
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    transition: opacity 0.15s ease, visibility 0s linear 0.15s !important;
}

.main-sidebar.collapsed .user-menu-collapse[style] {
    display: block !important;
}

.main-sidebar.collapsed .user-profile-section:hover .user-menu-collapse,
.main-sidebar.collapsed .user-menu-collapse:hover {
    visibility: visible !important;
    opacity: 1 !important;
    transition-delay: 0s !important;
}

.main-sidebar.collapsed .dropdown-toggle::after {
    content: '';
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 5px;
    height: 5px;
    background-color: var(--navbar-accent);
    border-radius: 50%;
    box-shadow: 0 0 3px var(--navbar-accent);
}

/* Tooltip collapsed */
.main-sidebar.collapsed .nav-link-custom {
    position: relative;
}

.main-sidebar.collapsed .nav-link-custom:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--pm-dark, #343a40);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: var(--pm-radius-sm, 4px);
    white-space: nowrap;
    z-index: 10000;
    font-size: 0.8125rem;
    box-shadow: var(--pm-shadow-md);
    animation: pm-fadeIn 0.15s ease;
    pointer-events: none;
    font-weight: 500;
}

.main-sidebar.collapsed .nav-link-custom:hover::before {
    content: '';
    position: absolute;
    left: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 6px 5px 0;
    border-color: transparent var(--pm-dark, #343a40) transparent transparent;
    z-index: 10001;
}

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

@media (min-width: 992px) {
    .navbar .navbar-collapse .dropdown-menu {
        position: absolute !important;
    }

    .sidebar-close-btn,
    .mobile-sidebar-toggle,
    .sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 991px) {
    .main-navbar {
        padding: 0.375rem 0;
    }

    .brand-link {
        font-size: 1.15rem;
    }

    .brand-logo {
        height: 40px;
    }

    .navbar .navbar-collapse {
        background-color: rgba(107, 91, 149, 0.97);
        backdrop-filter: blur(12px);
        border-radius: var(--pm-radius-lg, 8px);
        margin-top: 0.75rem;
        padding: 1rem;
    }

    .navbar .dropdown-menu {
        position: static !important;
        transform: none !important;
        float: none !important;
        box-shadow: none !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        margin-top: 0.375rem !important;
        margin-bottom: 0.375rem !important;
        border-radius: var(--pm-radius-md, 6px) !important;
        max-width: 100% !important;
        width: auto !important;
        background-color: rgba(255, 255, 255, 0.97) !important;
    }

    body.user-logged-in {
        padding-left: 0 !important;
        padding-top: 52px;
    }

    .sidebar-wrapper {
        position: relative;
        z-index: 1030;
    }

    .main-sidebar {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        max-width: none;
        height: auto;
        max-height: 0;
        transform: none;
        overflow: hidden;
        box-shadow: none;
        transition: max-height var(--transition-speed) ease;
    }

    /* Mobile: le branding est déjà affiché dans la barre fixe du burger */
    .main-sidebar .sidebar-header {
        display: none;
    }

.main-sidebar.active {
    max-height: calc(100vh - 52px);
    overflow-y: auto;
    box-shadow: var(--pm-shadow-lg);
}

/* Robust mobile behavior (incl. onboarding): keep internal sidebar branding hidden */
.main-sidebar.active .sidebar-header {
    display: none;
}

    .mobile-sidebar-toggle {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 52px;
        border-radius: 0;
        justify-content: flex-start;
        padding: 0 1rem;
        display: flex;
        z-index: 1048;
        box-shadow: none;
    }

    .sidebar-close-btn {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .sidebar-header .brand-logo {
        height: 40px;
    }

    .sidebar-header .brand-text {
        font-size: 1.15rem;
    }
}

@media (max-width: 575px) {
    .brand-logo {
        height: 32px;
    }

    .sidebar-header .brand-logo {
        height: 35px;
    }

    .main-sidebar.active {
        max-height: calc(100vh - 48px);
    }

    .mobile-sidebar-toggle {
        width: 100%;
        height: 48px;
        font-size: 1rem;
        padding: 0 0.875rem;
    }

    .mobile-sidebar-toggle__logo {
        height: 24px;
    }

    .mobile-sidebar-toggle__text {
        font-size: 0.95rem;
    }

    body.user-logged-in {
        padding-top: 48px;
    }
}

/* ============= ANIMATIONS ============= */
@keyframes ripple-animation {
    to {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes pm-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 154, 118, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(255, 154, 118, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 154, 118, 0); }
}

/* ============= PRINT ============= */
@media print {
    .main-navbar,
    .main-sidebar,
    .mobile-sidebar-toggle,
    .sidebar-overlay {
        display: none !important;
    }

    body,
    body.user-logged-in {
        padding-left: 0 !important;
    }
}

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