/* ============================================
   ADMIN PANEL - Sidebar, Context Menus, Modals
   ============================================ */

/* --- Top Header Premium Refinement --- */
.top-header {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 0.8rem 2rem !important;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

.admin-title {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: var(--text-main) !important;
}

/* Sidebar Branding */
.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.sidebar-subtitle {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    opacity: 0.7;
    line-height: 1.2;
    margin-top: 2px;
}

/* Sidebar Profile Dropdown */
.sidebar-profile {
    margin-top: auto;
    position: relative;
}

.profile-menu {
    position: absolute;
    bottom: 100%;
    left: 0.75rem;
    right: 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 -10px 30px -10px rgba(0, 0, 0, 0.18);
    padding: 0.4rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: 200;
}

.sidebar-profile.open .profile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(-6px);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.7rem;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.profile-menu-item i {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.profile-menu-item:hover {
    background: rgba(37, 83, 135, 0.06);
}

.profile-menu-item.logout {
    color: #ef4444;
}

.profile-menu-item.logout i {
    color: #ef4444;
}

.profile-menu-sep {
    height: 1px;
    background: var(--border);
    margin: 0.3rem 0.2rem;
}

.profile-caret {
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.sidebar-profile.open .profile-caret {
    transform: rotate(180deg);
}

/* Sidebar Profile Section */
.sidebar-user {
    cursor: pointer;
    padding: 1.25rem 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #fbfbfc;
    transition: background 0.2s;
}

.sidebar-user:hover {
    background: white;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary) 0%, #17365d 100%);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(37, 83, 135, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sidebar-logout {
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.sidebar-logout:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Header Context Badge */
.header-context {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(37, 83, 135, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(37, 83, 135, 0.1);
}

.context-icon {
    font-size: 1.2rem;
    color: var(--primary);
}

.context-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


.header-actions {
    gap: 0.5rem !important;
}

.header-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-muted) !important;
    font-size: 1.3rem !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    background: transparent;
}

.header-icon:hover {
    background: rgba(37, 83, 135, 0.06) !important;
    color: var(--primary) !important;
    transform: translateY(-2px);
}

.header-icon.logout {
    color: #ef4444 !important;
    opacity: 0.8;
}

.header-icon.logout:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #ef4444 !important;
    opacity: 1;
}

.header-icon i {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.header-icon:hover i {
    transform: scale(1.1);
}


/* --- Sidebar Extras --- */
.search-hidden {
    display: none !important;
}

#sidebarSearchResults {
    border: 1px solid var(--border) !important;
    box-shadow: 0 20px 40px -15px rgba(0,0,0,0.15) !important;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95) !important;
    animation: menuFadeZoom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-res-item {
    transition: all 0.2s ease !important;
    border-bottom: 1px solid rgba(0,0,0,0.03) !important;
}

.search-res-item:hover {
    background: rgba(37, 83, 135, 0.05) !important;
    padding-left: 1.25rem !important;
}

.sub-menu-item:hover {
    background: rgba(37, 83, 135, 0.08) !important;
    color: var(--primary) !important;
    transform: translateX(4px);
}

.sub-menu-item {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    position: relative;
    overflow: hidden;
}

.sub-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) translateX(-100%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    transition: transform 0.3s ease;
}

.sub-menu-item.active-sub::before {
    transform: translateY(-50%) translateX(0);
}

.sub-menu-item.active-sub {
    color: var(--primary) !important;
    font-weight: 600 !important;
    background: rgba(37, 83, 135, 0.05) !important;
}

.sub-menu-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.6rem;
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 6px;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-weight: 400;
    transition: var(--transition-fast);
}

.toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.menu-item.active .toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.toggle-sec-btn:hover {
    background: rgba(37, 83, 135, 0.15);
    color: var(--primary) !important;
    transform: rotate(90deg);
}

.toggle-icon {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Sidebar Entrance Animation --- */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-menu > * {
    opacity: 0;
    animation: slideInFromLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Staggered delays for the first 10 items */
.sidebar-menu > *:nth-child(1) { animation-delay: 0.1s; }
.sidebar-menu > *:nth-child(2) { animation-delay: 0.15s; }
.sidebar-menu > *:nth-child(3) { animation-delay: 0.2s; }
.sidebar-menu > *:nth-child(4) { animation-delay: 0.25s; }
.sidebar-menu > *:nth-child(5) { animation-delay: 0.3s; }
.sidebar-menu > *:nth-child(6) { animation-delay: 0.35s; }
.sidebar-menu > *:nth-child(7) { animation-delay: 0.4s; }
.sidebar-menu > *:nth-child(8) { animation-delay: 0.45s; }
.sidebar-menu > *:nth-child(9) { animation-delay: 0.5s; }
.sidebar-menu > *:nth-child(10) { animation-delay: 0.55s; }

/* --- Modern Sidebar Styling --- */
.sidebar-header {
    transition: all 0.3s ease;
}

.sidebar-header .sidebar-logo {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-header:hover .sidebar-logo {
    transform: rotate(15deg) scale(1.1);
}

.search-box {
    transition: all 0.3s ease;
    border-width: 1.5px !important;
}

.search-box:focus-within {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 83, 135, 0.1);
    transform: translateY(-1px);
}

.search-box:focus-within i {
    color: var(--primary);
    transform: scale(1.1);
}

.menu-item {
    border-radius: 8px !important;
    margin: 0.2rem 1rem !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    padding: 0.7rem 1rem !important;
}

.menu-item:not(.active):hover {
    background: rgba(37, 83, 135, 0.05);
    transform: translateX(5px);
}

.menu-item.active {
    box-shadow: 0 8px 16px -4px rgba(37, 83, 135, 0.4);
    transform: scale(1.02);
    background: linear-gradient(135deg, var(--primary) 0%, #17365d 100%) !important;
}

.menu-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 40%;
    background: white;
    border-radius: 0 4px 4px 0;
    opacity: 0.8;
}

/* Accordion Smooth Transition */
.sub-menu-container, .nested-sub-menu {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.sub-menu-container.open, .nested-sub-menu.open {
    max-height: none;
    opacity: 1;
}

/* Smooth icons */
.menu-item i:not(.toggle-icon),
.sub-menu-item i {
    transition: transform 0.3s ease;
}

.menu-item:hover i:not(.toggle-icon),
.sub-menu-item:hover i {
    transform: scale(1.1);
}

.menu-add {
    margin: 1.5rem !important;
    border-radius: 12px !important;
    border: 2px dashed rgba(37, 83, 135, 0.2) !important;
    color: var(--text-muted);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    position: relative;
    overflow: hidden;
}

.menu-add:hover {
    background: rgba(37, 83, 135, 0.03);
    border-color: var(--primary) !important;
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px -10px rgba(37, 83, 135, 0.3);
}

.menu-add:hover i {
    transform: scale(1.2);
}

.menu-add::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 83, 135, 0.05), transparent);
    transition: 0.5s;
}

.menu-add:hover::after {
    left: 100%;
}

/* --- Context Menu --- */
@keyframes menuFadeZoom {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-animated {
    animation: menuFadeZoom 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top left;
}

.ctx-item {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    border-radius: 6px;
    transition: var(--transition-fast);
    margin-top: 0.25rem;
}

.ctx-item i {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.ctx-item:hover {
    background: rgba(37, 83, 135, 0.08);
    color: var(--primary);
}

.ctx-item:hover i {
    color: var(--primary);
}

.ctx-item.delete {
    color: #ef4444;
}

.ctx-item.delete i {
    color: #f87171;
}

.ctx-item.delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

.ctx-item.delete:hover i {
    color: #ef4444;
}

/* --- Modal Backdrops & Animation --- */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.modal-animated {
    animation: fadeZoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeZoomIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* --- Pro Inputs --- */
.pro-input-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.pro-input-group i {
    position: absolute;
    top: 50%;
    left: 1.25rem;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.pro-input-group .pro-input {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 3.2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: var(--transition-fast);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
}

.pro-input-group .pro-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 83, 135, 0.1);
}

/* Icône alignée en haut pour les champs multi-lignes / fichier */
.pro-input-group:has(textarea) i,
.pro-input-group:has(input[type="file"]) i {
    top: 1.15rem;
    transform: none;
}

/* Champ d'import de fichier — rendu plus propre */
.pro-input-group .pro-input[type="file"] {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1.6;
}

.pro-input-group .pro-input[type="file"]::file-selector-button {
    margin-right: 0.85rem;
    padding: 0.4rem 0.9rem;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.pro-input-group .pro-input[type="file"]::file-selector-button:hover {
    filter: brightness(1.1);
}

/* --- Role Cards --- */
.roles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.role-card {
    display: block;
    cursor: pointer;
    user-select: none;
}

.role-card-content {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    gap: 0.75rem;
    transition: all 0.2s ease;
    background: white;
}

.role-card:hover .role-card-content {
    border-color: rgba(37, 83, 135, 0.4);
    background: rgba(37, 83, 135, 0.02);
}

.role-card input[type="checkbox"]:checked+.role-card-content {
    border-color: var(--primary);
    background: rgba(37, 83, 135, 0.05);
}

.role-card input[type="checkbox"]:checked+.role-card-content .check-icon {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.role-card input[type="checkbox"]:checked+.role-card-content>i,
.role-card input[type="checkbox"]:checked+.role-card-content .role-name {
    color: var(--primary);
}

.check-icon {
    margin-left: auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: transparent;
    transition: all 0.2s ease;
}

.role-card-content>i {
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.role-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.role-card.disabled {
    cursor: not-allowed;
}

.role-card.disabled:hover .role-card-content {
    border-color: var(--primary);
    background: rgba(37, 83, 135, 0.05);
}

/* --- Danger Pulse (Delete modals) --- */
.danger-icon-wrapper {
    position: relative;
    width: 76px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fee2e2;
    border-radius: 50%;
}

.icon-pulse {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: #ef4444;
    opacity: 0.2;
    animation: pulseDanger 2s infinite;
}

@keyframes pulseDanger {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.4);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* --- Button overrides for modals (consolidated) --- */
.btn-confirm-delete {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
    text-decoration: none;
}

.btn-confirm-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.35);
    color: white;
}

/* --- Icon Picker --- */
.icon-picker {
    margin-bottom: 1.5rem;
}

.icon-picker-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.6rem;
}

.icon-picker-search i {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.icon-picker-search input {
    border: none;
    background: none;
    outline: none;
    width: 100%;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-main);
}

.icon-picker-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
}

.icon-cat-chip {
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.icon-cat-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.icon-cat-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    border: 1px solid var(--border);
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.icon-option:hover {
    background: rgba(37, 83, 135, 0.05);
    color: var(--primary);
    transform: scale(1.1);
}

.icon-option.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(37, 83, 135, 0.3);
}

/* --- Icônes automobiles personnalisées (SVG via mask) --- */
i[class*="bxc-"] {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

i.bxc-tire {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 1.5A10.5 10.5 0 1 0 12 22.5A10.5 10.5 0 0 0 12 1.5ZM12 7A5 5 0 1 1 12 17A5 5 0 0 1 12 7Z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 1.5A10.5 10.5 0 1 0 12 22.5A10.5 10.5 0 0 0 12 1.5ZM12 7A5 5 0 1 1 12 17A5 5 0 0 1 12 7Z'/%3E%3C/svg%3E");
}

i.bxc-wheel {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2A10 10 0 1 0 12 22A10 10 0 0 0 12 2ZM12 5A7 7 0 1 1 12 19A7 7 0 0 1 12 5Z'/%3E%3Ccircle cx='12' cy='12' r='2.2'/%3E%3Crect x='11' y='5' width='2' height='6'/%3E%3Crect x='11' y='13' width='2' height='6'/%3E%3Crect x='5' y='11' width='6' height='2'/%3E%3Crect x='13' y='11' width='6' height='2'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2A10 10 0 1 0 12 22A10 10 0 0 0 12 2ZM12 5A7 7 0 1 1 12 19A7 7 0 0 1 12 5Z'/%3E%3Ccircle cx='12' cy='12' r='2.2'/%3E%3Crect x='11' y='5' width='2' height='6'/%3E%3Crect x='11' y='13' width='2' height='6'/%3E%3Crect x='5' y='11' width='6' height='2'/%3E%3Crect x='13' y='11' width='6' height='2'/%3E%3C/svg%3E");
}

i.bxc-steering {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2A10 10 0 1 0 12 22A10 10 0 0 0 12 2ZM12 5A7 7 0 1 1 12 19A7 7 0 0 1 12 5Z'/%3E%3Ccircle cx='12' cy='12' r='2.7'/%3E%3Crect x='5' y='11' width='14' height='2'/%3E%3Crect x='11' y='12' width='2' height='7'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2A10 10 0 1 0 12 22A10 10 0 0 0 12 2ZM12 5A7 7 0 1 1 12 19A7 7 0 0 1 12 5Z'/%3E%3Ccircle cx='12' cy='12' r='2.7'/%3E%3Crect x='5' y='11' width='14' height='2'/%3E%3Crect x='11' y='12' width='2' height='7'/%3E%3C/svg%3E");
}

i.bxc-brake {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2A10 10 0 1 0 12 22A10 10 0 0 0 12 2ZM12 7.5A4.5 4.5 0 1 1 12 16.5A4.5 4.5 0 0 1 12 7.5Z'/%3E%3Ccircle cx='12' cy='5' r='1.1'/%3E%3Ccircle cx='12' cy='19' r='1.1'/%3E%3Ccircle cx='5' cy='12' r='1.1'/%3E%3Ccircle cx='19' cy='12' r='1.1'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2A10 10 0 1 0 12 22A10 10 0 0 0 12 2ZM12 7.5A4.5 4.5 0 1 1 12 16.5A4.5 4.5 0 0 1 12 7.5Z'/%3E%3Ccircle cx='12' cy='5' r='1.1'/%3E%3Ccircle cx='12' cy='19' r='1.1'/%3E%3Ccircle cx='5' cy='12' r='1.1'/%3E%3Ccircle cx='19' cy='12' r='1.1'/%3E%3C/svg%3E");
}

i.bxc-battery {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 8h16v12H4z'/%3E%3Cpath d='M6 8V6h4v2z'/%3E%3Cpath d='M14 8V6h4v2z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 8h16v12H4z'/%3E%3Cpath d='M6 8V6h4v2z'/%3E%3Cpath d='M14 8V6h4v2z'/%3E%3C/svg%3E");
}

i.bxc-fuel {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 6h11v15H5z'/%3E%3Cpath d='M16 9h3v2h-3z'/%3E%3Cpath d='M8 4h5v2H8z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 6h11v15H5z'/%3E%3Cpath d='M16 9h3v2h-3z'/%3E%3Cpath d='M8 4h5v2H8z'/%3E%3C/svg%3E");
}

i.bxc-cone {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 3h2l5 16H6z'/%3E%3Crect x='4' y='19' width='16' height='2.5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 3h2l5 16H6z'/%3E%3Crect x='4' y='19' width='16' height='2.5'/%3E%3C/svg%3E");
}

/* --- List View Refinement --- */
.cards-container.list-view .cat-card,
.cards-container.list-view .section-card {
    border-radius: 12px;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1.5rem;
    gap: 1rem;
}


/* --- Document Explorer Premium --- */
#documentsManagerModal .modal-animated {
    max-width: 95%;
    width: 1000px !important; /* Slightly wider */
    height: 85vh !important;
    border-radius: 20px !important;
}

#docFoldersList .folder-sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    border: 1px solid transparent;
    margin-bottom: 0.25rem;
}

#docFoldersList .folder-sidebar-item:hover {
    background: rgba(37, 83, 135, 0.05) !important;
    transform: translateX(4px);
    color: var(--primary);
}

#docFoldersList .folder-sidebar-item.active {
    background: rgba(37, 83, 135, 0.08) !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
    border-left: 3px solid var(--primary);
}

.create-folder-btn {
    width: 100%;
    padding: 0.8rem;
    border: 2px dashed rgba(37, 83, 135, 0.15);
    background: white;
    color: var(--primary);
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

.create-folder-btn:hover {
    background: rgba(37, 83, 135, 0.03);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 83, 135, 0.1);
}

.create-folder-btn i {
    font-size: 1.2rem;
}


.doc-item-card {
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    padding: 1.25rem !important;
    border-radius: 16px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.doc-item-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 40px -15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary) !important;
}

.doc-item-card:hover .doc-card-actions {
    opacity: 1 !important;
    transform: translateY(0);
}

.doc-card-actions {
    transform: translateY(-10px);
}


.doc-icon-wrapper {
    width: 64px;
    height: 64px;
    background: #f8fafc;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.doc-item-card:hover .doc-icon-wrapper {
    background: rgba(37, 83, 135, 0.05);
    transform: scale(1.05);
}

.doc-item-card:hover .doc-icon-wrapper i {
    color: var(--primary) !important;
    opacity: 1 !important;
}

.view-doc-btn {
    transition: all 0.3s ease !important;
    background: transparent;
}

.view-doc-btn:hover {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

@keyframes fadeInCard {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Draggable Cues */
.folder-sidebar-item.drag-over {
    background: rgba(37, 83, 135, 0.15) !important;
    border-color: var(--primary) !important;
    transform: scale(1.02);
}

/* Staggered load for folders */
.folder-sidebar-item {
    opacity: 0;
    animation: fadeInSlideRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInSlideRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
/* ============================================================
   RESPONSIVE — tablette & mobile
   ============================================================ */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1300;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--primary);
    font-size: 1.5rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1200;
}
.mobile-sidebar-overlay.active { display: block; }

/* Variante intégrée dans la barre du haut (pas en position fixe). */
.mobile-menu-btn.in-header {
    position: static;
    flex: 0 0 auto;
    margin-right: 0.75rem;
}

/* Le hamburger se masque pendant que la sidebar est ouverte
   (l'overlay sert alors à la refermer) — évite qu'il chevauche le logo. */
body.sidebar-mobile-open .mobile-menu-btn { display: none; }

@media (max-width: 1024px) {
    .cards-container {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1250;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    }
    .sidebar.mobile-open { transform: translateX(0); }

    .main-content { width: 100%; }

    .cards-container {
        grid-template-columns: 1fr !important;
        padding: 1rem !important;
    }

    .sub-actions { flex-wrap: wrap; }

    /* Les tableaux de données restent défilables horizontalement */
    .spreadsheet-table { min-width: 560px; }

    /* Modales : pleine largeur sur petit écran */
    .modal-animated { width: 94vw !important; max-width: 94vw !important; }

    /* Modale Utilisateurs : empilement vertical (table puis rôles) */
    .users-modal-body { flex-direction: column !important; overflow-y: auto !important; }
    .users-table-panel {
        border-right: none !important;
        border-bottom: 1px solid var(--border) !important;
        padding: 1rem !important;
        overflow-x: auto !important;
    }
    .users-roles-panel { width: 100% !important; }
    #usersManagerModal .modal-animated { max-height: 92vh !important; }

    /* Modale Documents : explorateur compacté */
    #documentsManagerModal .modal-animated { width: 96vw !important; height: 90vh !important; }
    .docs-folders-panel { width: 140px !important; }
    #docSearchInput { width: 100% !important; }
    .doc-search-box { width: 160px !important; }
    .users-table { min-width: 540px; }
}

/* Cellule de tableau correspondant à un terme recherché */
.cell-input.cell-match {
    background: #fff8c5;
    font-weight: 600;
}

/* Cellule dont la valeur ne respecte pas le type de colonne */
.cell-input.cell-invalid {
    background: #fee2e2 !important;
    box-shadow: inset 0 0 0 1.5px #ef4444;
    color: #b91c1c;
}

/* Sélecteur de type dans la fenêtre « Gérer les colonnes » */
.col-type-select {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.4rem;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--text-muted);
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
}
.col-type-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ============================================================
   NOTIFICATIONS TOAST
   ============================================================ */
#toastWrap {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    pointer-events: none;
}
.ns-toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #fff;
    border-left: 4px solid #10b981;
    border-radius: 10px;
    padding: 0.85rem 1.1rem;
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.28);
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    min-width: 240px;
    max-width: 360px;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.3s, transform 0.3s;
}
.ns-toast.show {
    opacity: 1;
    transform: translateX(0);
}
.ns-toast i { font-size: 1.35rem; flex-shrink: 0; }
.ns-toast-success { border-left-color: #10b981; }
.ns-toast-success i { color: #10b981; }
.ns-toast-error { border-left-color: #ef4444; }
.ns-toast-error i { color: #ef4444; }
.ns-toast-info { border-left-color: #255387; }
.ns-toast-info i { color: #255387; }

/* --- Boutons d'action en icône seule + infobulle --- */
.tbar-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    text-decoration: none;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.tbar-icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.015);
}
.tbar-icon-btn i { pointer-events: none; }

/* Infobulle générique (data-tooltip) */
.tip { position: relative; }
.tip::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--text-main);
    color: #fff;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 200;
}
.tip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Barre d'actions collée à droite : les infobulles s'ouvrent vers l'intérieur
   (alignées sur le bord droit du bouton) pour ne pas déborder de l'écran. */
.sub-actions .tip::after {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(4px);
}
.sub-actions .tip:hover::after {
    transform: translateX(0) translateY(0);
}

/* Libellé optionnel des boutons d'action (mode « Texte + icônes ») */
.tbar-label { display: none; }
body.toolbar-text .tbar-icon-btn {
    width: auto;
    padding: 0 0.85rem;
    gap: 0.4rem;
    font-size: 1.05rem;
}
body.toolbar-text .tbar-label {
    display: inline;
    font-size: 0.85rem;
    font-weight: 600;
}
/* En mode texte, l'infobulle est redondante */
body.toolbar-text .tbar-icon-btn.tip::after { display: none; }

/* --- Onglets du modal profil --- */
.pm-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.4rem;
}
.pm-tab {
    background: none;
    border: none;
    padding: 0.6rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.pm-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.pm-pane { display: none; }
.pm-pane.active { display: block; }

.pm-choice {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    margin-bottom: 0.7rem;
    transition: border-color 0.15s, background 0.15s;
}
.pm-choice:hover { border-color: rgba(37, 83, 135, 0.4); }
.pm-choice.active {
    border-color: var(--primary);
    background: rgba(37, 83, 135, 0.04);
}
.pm-choice i.pm-choice-icon { font-size: 1.5rem; color: var(--primary); }
.pm-choice-text { flex: 1; }
.pm-choice-text strong { display: block; font-size: 0.9rem; color: var(--text-main); }
.pm-choice-text span { font-size: 0.78rem; color: var(--text-muted); }
.pm-choice i.pm-choice-check { font-size: 1.2rem; color: var(--primary); opacity: 0; }
.pm-choice.active i.pm-choice-check { opacity: 1; }
