﻿/**
 * Author:  SÃ©rgio Rosa SchÃ¼tz
 * Empresa: Pethos Tecnologia
 * Data e Hora: 14/02/2026 17:39
 * VersÃ£o: 2.3.1 (Build #3)
 * Finalidade: Componente de barra lateral unificada V17 Platinum.
 */

/* Main Style - Super Ultra Mega Professional Edition */

:root {
    /* Mapped to theme-base variables for backwards compatibility if needed */
    --primary: var(--primary-500);
    --secondary: var(--slate-600);
    --success: var(--success);
    --warning: var(--warning);
    --danger: var(--danger);
    --light: var(--slate-100);
    --dark: var(--slate-800);

    /* Sidebar Sizes */
    --sidebar-w: 340px;
}

body.sidebar-collapsed {
    --sidebar-w: 80px;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* Garante que o dashboard continue sem scroll no body */
body:has(.layout-wrapper) {
    overflow: hidden;
}

/* --- LAYOUT STRUCTURE --- */
.layout-wrapper {
    display: flex;
    height: 100vh;
    /* Ocupa toda a altura */
    position: relative;
    padding-left: var(--sidebar-w);
    transition: padding-left 0.3s ease;
    overflow-y: auto;
    /* Scroll acontece aqui agora */
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Quando nÃ£o houver sidebar (modo iframe) */
body.is-iframe-mode .layout-wrapper {
    padding-left: 0 !important;
}

.main-content {
    flex: 1;
    min-width: 0;
    width: 0;
    padding: 15px 20px;
    padding-top: calc(var(--topbar-height) + 15px);
    box-sizing: border-box;
    overflow-x: hidden;
    position: relative;
    max-width: 100%;
}

/* Mobile - reduzir padding */
@media (max-width: 768px) {
    .main-content {
        padding: 20px 15px;
    }
}

/* --- CARDS & CONTAINERS --- */
.config-container,
.resultado-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin: 0 auto;
    max-width: 600px;
}

.config-container h2 {
    color: var(--primary);
    font-size: 1.75rem;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 700;
}

.config-container p {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 30px;
}

/* --- FORMS --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text-main);
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* --- BUTTONS --- */
.btn-primario {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    width: 100%;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.25);
}

.btn-primario:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

.btn-secundario {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 14px 30px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    width: 100%;
}

.btn-secundario:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

/* --- FOOTER --- */
.footer {
    text-align: center;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    margin-top: auto;
}

/* --- UTILS --- */
.status-badge {
    padding: 6px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-sucesso {
    background: var(--success-light);
    color: var(--success-dark);
}

.status-falha {
    background: var(--danger-light);
    color: var(--danger-dark);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {

    .header-top,
    .header-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* --- SUPORTE A ABAS INTERNAS (IFRAMES) --- */
body.is-iframe-mode {
    background: white !important;
    overflow-y: auto !important;
    min-height: auto !important;
}

body.is-iframe-mode .main-content {
    padding: 10px 20px !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
    min-height: auto !important;
}

body.is-iframe-mode .layout-wrapper {
    min-height: auto !important;
}

/* -------------------------------------------------------
   VLibras: cancela o box-sizing: border-box global
   O widget usa content-box internamente; sem esse reset
   as dimensões ficam erradas e a animação desaparece.
------------------------------------------------------- */
[vw],
[vw] *,
[vw-access-button],
[vw-plugin-wrapper],
[vw-plugin-wrapper] * {
    box-sizing: content-box !important;
}

/* Remover sombra e borda do header dentro do iframe se ele ainda existir */
body.is-iframe-mode .header {
    box-shadow: none !important;
    border-bottom: 1px solid #eee !important;
}

.iframe-city-header {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* --- V17 LAYOUT FIXES --- */

/* Scroll Offset for Anchors (Fixes overlap with fixed Topbar) */
[id$="-section"],
[id^="relatorios-"],
[id^="dashboards-"] {
    scroll-margin-top: 140px;
}

/* Hub Info Bar displacement fix */
.bg-white.p-3.shadow-sm[style*="border-radius: 15px"] {
    margin-top: 5px;
}

/* Ajuste de proximidade do banner */
body .layout-wrapper .main-content {
    padding-top: 170px !important;
}

body.is-iframe-mode .layout-wrapper .main-content {
    padding-top: 100px !important;
}
