/* ══════════════════════════════════════════════════════════════
   PRESENCE WIDGET — Navbar Online Indicator
   Estilo Capacitar: Sutil, premium, glassmorphism
   ══════════════════════════════════════════════════════════════ */

/* ── Botão principal ─────────────────────────────────────── */
.presence-widget {
    position: relative;
    display: flex;
    align-items: center;
}

.presence-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 100px;
    padding: 6px 12px 6px 8px;
    cursor: pointer;
    color: var(--text-main, #1a1a2e);
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1;
}

.presence-btn:hover {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.presence-btn i {
    font-size: 0.8rem;
    color: #10b981;
}

.presence-count {
    font-size: 0.78rem;
    font-weight: 700;
    color: #10b981;
    min-width: 14px;
    text-align: center;
}

/* ── Pulse animado (ponto verde pulsando) ─────────────────── */
.presence-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    position: relative;
    flex-shrink: 0;
}

.presence-pulse-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: #10b981;
    opacity: 0.35;
    animation: presencePulse 2s ease-in-out infinite;
}

@keyframes presencePulse {
    0%, 100% { transform: scale(1); opacity: 0.35; }
    50%       { transform: scale(1.8); opacity: 0; }
}

/* ── Dropdown ────────────────────────────────────────────── */
.presence-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 310px;
    background: var(--card-bg, #ffffff);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.14), 0 4px 16px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.07);
    z-index: 3000;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.presence-dropdown.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header do dropdown ──────────────────────────────────── */
.presence-dh {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.presence-dh-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main, #1a1a2e);
}

.presence-dh-title i {
    color: #10b981;
    font-size: 0.72rem;
}

.presence-dh-time {
    font-size: 0.7rem;
    color: var(--text-secondary, #6b7280);
}

/* ── Abas ────────────────────────────────────────────────── */
.presence-tabs {
    display: flex;
    padding: 8px 12px;
    gap: 4px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background: rgba(0,0,0,0.015);
}

.ptab {
    flex: 1;
    padding: 5px 8px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    transition: all 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.ptab:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-main, #1a1a2e);
}

.ptab.active {
    background: #10b981;
    color: white;
}

.ptab.active.amber { background: #f59e0b; }
.ptab.active.gray  { background: #94a3b8; }

.ptab-count {
    background: rgba(255,255,255,0.25);
    border-radius: 100px;
    padding: 0px 5px;
    font-size: 0.65rem;
    line-height: 1.4;
}

/* ── Lista de usuários ──────────────────────────────────── */
.presence-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.1) transparent;
}

.presence-list::-webkit-scrollbar {
    width: 4px;
}
.presence-list::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.presence-empty {
    text-align: center;
    padding: 20px 10px;
    color: var(--text-secondary, #6b7280);
    font-size: 0.78rem;
}

.presence-empty i {
    font-size: 1.5rem;
    margin-bottom: 6px;
    opacity: 0.4;
    display: block;
}

/* ── Item de usuário ────────────────────────────────────── */
.presence-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 10px;
    cursor: default;
    transition: background 0.15s;
}

.presence-user-item:hover {
    background: rgba(0,0,0,0.04);
}

.presence-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.presence-avatar-wrap img,
.presence-avatar-wrap .presence-avatar-initials {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}

.presence-avatar-wrap .presence-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0D8ABC, #10b981);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Status dot no canto do avatar */
.presence-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--card-bg, #ffffff);
}
.presence-status-dot.online  { background: #10b981; }
.presence-status-dot.recente { background: #f59e0b; }
.presence-status-dot.offline { background: #94a3b8; }

.presence-user-info {
    flex: 1;
    min-width: 0;
}

.presence-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main, #1a1a2e);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.presence-user-sub {
    font-size: 0.68rem;
    color: var(--text-secondary, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.presence-time-badge {
    flex-shrink: 0;
    font-size: 0.63rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 100px;
    white-space: nowrap;
}
.presence-time-badge.online  { background: rgba(16,185,129,0.1);  color: #059669; }
.presence-time-badge.recente { background: rgba(245,158,11,0.1);  color: #d97706; }
.presence-time-badge.offline { background: rgba(148,163,184,0.1); color: #64748b; }

/* ── Rodapé do dropdown ─────────────────────────────────── */
.presence-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.presence-footer-stat {
    font-size: 0.7rem;
    color: var(--text-secondary, #6b7280);
}

.presence-footer-stat strong {
    color: #10b981;
    font-weight: 700;
}

.presence-refresh-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: inherit;
    font-weight: 500;
}

.presence-refresh-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-main, #1a1a2e);
}

.presence-refresh-btn i {
    transition: transform 0.4s ease;
}

.presence-refresh-btn.spinning i {
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Modo escuro ────────────────────────────────────────── */
[data-theme="dark"] .presence-btn {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: #e2e8f0;
}

[data-theme="dark"] .presence-dropdown {
    background: #1e2235;
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

[data-theme="dark"] .presence-tabs {
    background: rgba(255,255,255,0.03);
}

[data-theme="dark"] .presence-user-item:hover {
    background: rgba(255,255,255,0.05);
}

[data-theme="dark"] .presence-status-dot {
    border-color: #1e2235;
}

/* ── Responsivo ────────────────────────────────────────── */
@media (max-width: 768px) {
    .presence-btn span.presence-count {
        display: none;
    }
    .presence-btn {
        padding: 6px 8px;
    }
    .presence-dropdown {
        width: 280px;
        right: -50px;
    }
}

/* ══════════════ CLUSTER DE AVATARES NA NAVBAR ════════════════ */
.nav-online-cluster {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}
.nav-online-cluster:hover .noc-avatars { transform: translateX(-2px); }

.noc-avatars {
    display: flex;
    transition: transform .2s;
}
.noc-av {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid var(--navbar-bg, #fff);
    object-fit: cover;
    margin-left: -8px;
    transition: transform .2s, z-index 0s;
    position: relative;
    background: #0D8ABC;
    display: flex; align-items: center; justify-content: center;
    font-size: .62rem; font-weight: 700; color: white;
    overflow: hidden;
}
.noc-av:first-child { margin-left: 0; }
.noc-av:hover { transform: translateY(-3px) scale(1.1); z-index: 10; }

.noc-badge {
    min-width: 22px; height: 22px;
    background: linear-gradient(135deg, #10b981, #0D8ABC);
    color: white; border-radius: 100px;
    font-size: .65rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    margin-left: 2px;
    padding: 0 5px;
    border: 2px solid var(--navbar-bg, #fff);
}

.noc-pulse {
    width: 7px; height: 7px; border-radius: 50%;
    background: #10b981; margin-left: 6px; flex-shrink: 0;
    animation: nocPulse 2s infinite;
}
@keyframes nocPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
    50%       { box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}

/* Tooltip do cluster */
.noc-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--card-bg, #fff);
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 14px;
    padding: .6rem .8rem;
    box-shadow: 0 8px 30px rgba(0,0,0,.18);
    min-width: 180px;
    display: none;
    z-index: 200;
    animation: nocFadeIn .15s ease;
}
[data-theme="dark"] .noc-tooltip { border-color: rgba(255,255,255,.1); background: #1e2235; }
.nav-online-cluster:hover .noc-tooltip { display: block; }
@keyframes nocFadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

.noc-tooltip-title {
    font-size: .68rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-secondary); margin-bottom: .5rem;
}
.noc-tooltip-user {
    display: flex; align-items: center; gap: .5rem;
    padding: .3rem 0; font-size: .78rem; color: var(--text-main);
}
.noc-tooltip-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.noc-tooltip-dot.online  { background: #10b981; }
.noc-tooltip-dot.recente { background: #f59e0b; }
.noc-tooltip-dot.offline { background: #94a3b8; }
.noc-tooltip-more {
    font-size: .72rem; color: #0D8ABC; font-weight: 700;
    margin-top: .3rem; text-align: center;
    cursor: pointer;
}

/* ══════════════ NEWS TICKER NA NAVBAR ════════════════════════ */
.news-ticker-bar {
    background: linear-gradient(90deg, #0D8ABC 0%, #302b63 100%);
    color: white;
    height: 32px;
    display: flex;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}
.news-ticker-label {
    background: rgba(0,0,0,.25);
    padding: 0 12px;
    height: 100%;
    display: flex; align-items: center;
    font-size: .68rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .5px;
    white-space: nowrap;
    flex-shrink: 0;
    gap: 5px;
}
.news-ticker-label i { font-size: .7rem; animation: tickerPulse 1.5s infinite; }
@keyframes tickerPulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.news-ticker-track {
    flex: 1; overflow: hidden;
    position: relative;
}
.news-ticker-inner {
    display: flex;
    white-space: nowrap;
    animation: tickerScroll 35s linear infinite;
    font-size: .75rem;
    gap: 0;
}
.news-ticker-inner:hover { animation-play-state: paused; }
@keyframes tickerScroll {
    from { transform: translateX(100%); }
    to   { transform: translateX(-100%); }
}
.news-ticker-item {
    padding: 0 2rem;
    display: inline-flex; align-items: center; gap: .5rem;
    opacity: .92;
}
.news-ticker-item::before {
    content: '●'; font-size: .4rem; opacity: .6;
}

