/**
 * @file topbar.css
 * @description Barra de navegação superior do Superchart.
 *
 * Contém:
 *  - .topbar (container sticky)
 *  - .brand, .brand-title, .brand-meta (logotipo e metadados)
 *  - .controls, .controls-primary, .controls-menu (controles de timeframe etc.)
 *  - .leftbar e .toolbtn (barra lateral esquerda de ferramentas)
 *  - .select (dropdown de seleção)
 *  - .user-profile, .user-avatar, .user-dropdown (perfil do usuário logado)
 *  - .social-group, .social-badge (botões de redes sociais)
 *  - .pill (tags de informação)
 *  - #mobileMenuBtn (botão de menu em dispositivos móveis)
 *
 * Depende de: variables.css
 */

/* ── Topbar ─────────────────────────────────────────────── */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 6px;
    border-bottom: 1px solid var(--panel-border);
    background: var(--topbar-bg);
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(10px);
}

/* ── Brand ──────────────────────────────────────────────── */

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
}

.brand-title {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-title strong {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.brand-title span {
    font-size: 11px;
    color: var(--muted);
}

.brand-meta {
    margin-top: 3px;
    font-size: 11px;
    color: var(--muted);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.brand-meta .dot {
    opacity: 0.55;
}

.pill {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    color: var(--muted);
    font-size: 11px;
}

/* ── Controles ──────────────────────────────────────────── */

.controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    position: relative;
}

.controls-primary {
    display: flex;
    align-items: center;
    gap: 8px;
}

.controls-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.controls-menu .menu-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.controls-menu .menu-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.controls-menu .menu-divider {
    display: none;
}

#mobileMenuBtn {
    display: none;
    width: 40px;
    justify-content: center;
}

.select {
    border: 1px solid var(--panel-border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
}

/* ── Leftbar ────────────────────────────────────────────── */

.leftbar {
    width: 56px;
    height: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: var(--leftbar-bg);
    box-shadow: var(--shadow);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leftbar .spacer {
    flex: 1 1 auto;
}

.toolbtn {
    appearance: none;
    border: 1px solid var(--panel-border);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
    display: grid;
    place-items: center;
    user-select: none;
}

.toolbtn:hover {
    transform: translateY(-1px);
    border-color: rgba(98, 169, 255, 0.35);
    background: var(--surface-hover);
}

.toolbtn:active { transform: translateY(0px); }

.toolbtn.active {
    outline: 2px solid rgba(98, 169, 255, 0.35);
    border-color: rgba(98, 169, 255, 0.55);
}

.toolbtn.danger {
    border-color: rgba(255, 92, 122, 0.30);
    background: rgba(255, 92, 122, 0.06);
}

.toolbtn.danger:hover {
    border-color: rgba(255, 92, 122, 0.45);
    background: rgba(255, 92, 122, 0.10);
}

.toolbtn svg {
    width: 18px;
    height: 18px;
    opacity: 0.9;
}

/* ── Perfil do usuário ──────────────────────────────────── */

.user-profile {
    display: none; /* exibido via JS quando logado */
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--nav-user-bg);
    border: 1px solid var(--panel-border);
    cursor: pointer;
    transition: all 150ms ease;
    position: relative;
}

.user-profile:hover {
    background: var(--nav-user-hover);
    border-color: var(--accent);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #000;
    text-transform: uppercase;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.user-badge.premium { color: #facc15; }
.user-badge.free { color: var(--muted); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 180px;
    background: var(--popover-bg);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    display: none;
    flex-direction: column;
    padding: 6px;
    z-index: 1001;
}

.user-profile.active .user-dropdown {
    display: flex;
}

.user-dropdown-item {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 120ms ease;
}

.user-dropdown-item:hover {
    background: rgba(255,255,255,0.05);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--panel-border);
    margin: 4px 6px;
}

.user-dropdown-item.danger:hover {
    background: rgba(255, 92, 122, 0.12);
    color: var(--danger);
}

/* ── Social badges ──────────────────────────────────────── */

.social-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 2px;
}

.social-badge {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    color: var(--muted);
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.social-badge:hover {
    transform: translateY(-1px);
    border-color: rgba(98, 169, 255, 0.35);
    background: var(--surface-hover);
    color: var(--text);
}

.social-badge svg {
    width: 18px;
    height: 18px;
}

/* Pequena redução para equilíbrio visual */
#telegram-badge svg,
#twitter-badge svg {
    transform: scale(0.9);
    transform-origin: 50% 50%;
}
