/* Caminho: /apps/ene/css/energia.css */
/* Minha Energia v8.0 — Arcoll Digital */
/* Apenas estilos ESPECÍFICOS do app — o resto vem do CSS Global (header.php) */
/* Usa variáveis CSS do global: --cor-accent, --radius, --radius-lg, --transition */

/* ──────────────────────────────────────
   BOTÕES DE MODO E TIPO (legado e v8)
   ────────────────────────────────────── */
.en-modo-btn {
    padding: 12px 10px;
    border: 1.5px solid #1f2940;
    border-radius: 12px;
    background: #0f1525;
    color: #8b98ac;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    transition: all var(--transition, .22s ease);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.en-modo-btn i     { font-size: 20px; }
.en-modo-btn small { font-size: 10px; opacity: .7; }
.en-modo-btn.active {
    background: rgba(108,92,231,.15);
    border-color: var(--cor-accent, #6c5ce7);
    color: var(--cor-accent, #6c5ce7);
}

/* Tipo de ligação (v8) */
.ene-tipo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 4px;
}
.ene-tipo-opt-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border: 1.5px solid #1f2940;
    border-radius: 10px;
    background: #0f1525;
    color: #8b98ac;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition, .22s ease);
    gap: 4px;
    user-select: none;
}
.ene-tipo-opt-btn.active,
input:checked + .ene-tipo-opt-btn {
    background: rgba(243, 156, 18, .15);
    border-color: #f39c12;
    color: #f39c12;
}
.ene-tipo-opt-btn:hover {
    border-color: rgba(243, 156, 18, .5);
    color: #c0c8d8;
}

/* ──────────────────────────────────────
   LAYOUT RAIZ DO APP
   ────────────────────────────────────── */
:root { --header-h: 54px; }

#eneRoot {
    position: fixed;
    inset: var(--header-h, 54px) 0 56px 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #080d1a;
}

#eneBg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse at 30% 60%, rgba(243,156,18,.18) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(108,92,231,.15) 0%, transparent 50%),
        #080d1a;
}

#eneBgOverlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(8,13,26,.68);
    transition: opacity .4s;
    pointer-events: none;
}
#eneRoot.modo-resultado #eneBgOverlay { opacity: .15; }

/* ──────────────────────────────────────
   PAINEL DE ENTRADA
   ────────────────────────────────────── */
#eneSearchPanel {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 0;
    transition: all .4s cubic-bezier(.4,0,.2,1);
}
#eneRoot.modo-resultado #eneSearchPanel { padding-top: 8px; }

#eneHeadline {
    text-align: center;
    margin-bottom: 16px;
    transition: all .4s;
}
#eneHeadline h1 {
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -.3px;
    margin: 0 0 4px;
}
#eneHeadline p  { font-size: 12px; color: #8b98ac; margin: 0; }
#eneRoot.modo-resultado #eneHeadline { display: none; }

/* Badge sem login */
.ene-badge-livre {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(243,156,18,.12);
    border: 1px solid rgba(243,156,18,.3);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 800;
    color: #f39c12;
    margin-bottom: 12px;
}

/* Chip distribuidora detectada */
#eneDistribChip {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(243,156,18,.12);
    border: 1px solid rgba(243,156,18,.35);
    border-radius: 20px;
    padding: 5px 8px 5px 10px;
    font-size: 11px;
    color: #f39c12;
    font-weight: 700;
    margin-bottom: 12px;
    max-width: 420px;
    width: 100%;
}
#eneDistribChip.show { display: flex; }
#eneDistribChip span {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#eneDistribChip .edit-btn {
    background: rgba(243,156,18,.15);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    color: #f39c12;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .15s;
}
#eneDistribChip .edit-btn:hover {
    background: rgba(243,156,18,.3);
    transform: scale(1.1);
}

/* Status GPS */
#eneGeoStatus {
    font-size: 10px;
    color: #8b98ac;
    text-align: center;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}
#eneGeoStatus.erro { color: #e74c3c; }
#eneGeoStatus.ok   { color: #27ae60; }

/* Campo de entrada principal */
#eneInputBox {
    position: relative;
    width: 100%;
    max-width: 520px;
}
#eneInputLeitura {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 48px 14px 52px;
    background: #0f1525;
    border: 2px solid #1f2940;
    border-radius: 14px;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    font-family: inherit;
    outline: none;
    text-align: center;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
}
#eneInputLeitura:focus {
    border-color: #f39c12;
    box-shadow: 0 0 0 3px rgba(243,156,18,.18);
}
#eneInputLeitura::placeholder {
    color: #5b667e;
    font-size: 15px;
    font-weight: 600;
}
.ene-inp-ico-left {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #f39c12;
    font-size: 18px;
    pointer-events: none;
}
.ene-inp-ico-right {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #8b98ac;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border: none;
    background: none;
    display: none;
}
.ene-inp-ico-right.show { display: flex; align-items: center; }

#eneLblKwh {
    font-size: 10px;
    color: #8b98ac;
    font-weight: 700;
    text-align: center;
    margin-top: 5px;
    letter-spacing: .4px;
    text-transform: uppercase;
}

/* Preview de consumo */
#enePreviewConsumo {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(39,174,96,.1);
    border: 1px solid rgba(39,174,96,.3);
    border-radius: 10px;
    padding: 8px 14px;
    max-width: 520px;
    width: 100%;
    font-size: 13px;
    color: #fff;
    margin-top: 8px;
}
#enePreviewConsumo.show { display: flex; }
#enePreviewConsumo i { color: #27ae60; font-size: 14px; flex-shrink: 0; }
#enePreviewConsumo strong { color: #27ae60; }

/* Botão calcular */
#eneBtnCalcular {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 520px;
    padding: 14px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 18px rgba(243,156,18,.35);
    transition: all .2s;
}
#eneBtnCalcular:hover {
    box-shadow: 0 6px 24px rgba(243,156,18,.5);
    transform: translateY(-1px);
}
#eneBtnCalcular:disabled {
    background: #1f2940;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Botão voltar */
#eneBtnVoltar {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,.07);
    border: 1px solid #1f2940;
    border-radius: 20px;
    color: #8b98ac;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    padding: 5px 12px;
    cursor: pointer;
    margin-top: 6px;
    transition: all .15s;
}
#eneBtnVoltar:hover {
    background: rgba(243,156,18,.12);
    border-color: #f39c12;
    color: #fff;
}
#eneRoot.modo-resultado #eneBtnVoltar { display: flex; }

/* ──────────────────────────────────────
   RESUMO FLUTUANTE
   ────────────────────────────────────── */
#eneResumoFlutuante {
    display: none;
    position: absolute;
    z-index: 20;
    top: 8px;
    right: 12px;
    background: rgba(15,21,37,.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(243,156,18,.3);
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    min-width: 150px;
    pointer-events: auto;
}
#eneResumoFlutuante.show { display: block; }

.ene-rf-linha {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #8b98ac;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ene-rf-linha i { color: #f39c12; width: 14px; flex-shrink: 0; }
.ene-rf-linha strong { color: #fff; font-size: 14px; font-weight: 800; }
.ene-rf-total {
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: 6px;
    padding-top: 6px;
    font-size: 10px;
    color: #8b98ac;
}
.ene-rf-total strong { color: #f39c12; font-size: 20px; font-weight: 900; }

/* ──────────────────────────────────────
   ÁREA DE RESULTADOS
   ────────────────────────────────────── */
#eneResultArea {
    flex: 1;
    overflow-y: auto;
    z-index: 5;
    padding: 0 16px 16px;
    margin-top: 10px;
    display: none;
    scrollbar-width: thin;
    scrollbar-color: #1f2940 transparent;
}
#eneResultArea::-webkit-scrollbar { width: 4px; }
#eneResultArea::-webkit-scrollbar-thumb { background: #1f2940; border-radius: 4px; }
#eneRoot.modo-resultado #eneResultArea { display: block; }

/* ──────────────────────────────────────
   ABAS
   ────────────────────────────────────── */
#eneTabs {
    display: flex;
    gap: 2px;
    margin-bottom: 12px;
    border-bottom: 1px solid #1f2940;
}
.ene-tab {
    flex: 1;
    padding: 9px 6px;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    color: #5b667e;
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    transition: all .15s;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.ene-tab i { font-size: 12px; display: block; margin-bottom: 2px; }
.ene-tab:hover { color: #8b98ac; }
.ene-tab.active { color: #f39c12; border-bottom-color: #f39c12; }
.ene-tab-pane { display: none; }
.ene-tab-pane.active { display: block; animation: eneFade .25s ease; }
@keyframes eneFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Estado loading/erro */
.ene-estado-card {
    text-align: center;
    padding: 36px 20px;
    color: #8b98ac;
    font-size: 13px;
}
.ene-estado-card i { display: block; font-size: 32px; margin-bottom: 10px; opacity: .5; }
.ene-estado-card.erro { color: #e74c3c; }

/* ──────────────────────────────────────
   CARD HERO RESULTADO
   ────────────────────────────────────── */
.ene-result-hero {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all .15s;
}
.ene-result-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(243,156,18,.3);
}
.ene-result-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,.12), transparent 60%);
}
.ene-hero-label { font-size: 11px; opacity: .8; text-transform: uppercase; letter-spacing: .5px; color: #fff; }
.ene-hero-value { font-size: 40px; font-weight: 900; margin: 4px 0; color: #fff; }
.ene-hero-sub   { font-size: 11px; opacity: .8; color: #fff; }
.ene-hero-link-hint {
    font-size: 10px;
    color: rgba(255,255,255,.75);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

/* Stats grid */
.ene-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.ene-stat-card {
    background: #131829;
    border: 1px solid #1f2940;
    border-radius: 12px;
    padding: 14px 12px;
    text-align: center;
}
.ene-stat-card i { font-size: 20px; color: #f39c12; margin-bottom: 6px; display: block; }
.ene-stat-card .sv { font-size: 18px; font-weight: 800; color: #fff; }
.ene-stat-card .sl { font-size: 10px; color: #8b98ac; text-transform: uppercase; margin-top: 3px; }
.ene-stat-card.highlight {
    background: linear-gradient(135deg, rgba(243,156,18,.15), rgba(230,126,34,.1));
    border-color: rgba(243,156,18,.3);
}
.ene-stat-card.highlight i,
.ene-stat-card.highlight .sv { color: #f39c12; }

/* Detalhamento */
.ene-breakdown {
    background: rgba(255,255,255,.04);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.ene-breakdown-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
    font-size: 12px;
}
.ene-breakdown-line:last-child { border-bottom: none; }
.ene-breakdown-line .key { color: #8b98ac; }
.ene-breakdown-line .val { font-weight: 700; color: #fff; }
.ene-breakdown-line.total .key { color: #fff; font-weight: 800; font-size: 13px; }
.ene-breakdown-line.total .val { color: #f39c12; font-size: 18px; font-weight: 900; }

/* Bandeira */
.ene-bandeira {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 12px;
}
.ene-bandeira.verde   { background: rgba(39,174,96,.15);  color: #27ae60; border: 1px solid rgba(39,174,96,.3); }
.ene-bandeira.amarela { background: rgba(243,156,18,.15); color: #f39c12; border: 1px solid rgba(243,156,18,.3); }
.ene-bandeira.vermelha1 { background: rgba(231,76,60,.15); color: #e74c3c; border: 1px solid rgba(231,76,60,.3); }
.ene-bandeira.vermelha2 { background: rgba(192,57,43,.2);  color: #c0392b; border: 1px solid rgba(192,57,43,.4); }

/* Ações do resultado */
.ene-result-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.ene-result-actions button {
    flex: 1;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all .15s;
}

/* ──────────────────────────────────────
   HISTÓRICO
   ────────────────────────────────────── */
.ene-hist-item {
    background: #131829;
    border: 1px solid #1f2940;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all .15s;
}
.ene-hist-item:hover { border-color: #f39c12; transform: translateY(-1px); }
.ene-hist-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ene-hist-ico {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(243,156,18,.15);
    color: #f39c12;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.ene-hist-distr { font-size: 13px; font-weight: 800; color: #fff; }
.ene-hist-data { font-size: 10px; color: #5b667e; margin-left: auto; white-space: nowrap; }
.ene-hist-total { font-size: 18px; font-weight: 900; color: #f39c12; margin-top: 4px; }
.ene-hist-stats {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    font-size: 10px;
    color: #8b98ac;
    flex-wrap: wrap;
    align-items: center;
}
.ene-hist-link {
    background: rgba(108,92,231,.1);
    border: 1px solid rgba(108,92,231,.2);
    color: #6c5ce7;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.ene-hist-link:hover { background: rgba(108,92,231,.2); }

/* ──────────────────────────────────────
   DICAS
   ────────────────────────────────────── */
.ene-dica-item {
    background: #0f1525;
    border: 1px solid #1f2940;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}
.ene-dica-ico {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
.ene-dica-titulo { font-size: 11px; font-weight: 800; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .3px; }
.ene-dica-corpo  { font-size: 12px; color: #c0c8d8; line-height: 1.5; }

/* ──────────────────────────────────────
   ESTATÍSTICAS
   ────────────────────────────────────── */
.ene-estat-card {
    background: #0f1525;
    border: 1px solid #1f2940;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}
.ene-estat-card h4 {
    font-size: 11px;
    font-weight: 800;
    color: #8b98ac;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.ene-estat-card h4 i { color: #6c5ce7; }
.ene-estat-estado {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
    font-size: 11px;
}
.ene-estat-estado:last-child { border-bottom: none; }
.ene-estat-estado-sigla { font-weight: 900; color: #fff; width: 24px; flex-shrink: 0; }
.ene-estat-estado-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,.06);
    border-radius: 2px;
    overflow: hidden;
}
.ene-estat-estado-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f39c12, #e67e22);
    border-radius: 2px;
    transition: width .4s ease;
}
.ene-estat-estado-val { color: #f39c12; font-weight: 700; white-space: nowrap; font-size: 10px; }

/* ──────────────────────────────────────
   PUBLICIDADE DOS APPS
   ────────────────────────────────────── */
.ene-publi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.ene-publi-item {
    background: rgba(255,255,255,.03);
    border: 1px solid #1f2940;
    border-radius: 12px;
    padding: 14px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all .15s;
    cursor: pointer;
}
.ene-publi-item:hover {
    transform: translateY(-2px);
    border-color: var(--cor, #f39c12);
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.ene-publi-item-ico    { font-size: 22px; }
.ene-publi-item-titulo { font-size: 12px; font-weight: 800; color: #fff; }
.ene-publi-item-desc   { font-size: 10px; color: #8b98ac; line-height: 1.4; }
.ene-publi-item-btn {
    font-size: 10px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    margin-top: 4px;
    align-self: flex-start;
}

/* ──────────────────────────────────────
   MODAL DE CONFIGURAÇÕES
   ────────────────────────────────────── */
#eneModalConfig {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    z-index: 500;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
#eneModalConfig.open { display: flex; }
#eneModalConfig .modal-box {
    background: #0f1525;
    border: 1px solid #1f2940;
    border-radius: 18px 18px 0 0;
    max-width: 520px;
    width: 100%;
    padding: 24px;
    max-height: 90vh;
    overflow-y: auto;
}
#eneModalConfig h3 {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
#eneModalConfig h3 i { color: #f39c12; }

/* ──────────────────────────────────────
   RESPONSIVO MOBILE
   ────────────────────────────────────── */
@media (max-width: 480px) {
    #eneSearchPanel { padding: 14px 12px 0; }
    #eneHeadline h1 { font-size: 18px; }
    .ene-stats-grid { grid-template-columns: 1fr 1fr; }
    .ene-publi-grid { grid-template-columns: 1fr; }
    .ene-tipo-grid  { grid-template-columns: 1fr 1fr; }
    .ene-result-actions button { font-size: 11px; padding: 8px 6px; }
    .ene-hero-value { font-size: 32px; }
    #eneInputLeitura { font-size: 18px; }
    #eneResumoFlutuante { max-width: 140px; padding: 8px 12px; }
}
