/*
    EletroCalc - Mobile First & Desktop Híbrido
    Versão Final: Menu Compacto e Otimizado
*/

:root {
    --primary: #00b4d8;
    --accent: #ffb703;
    --success: #00a878;
    --danger: #ef476f;
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --bg-input: #2c2c2c;
    --text-color: #ffffff;
    --text-muted: #b0b0b0;
    --border-color: #333333;
    --border-radius: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 16px;
    overflow-x: hidden;
}

/* --- OVERLAY (Fundo escuro quando menu abre) --- */
#overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 998;
    backdrop-filter: blur(3px);
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- SIDEBAR (MENU LATERAL) --- */
.sidebar {
    position: fixed;
    top: 0; 
    left: -280px; /* Escondido à esquerda */
    width: 260px;
    height: 100vh;
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
    padding: 10px; /* Padding reduzido para ganhar espaço */
    z-index: 1000;
    transition: left 0.3s ease-in-out;
    box-shadow: 4px 0 15px rgba(0,0,0,0.5);
    overflow-y: auto; /* Permite rolagem se necessário */
}

/* Classe que torna o menu visível */
.sidebar.active {
    left: 0;
}

/* --- LOGO AREA COMPACTA (HORIZONTAL) --- */
.logo-area {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Alinha à esquerda */
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    min-height: 60px;
}

.company-logo {
    width: 45px; /* Tamanho fixo e pequeno */
    height: 45px;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid var(--primary);
    padding: 2px;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-text h2 {
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.1;
    color: white;
}

.logo-text small {
    font-size: 0.75rem;
    color: var(--primary);
}

/* Botão X para fechar (ajustado para não sobrepor) */
.close-menu-btn {
    position: absolute;
    top: 5px; right: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 5px;
}

/* --- NAVEGAÇÃO --- */
.nav-menu { flex-grow: 1; }

.menu-label {
    font-size: 0.7rem;
    color: var(--primary);
    margin: 10px 0 5px 5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px; /* Altura compacta mas tocável */
    margin-bottom: 4px;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

/* Força visibilidade dos ícones */
.nav-btn .material-icons { 
    margin-right: 12px; 
    display: block !important;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.nav-btn:hover {
    background-color: rgba(255,255,255,0.05);
    color: white;
}

.nav-btn.active {
    background-color: rgba(0, 180, 216, 0.15);
    color: var(--primary);
    font-weight: 600;
    border-left: 3px solid var(--primary);
}

.nav-btn.active .material-icons { color: var(--primary); }

.sidebar-footer {
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.social-link { color: var(--text-muted); text-decoration: none; }

/* --- HEADER MOBILE (TOPO) --- */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 90;
    background-color: var(--bg-panel);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.top-bar h1 {
    font-size: 1.2rem;
    margin: 0;
    color: white;
}

.user-info span {
    background-color: var(--accent);
    color: var(--bg-panel);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* --- CONTEÚDO PRINCIPAL --- */
.main-content {
    flex-grow: 1;
    padding: 15px;
    width: 100%;
}

.calculator-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calc-module {
    background-color: var(--bg-panel);
    padding: 20px;
    border-radius: var(--border-radius);
    display: none;
    animation: fadeIn 0.3s ease-in;
}
.calc-module.active-module { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.module-header {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
}
.module-header h2 { font-size: 1.2rem; margin-bottom: 5px; }

/* --- INPUTS --- */
.input-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: 1 coluna */
    gap: 15px;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 2px 5px;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(0, 180, 216, 0.3);
}

.input-wrapper input, .input-wrapper select {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 12px 5px;
    font-size: 1rem;
    width: 100%;
    outline: none;
}

/* Corrigir Selects */
select.full-select { appearance: none; cursor: pointer; }
select option { background-color: var(--bg-panel); color: white; }

.select-wrapper { position: relative; }
.select-wrapper .material-icons {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--primary);
}

.input-wrapper .unit {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0 10px;
    border-left: 1px solid rgba(255,255,255,0.1);
}

/* --- BOTÕES --- */
.action-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    width: 100%;
}

.btn-primary { background-color: var(--primary); color: #000; box-shadow: 0 4px 6px rgba(0,0,0,0.2); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary { background-color: var(--bg-input); color: white; border: 1px solid #444; }

.small-btn { padding: 8px; font-size: 0.9rem; }

/* --- RESULTADOS --- */
.result-box {
    margin-top: 25px;
    padding: 15px;
    background-color: rgba(0, 180, 216, 0.05);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-radius: var(--border-radius);
}
.result-box h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 5px;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.res-card {
    background: var(--bg-input);
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

.big-number { font-size: 1.8rem; color: var(--accent); font-weight: 700; line-height: 1.2; }

/* Explicações e Fórmulas */
.explanation-box {
    margin-top: 15px;
    padding: 10px;
    background-color: rgba(0, 180, 216, 0.1);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    display: flex; gap: 10px;
    font-size: 0.85rem;
}



.explanation-box .material-icons { font-size: 1.2rem; color: var(--primary); }

.formula-box {
    margin-top: 15px;
    padding: 10px;
    background-color: var(--bg-panel);
    border: 1px dashed var(--border-color);
    border-radius: 4px;
}
.math-text { font-family: monospace; font-size: 0.85rem; }

/* WhatsApp */
.btn-whatsapp {
    background-color: #25d366;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    cursor: pointer;
    text-decoration: none;
}
.whatsapp-float {
    position: fixed;
    bottom: 20px; right: 20px;
    width: 55px; height: 55px;
    background-color: #25d366;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
    z-index: 900;
}

/* Seletores (Radio Buttons) */
.circuit-type-selector {
    display: flex;
    gap: 5px;
    background: var(--bg-input);
    padding: 5px;
    border-radius: 8px;
    flex-wrap: wrap;
}
.type-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    min-width: 80px;
}
.type-btn.active {
    background: var(--primary);
    color: #000;
    font-weight: 700;
}

/* Radio Buttons Checkbox Style */
.checkbox-grid { display: flex; gap: 15px; margin: 15px 0; justify-content: center; }
.checkbox-group input { display: none; }
.checkbox-group label {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}
.checkbox-group input:checked + label {
    background: var(--success);
    color: white;
    border-color: var(--success);
}
.separator-text { text-align: center; color: var(--accent); margin: 20px 0 10px; font-weight: 600; font-size: 0.9rem;}

/* Resistor Visualizer */
.resistor-preview { display: flex; justify-content: center; margin-bottom: 20px; }
.wire-left, .wire-right { width: 20px; height: 2px; background: #ccc; margin-top: 19px; }
.resistor-body {
    width: 120px; height: 40px; background: #999; border-radius: 8px;
    position: relative; display: flex;
}
.resistor-band { width: 8px; height: 100%; position: absolute; }
#band-1-visual { left: 15px; } #band-2-visual { left: 35px; }
#band-3-visual { left: 55px; } #band-4-visual { right: 15px; }


/* ================================================= */
/* ===  VERSÃO DESKTOP (Telas maiores que 992px) === */
/* ================================================= */
@media (min-width: 992px) {
    .app-container {
        flex-direction: row;
    }

    .sidebar {
        position: sticky; /* Menu fixo na lateral */
        left: 0;
        top: 0;
        height: 100vh;
        width: 280px;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
        z-index: 100;
        padding: 20px; /* Padding maior no desktop */
    }
    
    .logo-area {
        flex-direction: column; /* Logo em cima do texto no PC */
        text-align: center;
        justify-content: center;
    }
    .company-logo {
        width: 80px; height: 80px; /* Logo maior no PC */
        margin-bottom: 10px;
    }
    .logo-text { text-align: center; }

    /* Esconde elementos mobile */
    .menu-toggle-btn, .close-menu-btn, #overlay {
        display: none !important;
    }

    .main-content {
        padding: 40px;
        overflow-y: auto;
    }

    .top-bar {
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0 0 20px 0;
    }
    .top-bar h1 { font-size: 1.8rem; }
    .user-info { display: block; }

    .input-grid { grid-template-columns: 1fr 1fr; }
    
    .action-area {
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .btn-primary, .btn-secondary {
        width: auto;
        padding: 10px 25px;
    }
    
    .nav-btn { padding: 10px 15px; margin-bottom: 2px; }
}


/* ========================================================= */
/* === CORREÇÃO DEFINITIVA: QUEBRA DE LINHA PARA FÓRMULAS === */
/* === ESTA REGRA FORÇA DISPLAY:BLOCK NO RENDERER LATEX === */
/* ========================================================= */

.formula-box .math-text {
    /* Garante que o container de fórmulas use display de bloco */
    display: block !important;
    margin: 10px 0;
    padding: 0;
    line-height: 1.4;
}

/* Força quebra de linha (display: block) para CADA equação, mirando as tags do renderizador LaTeX */
.formula-box .math-text > div,
.formula-box .math-text > p,
.formula-box .math-text > .katex-display { 
    /* Esta é a regra mais importante para o display de bloco */
    display: block !important;
    text-align: center !important;
    /* Garante separação vertical nítida entre equações */
    margin: 15px 0 !important; 
    padding: 0;
}
/* Estilo do Modal de Boas Vindas */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: var(--card-bg);
    width: 90%; max-width: 500px;
    padding: 2rem; border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header-pro h1 {
    color: var(--primary);
    font-size: 1.8rem; margin: 10px 0;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}

.version-badge {
    background: var(--primary); color: #000;
    font-size: 0.7rem; padding: 2px 8px;
    border-radius: 10px; font-weight: 800;
}

.features-summary {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 15px; margin: 25px 0;
}

.feat-item {
    background: rgba(255,255,255,0.05);
    padding: 12px; border-radius: 12px;
    display: flex; align-items: center; gap: 10px; text-align: left;
}

.feat-item .material-icons { color: var(--primary); }

.btn-start {
    background: var(--primary);
    color: #000; border: none;
    padding: 15px 30px; border-radius: 12px;
    font-weight: bold; width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    cursor: pointer; transition: 0.3s;
}

.btn-start:hover { transform: scale(1.02); filter: brightness(1.1); }
/* Design de Marca - ÔMEGA SOLUÇÕES ELÉTRICAS */
.brand-container {
    margin-bottom: 30px;
    padding-bottom: 20px;
}
/*
.omega-logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), #00d4ff);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    box-shadow: 0 10px 20px rgba(0, 212, 255, 0.3);
}*/

.omega-logo {
    width: 70px;
    height: 70px;

    /* fundo transparente */
    background: transparent;

    border-radius: 15px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 15px;

    /* opcional: remova se não quiser nenhum destaque */
    box-shadow: none;
}





.omega-symbol {
    font-size: 40px;
    font-weight: bold;
    color: #0f172a; /* Cor escura para contraste no fundo ciano */
}

.company-name {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 5px;
    margin: 0;
    line-height: 1;
}

.company-sub {
    font-size: 0.9rem;
    color: var(--primary);
    letter-spacing: 3px;
    font-weight: 400;
    margin-top: 5px;
}

.brand-divider {
    width: 50px;
    height: 3px;
    background: var(--primary);
    margin: 15px auto;
    border-radius: 2px;
}

.prof-signature {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 1px;
}

.app-intro {
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.app-title {
    font-weight: 700;
    color: #f8fafc;
}

.version-tag {
    background: #334155;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.65rem;
    color: var(--primary);
}

/* Layout Ajustado para ÔMEGA - Foco em Visibilidade */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 15, 28, 0.95);
    backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000;
    padding: 20px; /* Margem de segurança para mobile */
}

.modal-content.pro-width {
    max-width: 600px;
    max-height: 95vh; /* Não ultrapassa 95% da altura da tela */
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow: hidden; /* Evita scroll na borda do modal */
}

/* Área de scroll apenas para os cards se necessário */
.modal-body {
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 15px;
    /* Estilo da barra de scroll para ficar elegante */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

.brand-container {
    margin-bottom: 15px;
}

.omega-logo {
    width: 55px; height: 55px; /* Reduzido */
    margin-bottom: 10px;
}

.omega-symbol { font-size: 32px; }

.company-name { font-size: 1.6rem; letter-spacing: 4px; }

.main-features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.feat-card-pro {
    padding: 12px; /* Mais compacto */
    border-radius: 12px;
}

.feat-card-pro h5 { font-size: 0.9rem; margin-bottom: 2px; }
.feat-card-pro p { font-size: 0.7rem; }
.md-36 { font-size: 28px !important; } /* Ícones menores */

.btn-start {
    margin-top: auto; /* Empurra o botão para o fim do modal */
    padding: 12px;
    min-height: 50px;
}
.btn-pdf {
    background: #e11d48; /* Vermelho elegante para PDF */
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: 0.3s;
}

.btn-pdf:hover {
    background: #be123c;
    transform: translateY(-2px);
}
