/* ============================================================================
   LogiFlotte — barre supérieure (titre de page + actions rapides).
   HTML : app/Views/partials/topbar.php
   ============================================================================ */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-6);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    min-height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
    min-width: 0;
}

/* Bouton hamburger — masqué sur desktop, visible sur mobile */
.topbar-menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}
.topbar-menu:hover {
    background: var(--color-bg);
    color: var(--color-primary);
}
.topbar-menu:active { transform: scale(0.96); }
.topbar-menu svg { width: 22px; height: 22px; }

.topbar-title .page-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* -- Actions à droite du titre (notifs, société, user) -- */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.topbar-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.topbar-btn:hover {
    background: var(--color-bg);
    color: var(--color-primary);
    text-decoration: none;
}
.topbar-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Petit pastille de notification */
.topbar-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}
.topbar-badge--danger { background: var(--color-danger); }

/* Société courante (impersonation super-admin) */
.topbar-company {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius);
    background: var(--color-warning-light);
    color: #7c4a0b;
    font-size: var(--font-size-sm);
    font-weight: 600;
    border: 1px solid #fcd34d;
}

/* Utilisateur courant */
.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-text);
    transition: background var(--transition);
}
.topbar-user:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.topbar-user-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
}

@media (max-width: 768px) {
    .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        padding: var(--space-3) var(--space-3);
        gap: var(--space-2);
    }
    .topbar-menu { display: inline-flex; }
    .topbar-user-name { display: none; }
    .topbar-company { display: none; }
    .topbar-title .page-title { font-size: var(--font-size-md); }
    .topbar-actions { gap: var(--space-1); }
}
