/* ──────────────────────────────────────────────────────────────────────
   Topbar de la Oficina Virtual.
   Global porque convive con OvNotificationBell que renderiza fuera
   del scope (popover, backdrop). Mantiene una superficie clara con
   blur tipo "frosted glass".
   ────────────────────────────────────────────────────────────────────── */

.ov-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: var(--ov-topbar-height);
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid rgba(216, 225, 234, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: var(--ov-z-topbar);
}

.ov-topbar__left { flex: 1; min-width: 0; }

.ov-topbar__search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: 40px;
    width: 100%;
    max-width: 460px;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: var(--ov-radius-md);
    color: var(--ov-ink-400);
    transition: background var(--ov-transition), border-color var(--ov-transition), box-shadow var(--ov-transition);
}

.ov-topbar__search:focus-within {
    background: white;
    border-color: var(--ov-brand-300);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.ov-topbar__search { position: relative; }
.ov-topbar__search.is-open { background: white; border-color: var(--ov-brand-300); }

/* Dropdown de resultados del buscador global */
.ov-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 60vh;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--ov-border);
    border-radius: var(--ov-radius-md);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    z-index: calc(var(--ov-z-topbar) + 5);
    padding: 6px 0;
}

.ov-search-dropdown__hint {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--ov-ink-500);
}

.ov-search-dropdown__section + .ov-search-dropdown__section {
    border-top: 1px solid var(--ov-border);
    margin-top: 4px;
    padding-top: 4px;
}

.ov-search-dropdown__label {
    padding: 6px 16px 4px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ov-ink-400);
}

.ov-search-dropdown__item {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    transition: background var(--ov-transition);
}

.ov-search-dropdown__item:hover,
.ov-search-dropdown__item:focus-visible {
    background: #f1f5f9;
    outline: none;
}

.ov-search-dropdown__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ov-ink-900);
}

.ov-search-dropdown__meta {
    font-size: 12px;
    color: var(--ov-ink-500);
    margin-top: 2px;
}

.ov-topbar__search input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--ov-font);
    font-size: 13.5px;
    color: var(--ov-ink-700);
    outline: none;
    min-width: 0;
}

.ov-topbar__search input::placeholder { color: var(--ov-ink-400); }

.ov-topbar__kbd {
    font-family: var(--ov-font-mono);
    font-size: 11px;
    background: white;
    border: 1px solid var(--ov-border);
    padding: 2px 7px;
    border-radius: 5px;
    color: var(--ov-ink-500);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.ov-topbar__right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ov-topbar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 14px 5px 5px;
    border-radius: var(--ov-radius-pill);
    cursor: pointer;
    transition: background var(--ov-transition);
    border: 1px solid transparent;
}

.ov-topbar__user:hover {
    background: white;
    border-color: var(--ov-ink-200);
}

.ov-topbar__user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ov-brand-500), var(--ov-brand-700));
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.28);
}

.ov-topbar__user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.ov-topbar__user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ov-ink-900);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.ov-topbar__user-role {
    font-size: 11px;
    color: var(--ov-ink-500);
    font-weight: 500;
}

@media (max-width: 768px) {
    /* padding-left: 60px hace lugar a la hamburguesa fija en top:14 left:12 (40x40).
       Antes era padding:0 16px y el botón tapaba el inicio del buscador. */
    .ov-topbar {
        padding: 0 12px 0 60px;
        gap: 8px;
    }
    .ov-topbar__search { max-width: 100%; height: 38px; padding: 0 10px; }
    .ov-topbar__search input::placeholder { font-size: 12px; }
    .ov-topbar__kbd { display: none; }
    .ov-topbar__user-meta { display: none; }
    .ov-topbar__right { gap: 6px; }
    .ov-topbar__user { padding: 4px; gap: 0; }
    /* En pantallas muy chicas el buscador empuja todo. Se oculta el placeholder
       largo y se reduce el avatar para que entre la campana + user en la fila. */
}

@media (max-width: 480px) {
    .ov-topbar__search input {
        font-size: 13px;
    }
    .ov-topbar__search svg { width: 14px; height: 14px; }
    .ov-topbar__user-avatar { width: 32px; height: 32px; font-size: 13px; }
    /* En mobile chico el dropdown del search ocupa todo el ancho disponible
       — sin esto se desbordaba a la izquierda del icono del search. */
    .ov-search-dropdown {
        left: -52px;
        right: -8px;
        max-height: 70vh;
    }
}
