/* ==========================================================================
   ROUGIER & FILS - Modern Topbar Design System
   Version: 2026.10.30
   ========================================================================== */

/* Main Navigation Bar Container */
#topbar.topbar,
.topbar.topbar-modern {
    height: 64px !important;
    min-height: 64px !important;
    background: linear-gradient(135deg, #0e1e38 0%, #162e52 50%, #0c1a30 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.35), 0 2px 6px -1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    padding: 0 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    position: relative;
    overflow: visible !important;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Sticky state if required by appro / detail_valide_com */
#topbar[style*="position: sticky"],
#topbar[style*="position:sticky"] {
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    background: linear-gradient(135deg, rgba(14, 30, 56, 0.95) 0%, rgba(22, 46, 82, 0.95) 50%, rgba(12, 26, 48, 0.95) 100%) !important;
}

/* Reset inner Bootstrap elements height */
#topbar .navbar-nav {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    height: 100% !important;
}

#topbar .nav-item {
    display: flex !important;
    align-items: center !important;
}

#topbar .nav-item .nav-link {
    height: auto !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    color: inherit !important;
}

/* Brand / Logo */
.topbar-brand {
    background: transparent !important;
    padding: 3px 6px !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease !important;
    text-decoration: none !important;
    margin-right: 0.75rem !important;
    flex-shrink: 0;
}

.topbar-brand:hover {
    transform: none !important;
    opacity: 0.85 !important;
    box-shadow: none !important;
}

.topbar-logo-img {
    max-height: 2.15rem !important;
    height: auto !important;
    width: auto !important;
    display: block !important;
    object-fit: contain !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35)) !important;
}

/* Sidebar Toggle Top (Mobile) */
.topbar-sidebar-toggle {
    width: 38px !important;
    height: 38px !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease !important;
    margin-right: 0.75rem !important;
    cursor: pointer;
}

@media (min-width: 768px) {
    .topbar-sidebar-toggle {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .topbar-sidebar-toggle {
        display: inline-flex !important;
    }
}

.topbar-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}

/* Left Zone (Role Pill + Breadcrumbs) */
.topbar-left-zone {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    flex-grow: 1;
    overflow: visible !important;
}

/* Role Selector Capsule & Dropdown */
.topbar-role-dropdown {
    position: relative !important;
    display: inline-block !important;
    flex-shrink: 0;
}

.topbar-role-btn {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 9999px !important;
    padding: 0.35rem 0.95rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    color: #ffffff !important;
    font-size: 0.84rem !important;
    font-weight: 500 !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
    cursor: pointer !important;
    text-decoration: none !important;
    line-height: 1.2 !important;
}

.topbar-role-btn::after {
    display: none !important;
}

.topbar-role-btn:hover,
.topbar-role-dropdown.show .topbar-role-btn {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(96, 165, 250, 0.6) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25) !important;
}

.topbar-role-btn .role-icon-shield {
    color: #60a5fa !important;
    font-size: 0.88rem !important;
}

.topbar-role-btn .role-current-name {
    color: #ffffff !important;
    letter-spacing: -0.01em !important;
    font-weight: 500 !important;
}

.topbar-role-btn .role-chevron {
    color: rgba(255, 255, 255, 0.55) !important;
    font-size: 0.68rem !important;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin-left: 2px !important;
}

.topbar-role-dropdown.show .role-chevron {
    transform: rotate(180deg) !important;
    color: #60a5fa !important;
}

/* Menu Dropdown Moderne Glassmorphism */
.topbar-role-menu {
    display: none;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    background: rgba(15, 29, 54, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 14px !important;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.55), 0 0 20px rgba(37, 99, 235, 0.15) !important;
    padding: 0.45rem !important;
    margin-top: 8px !important;
    min-width: 235px !important;
    z-index: 1060 !important;
}

.topbar-role-dropdown.show .topbar-role-menu,
.topbar-role-menu.show {
    display: block !important;
    animation: topbarRoleMenuFade 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes topbarRoleMenuFade {
    from {
        opacity: 0;
        margin-top: 0.2rem !important;
    }
    to {
        opacity: 1;
        margin-top: 0.55rem !important;
    }
}

.topbar-role-header {
    font-size: 0.68rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    color: #94a3b8 !important;
    padding: 0.45rem 0.75rem 0.35rem 0.75rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    margin-bottom: 0.35rem !important;
    display: flex !important;
    align-items: center !important;
}

.topbar-role-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.topbar-role-item {
    display: flex !important;
    align-items: center !important;
    padding: 0.55rem 0.75rem !important;
    border-radius: 9px !important;
    color: #e2e8f0 !important;
    font-size: 0.84rem !important;
    font-weight: 500 !important;
    transition: all 0.15s ease !important;
    cursor: pointer !important;
    text-decoration: none !important;
    position: relative !important;
}

.topbar-role-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

.topbar-role-item.is-active {
    background: rgba(37, 99, 235, 0.22) !important;
    border: 1px solid rgba(59, 130, 246, 0.35) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.role-item-icon {
    width: 22px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 0.55rem !important;
    font-size: 0.9rem !important;
}

.role-item-text {
    flex: 1 !important;
    white-space: nowrap !important;
}

.role-item-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    background: #10b981 !important;
    color: #ffffff !important;
    font-size: 0.65rem !important;
    margin-left: 0.5rem !important;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6) !important;
}

/* Breadcrumbs & Page Titles */
.topbar-breadcrumb {
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    color: rgba(255, 255, 255, 0.85) !important;
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.topbar-breadcrumb a {
    color: rgba(255, 255, 255, 0.65) !important;
    text-decoration: none !important;
    transition: color 0.15s ease !important;
    font-weight: 500 !important;
}

.topbar-breadcrumb a:hover {
    color: #60a5fa !important;
}

.topbar-breadcrumb i.fa-angle-right,
.topbar-breadcrumb i.fa-chevron-right {
    opacity: 0.45 !important;
    margin: 0 7px !important;
    font-size: 0.72rem !important;
    color: #cbd5e1 !important;
}

.topbar-breadcrumb span.current-page,
.topbar-breadcrumb > a:last-child:not([href]) {
    color: #ffffff !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
}

/* Alert Notification Chips (Optim, System alerts) */
.topbar-alert-chip {
    display: inline-flex !important;
    align-items: center !important;
    padding: 4px 12px !important;
    border-radius: 9999px !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    transition: all 0.2s ease !important;
}

.topbar-alert-chip.topbar-alert-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    color: #fbbf24 !important;
}

.topbar-alert-chip.topbar-alert-success {
    background: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    color: #34d399 !important;
}

.topbar-alert-chip.topbar-alert-danger {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
}

.topbar-alert-chip a {
    color: inherit !important;
    text-decoration: none !important;
}

/* Modern Topbar Action Buttons & Tabs */
.topbar-btn-glass {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #f1f5f9 !important;
    font-weight: 500 !important;
    font-size: 0.82rem !important;
    padding: 0.42rem 0.85rem !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
    text-decoration: none !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
    transform: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.topbar-btn-glass:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    transform: none !important;
    font-weight: 500 !important;
    font-size: 0.82rem !important;
    box-shadow: none !important;
}

.topbar-btn-glass:focus,
.topbar-btn-glass:active {
    background: rgba(255, 255, 255, 0.14) !important;
    transform: none !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Active State for Current Page */
.topbar-btn-glass.topbar-btn-active,
.topbar-btn-active {
    background: rgba(59, 130, 246, 0.25) !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
    font-weight: 500 !important;
    font-size: 0.82rem !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Primary CTA Button (e.g. + Commande) */
.topbar-btn-primary {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #f1f5f9 !important;
    font-weight: 500 !important;
    font-size: 0.82rem !important;
    padding: 0.42rem 0.85rem !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
    transform: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.topbar-btn-primary:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    transform: none !important;
    font-weight: 500 !important;
    font-size: 0.82rem !important;
    box-shadow: none !important;
}

.topbar-btn-primary:focus,
.topbar-btn-primary:active {
    background: rgba(255, 255, 255, 0.14) !important;
    transform: none !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Warning CTA Button (e.g. Revenir au menu chef) */
.topbar-btn-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    color: #fef3c7 !important;
    font-weight: 500 !important;
    font-size: 0.82rem !important;
    padding: 0.42rem 0.85rem !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: background-color 0.15s ease, border-color 0.15s ease !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transform: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.topbar-btn-warning:hover {
    background: rgba(245, 158, 11, 0.25) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    color: #ffffff !important;
    transform: none !important;
    font-weight: 500 !important;
    font-size: 0.82rem !important;
    box-shadow: none !important;
}

.topbar-btn-warning:focus,
.topbar-btn-warning:active {
    transform: none !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Subtle Vertical Divider */
.topbar-divider {
    width: 1px !important;
    height: 28px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    margin: 0 0.65rem !important;
    border: none !important;
    align-self: center !important;
    flex-shrink: 0;
}

/* User Profile Chip */
.topbar-user-chip {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 9999px !important;
    padding: 4px 12px 4px 5px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    flex-shrink: 0;
}

.topbar-user-chip:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    transform: none !important;
    box-shadow: none !important;
}

.topbar-user-avatar-wrap {
    position: relative !important;
    width: 30px !important;
    height: 30px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.topbar-user-avatar-wrap .img-profile {
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
}

.topbar-status-dot {
    position: absolute !important;
    bottom: -1px !important;
    right: -1px !important;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #10b981 !important;
    border: 1.5px solid #0e1e38 !important;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}

.topbar-user-greeting {
    font-size: 0.65rem !important;
    text-transform: uppercase !important;
    color: rgba(255, 255, 255, 0.6) !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    line-height: 1 !important;
}

.topbar-user-name {
    font-size: 0.84rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
}

.topbar-user-chevron {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.65rem !important;
    transition: transform 0.2s ease !important;
    margin-left: 2px !important;
}

.nav-item.dropdown.show .topbar-user-chevron {
    transform: rotate(180deg) !important;
    color: #60a5fa !important;
}

/* User Dropdown Menu */
.topbar-dropdown-menu {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3) !important;
    padding: 6px !important;
    margin-top: 8px !important;
    min-width: 210px !important;
    animation: topbarDropdownFade 0.2s ease-out forwards;
}

@keyframes topbarDropdownFade {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.topbar-dropdown-menu .dropdown-item {
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    color: #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: all 0.15s ease !important;
}

.topbar-dropdown-menu .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

.topbar-dropdown-menu .dropdown-item.text-danger {
    color: #f87171 !important;
}

.topbar-dropdown-menu .dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
}

.topbar-dropdown-menu .dropdown-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    margin: 4px 0 !important;
}

/* Circular Quick Tool Buttons */
.topbar-circle-btn {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    padding: 0 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    flex-shrink: 0;
}

.topbar-circle-btn:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    transform: none !important;
    box-shadow: none !important;
}

.topbar-badge-dot {
    position: absolute !important;
    top: -2px !important;
    right: -2px !important;
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
    background: #ef4444 !important;
    border: 2px solid #0e1e38 !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.8) !important;
    animation: topbarPulse 2s infinite !important;
}

.topbar-badge-count {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    min-width: 17px !important;
    height: 17px !important;
    border-radius: 9999px !important;
    background: #ef4444 !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 4px !important;
    border: 1.5px solid #0e1e38 !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.7) !important;
}

@keyframes topbarPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Mobile responsiveness adjustments */
@media (max-width: 991.98px) {
    #topbar.topbar {
        padding: 0 0.75rem !important;
    }
    .topbar-btn-glass,
    .topbar-btn-primary {
        padding: 0.35rem 0.65rem !important;
        font-size: 0.78rem !important;
    }
    .topbar-divider {
        margin: 0 0.35rem !important;
    }
}
