/* /public/css/style.css */

/* --- IDENTIDADE VISUAL METROBRAS --- */

/* Cores da Metrobras */
:root {
    --metrobras-azul-escuro: #00244d;
    --metrobras-azul: #005ec4;
    --metrobras-amarelo: #f7e017;
    --metrobras-verde: #009959;
    --metrobras-branco: #ffffff;
    --app-radius: 0.75rem;
    --app-radius-sm: 0.5rem;
    --sidebar-scrollbar-thumb: rgba(15, 23, 42, 0.2);
    --sidebar-scrollbar-thumb-hover: rgba(15, 23, 42, 0.35);
    --sidebar-scrollbar-track: rgba(15, 23, 42, 0.05);
    --sidebar-active-bg: rgba(0, 94, 196, 0.1);
    --sidebar-active-text: #004a9e;
    --sidebar-surface: #ffffff;
    --sidebar-border: rgba(15, 23, 42, 0.08);
}

/* Conteúdo principal ao lado do sidebar fixo (páginas /sistema/) */
.main-with-sidebar {
    margin-left: 17rem;
    min-height: 100vh;
}

@media (max-width: 640px) {
    .main-with-sidebar {
        margin-left: 0;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* --- GERAL --- */
body.app-body,
body {
    font-family: 'Montserrat', sans-serif;
    background-color: #f1f5f9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Modal de Orçamentos */
#modal-novo-orcamento {
    transition: opacity 0.3s ease;
}

#modal-novo-orcamento:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Títulos com fonte Liquid Crystal (fallback para Montserrat Bold) */
/* Nota: Liquid Crystal não está disponível via CDN, usando Montserrat Bold como alternativa */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--metrobras-azul-escuro);
    letter-spacing: -0.02em; /* Aproximação visual da Liquid Crystal */
}

/* --- BARRA LATERAL (SIDEBAR) — tema claro, hierarquia forte --- */
#sidebar.app-sidebar {
    background: var(--sidebar-surface);
    color: #334155;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 4px 0 32px rgba(15, 23, 42, 0.06);
    color-scheme: light;
}

/* Reserva espaço do sidebar no primeiro paint para evitar layout shift. */
#sidebar.app-sidebar.app-sidebar-loading {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.app-sidebar-brand {
    padding: 1rem 1rem 0.875rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.app-sidebar-brand-inner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.app-sidebar-logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    background: linear-gradient(145deg, var(--metrobras-azul) 0%, #003d82 100%);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 94, 196, 0.35);
}

.app-sidebar-brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--metrobras-azul-escuro);
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.sidebar-section {
    margin-bottom: 1.35rem;
}

.sidebar-section-header {
    padding: 0.4rem 0.65rem 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: #94a3b8;
    border-bottom: none;
}

.sidebar-section-items {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: 1px solid transparent;
}

.sidebar-link-icon {
    width: 1.125rem;
    flex-shrink: 0;
    text-align: center;
    color: #64748b;
    font-size: 0.875rem;
}

.sidebar-link-text {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}

.sidebar-link-indicator {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    flex-shrink: 0;
    background: transparent;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.sidebar-link:hover {
    background: rgba(15, 23, 42, 0.04);
    color: #1e293b;
}

.sidebar-link:hover .sidebar-link-icon {
    color: #475569;
}

.sidebar-link.active {
    background: var(--sidebar-active-bg) !important;
    color: var(--sidebar-active-text) !important;
    font-weight: 600;
    border-color: rgba(0, 94, 196, 0.12);
}

.sidebar-link.active .sidebar-link-icon {
    color: var(--metrobras-azul) !important;
}

.sidebar-link.active .sidebar-link-indicator {
    background: var(--metrobras-azul);
    opacity: 1;
    transform: scale(1);
}

/* Rodapé: conta + versão + Sair */
.sidebar-account {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 0.75rem 1rem;
    border-top: 1px solid var(--sidebar-border);
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.sidebar-account-block {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-account-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--metrobras-azul-escuro);
    line-height: 1.3;
}

.sidebar-account-version-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.sidebar-account-version-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.sidebar-account-version {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.sidebar-account-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--metrobras-azul-escuro);
    background: #fff;
    border: 1px solid var(--sidebar-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-account-logout:hover {
    background: #fff;
    border-color: var(--metrobras-azul);
    color: var(--metrobras-azul);
    box-shadow: 0 2px 8px rgba(0, 94, 196, 0.12);
}

.sidebar-account-logout:focus-visible {
    outline: 2px solid var(--metrobras-azul);
    outline-offset: 2px;
}

.sidebar-scroll-area,
aside nav.sidebar-scroll-area {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-scrollbar-thumb) transparent;
}

.sidebar-scroll-area::-webkit-scrollbar,
aside nav.sidebar-scroll-area::-webkit-scrollbar {
    width: 7px;
}

.sidebar-scroll-area::-webkit-scrollbar-track,
aside nav.sidebar-scroll-area::-webkit-scrollbar-track {
    margin: 8px 0;
    background: transparent;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb,
aside nav.sidebar-scroll-area::-webkit-scrollbar-thumb {
    background: var(--sidebar-scrollbar-thumb);
    border-radius: 100px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb:hover,
aside nav.sidebar-scroll-area::-webkit-scrollbar-thumb:hover {
    background: var(--sidebar-scrollbar-thumb-hover);
    background-clip: padding-box;
}

/* Botão Sair legado (se existir no header em outras páginas) */
.app-btn-signout {
    background-color: var(--metrobras-azul);
    border: none;
    cursor: pointer;
    color: #fff;
    border-radius: 0.5rem;
}

.app-btn-signout:hover {
    background-color: var(--metrobras-azul-escuro);
}

/* Área principal — rolagem discreta */
#main-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.25) transparent;
}

#main-content::-webkit-scrollbar {
    width: 10px;
}

#main-content::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.2);
    border-radius: 100px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

#main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.32);
    background-clip: padding-box;
}

/* --- CARDS E CONTEÚDO --- */
.card {
    background-color: white;
    border-radius: var(--app-radius);
    padding: 1.5rem;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px -8px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
}

.stats-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 1rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.stats-label p {
    display: flex;
    justify-content: space-between;
}

/* --- TABELAS --- */
.table-container {
    height: 400px; /* Altura fixa para permitir scroll */
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.table-container th {
   background-color: #f9fafb;
   position: sticky;
   top: 0;
   z-index: 10;
   padding: 0.75rem 1rem;
   text-align: left;
   font-size: 0.75rem;
   color: #374151;
   text-transform: uppercase;
   letter-spacing: 0.05em;
   border-bottom: 1px solid #e5e7eb;
}

.table-container td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.table-container tbody tr:last-child td {
    border-bottom: none;
}

.table-container tbody tr:hover {
    background-color: #f3f4f6;
    cursor: pointer;
}

.selected-row {
    background-color: #dbeafe !important;
    font-weight: 600;
    color: var(--metrobras-azul-escuro);
}

/* Botões com cores Metrobras */
.btn-primary {
    background-color: var(--metrobras-azul);
    color: white;
    border-radius: var(--app-radius-sm);
    font-weight: 600;
    transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
}

.btn-primary:hover {
    background-color: var(--metrobras-azul-escuro);
    box-shadow: 0 4px 12px rgba(0, 94, 196, 0.25);
}

.btn-success {
    background-color: var(--metrobras-verde);
    color: white;
}

.btn-warning {
    background-color: var(--metrobras-amarelo);
    color: var(--metrobras-azul-escuro);
}

/* --- MODAL DE CONFIRMAÇÃO --- */
.modal-overlay {
    transition: opacity 0.3s ease;
}

/* --- DASHBOARD USUÁRIO MONITORADO - LAYOUT COMPACTO --- */
/* Cards compactos com melhor espaçamento */
.max-w-7xl .bg-white {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.max-w-7xl .bg-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.15);
}

/* Melhorar legibilidade em telas pequenas */
@media (max-width: 640px) {
    .max-w-7xl .bg-white {
        padding: 0.75rem;
    }
    
    .max-w-7xl .text-xl {
        font-size: 1.125rem;
    }
}

/* Tabela compacta */
.max-w-7xl table th,
.max-w-7xl table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.max-w-7xl table th {
    font-size: 0.75rem;
}

/* Gráficos responsivos */
.max-w-7xl canvas {
    max-height: 250px;
}

@media (max-width: 1024px) {
    .max-w-7xl canvas {
        max-height: 200px;
    }
}
