/* ==========================================================
   TRADE+ MONITOR FULLSCREEN
   ========================================================== */

.trade-monitor {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    background: var(--bg-dark);
    color: var(--text-white);
}

/* ==========================================================
   COLUNA ESQUERDA
   ========================================================== */

.trade-monitor-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    box-sizing: border-box;
    min-width: 0; /* Impede que o container force a barra lateral */
}

.trade-monitor-pnl {
    font-size: clamp(60px, 12vw, 120px);
    line-height: 0.9;
    font-weight: 900;
    text-align: center;
    color: var(--op-profit);
    transition: font-size 0.2s ease; 
} 

/* COMPORTAMENTO SE O GRÁFICO ESTIVER ATIVO */
.com-grafico .trade-monitor-left {
    justify-content: flex-start !important;
}
.com-grafico .trade-monitor-pnl {
    font-size: clamp(60px, 10vw, 120px) !important;
}

/* ==========================================================
   COLUNA DIREITA
   ========================================================== */

.trade-monitor-right {
    width: 360px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    background: var(--bg-container);
    border-left: 1px solid var(--border-main);
    box-sizing: border-box;
}

.trade-monitor-block {
    margin-bottom: 25px; /* Margem reduzida para harmonizar com o novo campo */
}

.trade-monitor-label {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.trade-monitor-value {
    font-size: 45px;
    font-weight: bold;
}

.trade-monitor-relogio {
    font-size: 38px;
    font-weight: bold;
}

.trade-monitor-ticker {
    font-size: 65px;
    line-height: 1;
    font-weight: 900;
    color: var(--primary-color);
}

#monitorAtual {
    color: var(--primary-color) !important;
}

.trade-monitor-long {
    color: var(--op-compra);
}

.trade-monitor-short {
    color: var(--op-venda);
}

/* ==========================================================
   BOTÃO FECHAR
   ========================================================== */

.trade-monitor-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-main);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    z-index: 10;
    transition: 0.2s;
    opacity: 0.6;
}

.trade-monitor-close:hover {
    color: var(--text-white);
    border-color: var(--primary-color);
    opacity: 1;
}

/* ==========================================================
   LINHA DE CONTROLE E ALINHAMENTO DO GRÁFICO
   ========================================================== */

/* 1. COMPORTAMENTO PADRÃO: Gráfico FECHADO -> Centraliza o botão "Abrir Gráfico" */
.trade-monitor-action-line {
    display: flex; 
    justify-content: center; /* Alinha o botão "Abrir Gráfico" exatamente no meio */
    align-items: center;            
    width: 100%;                   
    box-sizing: border-box;
    margin-top: 35px;
    margin-bottom: 0px;
}

/* 2. COMPORTAMENTO ATIVO: Gráfico ABERTO -> Distribui os blocos para as duas extremidades */
.com-grafico .trade-monitor-action-line {
    justify-content: space-between; 
    margin-top: 15px;
}


.trade-monitor-inline-controls {
    align-items: center;
    gap: 12px;
    display: none;
}

.com-grafico .trade-monitor-inline-controls {
    display: flex;
}


.trade-monitor-btn-chart {
    background: var(--bg-input);
    border: 1px solid var(--border-main);
    color: var(--text-white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.8;
    transition: 0.2s;
    margin: 0;
}

.trade-monitor-btn-chart:hover {
    border-color: var(--primary-color);
    opacity: 1;
}

.monitor-ctrl-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.monitor-ctrl-label input[type="checkbox"] {
    margin: 0;
    width: 14px;
    height: 14px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.monitor-ctrl-label:hover {
    color: var(--text-white);
}

/* WRAPPER DO TRADINGVIEW */
.trade-monitor-chart-wrapper {
    display: none;
    width: 100%;
    margin-top: 15px;
    border-radius: 6px;
    overflow: hidden;
    background: #131722;
    border: 1px solid var(--border-main);
}

#tradingview_embed_widget {
    width: 100%;
    height: 100%;
}

/* COMPORTAMENTO ATIVO NA HORIZONTAL */
.com-grafico .trade-monitor-chart-wrapper {
    display: block;
    flex-grow: 1;
    min-height: 200px;
}

/* ==========================================================
   RESPONSIVO - RETRATO (CELULAR EM PÉ)
   ========================================================== */

@media (orientation: portrait) {
    .trade-monitor {
        flex-direction: column;
    }

    .trade-monitor-left {
        flex: 1;
        padding: 40px 20px 20px 20px;
        justify-content: center;
    }

    .com-grafico .trade-monitor-left {
        justify-content: flex-start !important;
    }
    .com-grafico .trade-monitor-pnl {
        font-size: clamp(45px, 12vw, 75px) !important;
    }
    .com-grafico .trade-monitor-sub-container {
        margin-top: 10px !important;
        gap: 4px !important;
    }
    .com-grafico .trade-monitor-chart-wrapper {
        display: block !important;
        height: 220px !important;
        flex-grow: 0;
    }

    .trade-monitor-right {
        width: 100%;
        text-align: center;
        border-left: none;
        border-top: 1px solid var(--border-main);
        padding: 25px;
    }

    .trade-monitor-ticker {
        font-size: 42px;
    }

    .trade-monitor-value {
        font-size: 30px;
    }

    .trade-monitor-relogio {
        font-size: 26px;
    }

    .trade-monitor-pnl {
        font-size: clamp(30px, 15vw, 60px);
    }

    .trade-monitor-block {
        margin-bottom: 20px;
    }
}

/* ==========================================================
   ALTURA REDUZIDA
   ========================================================== */

@media (max-height: 700px) {
    .trade-monitor-ticker {
        font-size: 38px;
    }

    .trade-monitor-value {
        font-size: 28px;
    }

    .trade-monitor-relogio {
        font-size: 26px;
    }

    .trade-monitor-block {
        margin-bottom: 15px;
    }
}

/* ==========================================================
   ESTADOS DE RESULTADO
   ========================================================== */

.trade-monitor-profit .trade-monitor-pnl {
    color: var(--op-profit);
}

.trade-monitor-loss .trade-monitor-pnl {
    color: var(--op-venda);
}

.trade-monitor-neutral .trade-monitor-pnl {
    color: var(--text-white);
}

.btn-monitor {
    width: 40px;
    height: 40px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--text-white);
    border-radius: var(--radius-main);
    background: var(--bg-input);
    color: var(--text-white);
    cursor: pointer;
    transition: 0.2s;
}

.btn-monitor:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ==========================================================
   ESTILOS DOS SUBDADOS DO PNL
   ========================================================== */

.trade-monitor-sub-container {
    display: flex;
    flex-direction: row;       /* Muda de coluna para linha única */
    justify-content: center;   /* Centraliza o bloco na tela */
    gap: 24px;                 /* Cria o espaçamento elegante entre eles */
    margin-top: 25px; 
    text-align: center;
}


.trade-monitor-sub-item {
    font-size: clamp(16px, 2.5vw, 24px);
    font-weight: 600;
    color: var(--text-white);
    opacity: 0.8;
    letter-spacing: 1px;
}

/* ==========================================================
   PAISAGEM (LANDSCAPE) EM DISPOSITIVOS MÓVEIS
   ========================================================== */
@media (orientation: landscape) and (max-height: 600px) {
    body.monitor-fullscreen-ativo .header-historia, 
    body.monitor-fullscreen-ativo .main-content, 
    body.monitor-fullscreen-ativo #status_msg,
    body.monitor-fullscreen-ativo #modalAjuda { 
        display: none !important; 
    }


    body.plus-page {
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    .trade-monitor {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 999999 !important;
    }

    .trade-monitor-left { 
        padding: 10px !important; 
    }
    
    .trade-monitor-pnl { 
        font-size: clamp(30px, 15vh, 60px) !important; 
    }

    .com-grafico .trade-monitor-pnl {
        font-size: clamp(40px, 14vh, 75px) !important;
    }

    .trade-monitor-sub-container {
        margin-top: 10px !important;
        flex-direction: row !important; 
        gap: 24px !important;
    }

    .trade-monitor-sub-item {
        font-size: 14px !important;
    }
}

.monitor-bb-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #2a2a2a; /* Um tom cinza discreto para agrupar os campos */
    padding: 2px 6px;
    border-radius: 4px;
}

.monitor-bb-group input[type="number"] {
    width: 32px;
    height: 18px;
    background: #1e1e1e;
    border: 1px solid #444;
    color: white;
    font-size: 11px;
    text-align: center;
    border-radius: 2px;
    padding: 0;
    margin: 0;
}

