/*
 * Barra de cima do sistema (core/Cabecalho.php, HeaderHelper e views/partials/header_*.php).
 * Carregado no <head> por Cabecalho::head() (via menu_hamburger_styles.php).
 *  1. Barra compacta (todas as telas): ☰ dentro da barra, 56 px, título + caminho numa linha só.
 *  2. Abas do módulo fora do bloco fixo (.fh-cab-abas): rolam com a página.
 *  3. Tema escuro: só com html[data-dpv-tema="escuro"] (só telas com botão de tema marcam o atributo).
 *     O "body" no seletor ganha da regra que deixa o cabeçalho branco (html[data-dpv-tema] header.sticky.top-0).
 */

/* ---------- 1. Barra compacta ---------- */
header.fh-cab {
    background-color: #ffffff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}
header.fh-cab .fh-cab-linha {
    height: 56px !important;
    gap: 0.75rem;
}
header.fh-cab .fh-cab-linha > div:first-child {
    min-width: 0;
    gap: 0.75rem;
}
header.fh-cab .fh-cab-linha > div:first-child > * + * { margin-left: 0 !important; }
header.fh-cab img[src*="logo-fabri"] { height: 30px !important; width: auto; }
header.fh-cab .h-8.w-px,
header.fh-cab .h-6.w-px { height: 24px !important; }
header.fh-cab h1 {
    font-size: 0.95rem !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    margin: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
}
/* A descrição embaixo do título dá lugar ao caminho */
header.fh-cab h1 + p { display: none !important; }
header.fh-cab .fh-cab-titulo { min-width: 0; }

.fh-cab-menu {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.fh-cab-menu:hover { background: #f1f5f9; border-color: #cbd5e1; }
.fh-cab-menu:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
/* O botão fixo antigo do menu fica escondido quando a página tem a barra nova */
body:has(header.fh-cab) .hamburger-menu { display: none !important; }

.fh-cab-trilha {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    line-height: 1.3;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
}
.fh-cab-trilha a { color: #2563eb; font-weight: 500; text-decoration: none; }
.fh-cab-trilha a:hover { text-decoration: underline; }
.fh-cab-sep-trilha { color: #cbd5e1; }

/* Foto/inicial do usuário menores */
header.fh-cab button img.rounded-full,
header.fh-cab button > div.rounded-full {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.9rem !important;
}

@media (max-width: 640px) {
    header.fh-cab .fh-cab-linha { height: 52px !important; gap: 0.5rem; }
    header.fh-cab .fh-cab-linha > div:first-child { gap: 0.5rem; }
    header.fh-cab img[src*="logo-fabri"] { height: 26px !important; }
    .fh-cab-trilha { display: none; }
}

/* ---------- 2. Abas do módulo (fora do bloco fixo) ---------- */
.fh-cab-abas {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}
.fh-cab-abas > .border-t:first-child { border-top: 0 !important; }

/* ---------- 3. Tema escuro ---------- */
html[data-dpv-tema="escuro"] body { background-color: #181c30; }
html[data-dpv-tema="escuro"] body .fh-cab-abas {
    background-color: #12162a;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
html[data-dpv-tema="escuro"] body .fh-cab-menu {
    background: #1e2438;
    border-color: rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
}
html[data-dpv-tema="escuro"] body .fh-cab-menu:hover { background: #262d45; border-color: rgba(255, 255, 255, 0.22); }
html[data-dpv-tema="escuro"] body .fh-cab-trilha { color: #94a3b8; }
html[data-dpv-tema="escuro"] body .fh-cab-trilha a { color: #93c5fd; }
html[data-dpv-tema="escuro"] body .fh-cab-sep-trilha { color: #475569; }

html[data-dpv-tema="escuro"] body header.sticky.top-0 {
    background-color: #12162a !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35) !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* Textos */
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-gray-900,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-gray-800 { color: #f8fafc !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-gray-700 { color: #e2e8f0 !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-gray-600,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-gray-500 { color: #94a3b8 !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-gray-400,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-gray-300 { color: #64748b !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:text-gray-600:hover,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:text-gray-700:hover,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:text-gray-800:hover { color: #f1f5f9 !important; }

/* "FabriHub" em degradê: tons mais claros para ler no fundo escuro */
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .bg-clip-text.from-indigo-600 {
    background-image: linear-gradient(to right, #a5b4fc, #d8b4fe) !important;
}

/* Divisórias, bordas e fundos claros */
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .border-gray-100,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .border-gray-200,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .border-gray-300 { border-color: rgba(255, 255, 255, 0.08) !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:border-gray-300:hover { border-color: rgba(255, 255, 255, 0.22) !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .bg-gray-200 { background-color: rgba(255, 255, 255, 0.12) !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .bg-gray-50,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .bg-gray-100 { background-color: rgba(255, 255, 255, 0.06) !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:bg-gray-50:hover,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:bg-gray-100:hover,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:bg-gray-200:hover { background-color: rgba(255, 255, 255, 0.07) !important; }

/* Menus que abrem (usuário, sininho, menu do celular) */
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .bg-white,
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .card,
html[data-dpv-tema="escuro"] body header.sticky.top-0 #dropdown-modal-notificacoes {
    background-color: #111827 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0;
}
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .shadow-lg { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55) !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .ring-black { --tw-ring-color: rgba(255, 255, 255, 0.1) !important; }
html[data-dpv-tema="escuro"] body header.sticky.top-0 img.border-white { border-color: rgba(255, 255, 255, 0.18) !important; }

/* Cores de ação */
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .bg-green-50 { background-color: rgba(74, 222, 128, 0.12) !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:bg-green-100:hover { background-color: rgba(74, 222, 128, 0.2) !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-green-600 { color: #4ade80 !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-red-600 { color: #f87171 !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:bg-red-50:hover { background-color: rgba(248, 113, 113, 0.12) !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .hover\:text-red-700:hover { color: #fca5a5 !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-blue-600 { color: #60a5fa !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .bg-blue-50 { background-color: rgba(96, 165, 250, 0.12) !important; }
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .text-orange-600 { color: #fb923c !important; }

/* Setas das abas do módulo */
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .module-nav-arrow {
    background: #1e2438;
    border-color: rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    box-shadow: none;
}
html[data-dpv-tema="escuro"] body :is(header.sticky.top-0, .fh-cab-abas) .module-nav-arrow:hover:not(:disabled):not(.is-disabled) {
    background: #262d45;
    color: #f1f5f9;
}

/* Breadcrumb logo abaixo do cabeçalho */
html[data-dpv-tema="escuro"] body nav.fabri-breadcrumb {
    background-color: #181c30 !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}
html[data-dpv-tema="escuro"] body nav.fabri-breadcrumb .text-gray-600 { color: #94a3b8 !important; }
html[data-dpv-tema="escuro"] body nav.fabri-breadcrumb .text-gray-900 { color: #f1f5f9 !important; }
html[data-dpv-tema="escuro"] body nav.fabri-breadcrumb .text-gray-300 { color: #475569 !important; }
html[data-dpv-tema="escuro"] body nav.fabri-breadcrumb .text-blue-600 { color: #93c5fd !important; }
html[data-dpv-tema="escuro"] body nav.fabri-breadcrumb .hover\:text-blue-800:hover { color: #bfdbfe !important; }

/* Botão do menu hambúrguer (fica fixo sobre o canto do cabeçalho) */
html[data-dpv-tema="escuro"] body .hamburger-btn {
    background: #1e2438;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
html[data-dpv-tema="escuro"] body .hamburger-btn:hover {
    background: #262d45;
    border-color: rgba(255, 255, 255, 0.22);
}
html[data-dpv-tema="escuro"] body .hamburger-btn .hamburger-icon { color: #cbd5e1; }

/* Painel do menu hambúrguer (menu_hamburger.css e menu_hamburger_loja.css) */
html[data-dpv-tema="escuro"] body .sidebar {
    background: #12162a;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.5);
    scrollbar-color: #334155 transparent;
}
html[data-dpv-tema="escuro"] body .sidebar::-webkit-scrollbar-track { background: transparent; }
html[data-dpv-tema="escuro"] body .sidebar::-webkit-scrollbar-thumb { background: #334155; }
html[data-dpv-tema="escuro"] body .sidebar-header {
    background: #161b30;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
html[data-dpv-tema="escuro"] body .sidebar-title { color: #f1f5f9; }
html[data-dpv-tema="escuro"] body .sidebar-subtitle { color: #94a3b8; }
html[data-dpv-tema="escuro"] body .sidebar .close-btn {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.12);
    color: #94a3b8;
}
html[data-dpv-tema="escuro"] body .sidebar .close-btn:hover { background: rgba(255, 255, 255, 0.07); color: #f1f5f9; }

html[data-dpv-tema="escuro"] body .sidebar-search-input-row { background: #0f1424; border-color: rgba(255, 255, 255, 0.12); }
html[data-dpv-tema="escuro"] body .sidebar-search-input-row:focus-within { border-color: #818cf8; }
html[data-dpv-tema="escuro"] body .sidebar-search-input { color: #e2e8f0; }
html[data-dpv-tema="escuro"] body .sidebar-search-input::placeholder { color: #64748b; }
html[data-dpv-tema="escuro"] body .sidebar-search-icon-wrap,
html[data-dpv-tema="escuro"] body .sidebar-menu-search-empty { color: #94a3b8; }

html[data-dpv-tema="escuro"] body .sidebar .menu-item,
html[data-dpv-tema="escuro"] body .sidebar .menu-section.favoritos-section .menu-item { color: #cbd5e1 !important; }
html[data-dpv-tema="escuro"] body .sidebar .menu-item:hover,
html[data-dpv-tema="escuro"] body .sidebar .menu-section.favoritos-section .menu-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-left-color: #94a3b8 !important;
    color: #f8fafc !important;
}
html[data-dpv-tema="escuro"] body .sidebar .submenu-item,
html[data-dpv-tema="escuro"] body .sidebar .menu-section.favoritos-section .submenu-item,
html[data-dpv-tema="escuro"] body .sidebar .menu-section.favoritos-section .submenu-item i { color: #94a3b8 !important; }
html[data-dpv-tema="escuro"] body .sidebar .submenu-item:hover,
html[data-dpv-tema="escuro"] body .sidebar .menu-section.favoritos-section .submenu-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-left-color: #64748b !important;
    color: #e2e8f0 !important;
}
html[data-dpv-tema="escuro"] body .sidebar .submenu-group {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}
html[data-dpv-tema="escuro"] body .sidebar .submenu-group-title { color: #cbd5e1; }
html[data-dpv-tema="escuro"] body .sidebar .submenu-group-title i { color: #60a5fa; }
html[data-dpv-tema="escuro"] body .sidebar .submenu-group .submenu-item-text { color: #cbd5e1; }
html[data-dpv-tema="escuro"] body .sidebar .submenu-group .submenu-item-text i { color: #64748b; }
html[data-dpv-tema="escuro"] body .sidebar .submenu-group .submenu-item:hover { background: rgba(96, 165, 250, 0.08); }
html[data-dpv-tema="escuro"] body .sidebar .submenu-group .submenu-item:hover .submenu-item-text { color: #f8fafc; }
html[data-dpv-tema="escuro"] body .sidebar .submenu-group .submenu-item:hover .submenu-item-text i { color: #60a5fa; }
html[data-dpv-tema="escuro"] body .sidebar .menu-item-toggle::after { color: #64748b; }

/* Só no menu da loja */
html[data-dpv-tema="escuro"] body #sidebarLoja { border-right-color: rgba(251, 146, 60, 0.25); }
html[data-dpv-tema="escuro"] body #sidebarLoja .sidebar-header { border-bottom-color: rgba(251, 146, 60, 0.25); }
html[data-dpv-tema="escuro"] body #sidebarLoja .sidebar-title { color: #fdba74; }
html[data-dpv-tema="escuro"] body #sidebarLoja .menu-item:hover {
    background: linear-gradient(90deg, rgba(251, 146, 60, 0.1) 0%, transparent 100%) !important;
    border-left-color: #fb923c !important;
}
html[data-dpv-tema="escuro"] body #sidebarLoja .menu-item-danger:hover { background: rgba(248, 113, 113, 0.12) !important; }
html[data-dpv-tema="escuro"] body #sidebarLoja .menu-section-title { color: #64748b; border-bottom-color: rgba(255, 255, 255, 0.06); }
html[data-dpv-tema="escuro"] body #sidebarLoja .menu-divider { background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.12), transparent); }
html[data-dpv-tema="escuro"] body #sidebarLoja .sidebar-footer { background: transparent; border-top-color: rgba(255, 255, 255, 0.08); }
html[data-dpv-tema="escuro"] body #sidebarLoja .sidebar-footer .text-gray-400 { color: #64748b; }
html[data-dpv-tema="escuro"] body #sidebarLoja .sidebar-footer .text-gray-500 { color: #94a3b8; }
html[data-dpv-tema="escuro"] body .sidebar-menu-carregando { color: #94a3b8; }
html[data-dpv-tema="escuro"] body .sidebar-menu-tentar { background: #1e2438; border-color: rgba(255, 255, 255, 0.12); color: #e2e8f0; }

/* Página sem menu lateral (ex.: chamados da loja): sem botão ☰ */
body:not(:has(#sidebar, #sidebarLoja)) .fh-cab-menu { display: none; }
html[data-dpv-tema="escuro"] body .fav-grupo-titulo { color: #64748b; }
html[data-dpv-tema="escuro"] body .fav-grupo-titulo:hover { color: #cbd5e1; }
html[data-dpv-tema="escuro"] body .fav-grupo-titulo small { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }
