/* ===================================================
   Topbar / menu principal (header.php)
   =================================================== */

/* Base: considere como tema claro por padrão */
.sg-topbar {
    background: #ffffff;
    color: #111827;
    padding: .45rem 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid #e5e7eb;
}

.sg-topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 .75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.sg-topbar-left,
.sg-topbar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* logo do topo */

.sg-logo-link {
    display: flex;
    align-items: center;
    gap: .4rem;
    text-decoration: none;
    color: inherit;
}

.sg-logo-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: .5rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.sg-logo-text {
    font-weight: 600;
    font-size: .9rem;
}

/* navegação central */

.sg-topbar-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.sg-nav-link {
    color: #111827;
    text-decoration: none;
    font-size: .85rem;
    padding: .3rem .7rem;
    border-radius: .5rem;
    border: 1px solid transparent;
    font-weight: 500;
}

.sg-nav-link:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
    text-decoration: none;
}

.sg-nav-logout {
    border-color: #f97373;
}

.sg-nav-logout:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #f9fafb;
}

/* usuário no topo */

.sg-user {
    font-size: .8rem;
    color: #6b7280;
}

/* botão de tema no topo */

.theme-toggle-btn {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #111827;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin-right: .25rem;
}

.theme-toggle-btn:hover {
    background: #e5e7eb;
}

/* ===================================================
   Versão em tema escuro (data-theme="dark")
   =================================================== */

[data-theme="dark"] .sg-topbar {
    background: #020617;
    color: #e5e7eb;
    border-bottom: 1px solid #1f2937;
}

[data-theme="dark"] .sg-logo-img {
    background: #020617;
    border-color: #1f2937;
}

[data-theme="dark"] .sg-nav-link {
    color: #e5e7eb;
}

[data-theme="dark"] .sg-nav-link:hover {
    background: #111827;
    border-color: #334155;
}

[data-theme="dark"] .sg-user {
    color: #cbd5f5;
}

[data-theme="dark"] .theme-toggle-btn {
    border-color: #4b5563;
    background: transparent;
    color: #e5e7eb;
}

[data-theme="dark"] .theme-toggle-btn:hover {
    background: #111827;
}

/* ===================================================
   Responsivo
   =================================================== */

@media (max-width: 768px) {
    .sg-topbar-inner {
        flex-wrap: wrap;
        justify-content: center;
    }

    .sg-topbar-left {
        width: 100%;
        justify-content: center;
        margin-bottom: .2rem;
    }

    .sg-topbar-right {
        width: 100%;
        justify-content: center;
        margin-top: .2rem;
    }
}
