/* ==========================================================================
   Interface authentifiée : sidebar + topbar
   ========================================================================== */

/*
 * .admin-wrapper gère lui-même son scroll interne (.main-content) sur toute
 * la hauteur de la fenêtre. Sans ça, le <body> (hauteur 100% mais sans
 * overflow défini) peut déborder de quelques pixels et récupère sa propre
 * scrollbar de page, quasi invisible et qui ne bouge presque pas : on a alors
 * deux scrollbars indépendantes ("une page dans une page"), la molette
 * suivant .main-content mais la barre latérale du navigateur suivant le body.
 * Ciblé via :has() pour ne pas impacter les pages sans ce shell (ex: login),
 * qui doivent pouvoir scroller normalement si leur contenu dépasse l'écran.
 */
body:has(> .admin-wrapper) {
    overflow: hidden;
}

.admin-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 270px;
    background-color: var(--agence-sidebar);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.main-content {
    flex-grow: 1;
    overflow-y: auto;
    background-color: var(--bg-light);
}

.sidebar-brand {
    padding: 20px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand img {
    max-width: 170px;
    height: auto;
}

.sidebar-section {
    padding: 15px 20px 5px 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #565674;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.sidebar-menu li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 22px;
    font-size: 0.88rem;
    color: #A2A3B7;
    text-decoration: none;
    transition: all 0.25s ease;
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
    border-left-color: var(--agence-pink);
}

.sidebar-menu li a i.menu-icon {
    margin-right: 12px;
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
}

.topbar {
    background: #fff;
    height: 65px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    border-bottom: 1px solid #E4E6EF;
}

.page-content {
    padding: 30px;
}

.page-content > .bg-white.border-bottom:first-child {
    margin: -30px -30px 0 -30px;
}

.icon-picker-trigger {
    padding: 0;
    cursor: pointer;
}

.icon-picker-trigger:hover {
    border-color: var(--agence-pink);
}

.icon-picker-menu {
    width: 224px;
}

.icon-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.icon-picker-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #E4E6EF;
    background-color: #fff;
    color: var(--text-main, #3F4254);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.icon-picker-btn:hover {
    border-color: var(--agence-pink);
    background-color: var(--bg-light, #F4F6F9);
}

.icon-picker-btn.active {
    border-color: var(--agence-pink);
    background-color: var(--agence-pink);
    color: #fff;
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 380px;
    max-height: 420px;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #E4E6EF;
    z-index: 1050;
    padding: 8px 0;
}

.search-results-empty {
    padding: 14px 18px;
    color: #A2A3B7;
    font-size: 0.85rem;
}

.search-results-section {
    padding: 8px 18px 4px 18px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #A2A3B7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-results-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 18px;
    text-decoration: none;
    color: var(--text-main, #3F4254);
}

.search-results-item:hover {
    background-color: var(--bg-light, #F4F6F9);
}

.search-results-item i {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.search-results-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-results-item-label {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-results-item-meta {
    font-size: 0.75rem;
    color: #A2A3B7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Met en évidence la ligne/élément visé par un lien de résultat de recherche (ex: #user-row-12) */
:target {
    animation: search-target-highlight 2s ease-out;
}

@keyframes search-target-highlight {
    from { background-color: rgba(247, 68, 101, 0.18); }
    to { background-color: transparent; }
}

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.03);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px dashed #E4E6EF;
    padding: 18px 25px;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--agence-dark);
}

.select-inline {
    width: auto;
}
