/* Paleta de Colores y Variables de Diseño */
:root {
    --bg-dark: #0b0e14;
    --bg-card: #141a24;
    --bg-card-hover: #1b2432;
    --accent: #f0b90b; /* Color Binance Yellow */
    --accent-glow: rgba(240, 185, 11, 0.15);
    --text-primary: #f0f3f8;
    --text-secondary: #848e9c;
    --green-up: #0ecb81;
    --green-up-glow: rgba(14, 203, 129, 0.1);
    --red-down: #f6465d;
    --red-down-glow: rgba(246, 70, 93, 0.1);
    --border-color: #2b3648;
    
    /* Fuentes */
    --font-main: 'Outfit', sans-serif;
}

/* Reset y Estilos Generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header */
.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-pulse {
    width: 12px;
    height: 12px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
    animation: pulse 2s infinite;
}

.logo-area h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #ffffff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-area .tag {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    background-color: var(--border-color);
    color: var(--accent);
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 0.5rem;
}

.market-info {
    display: flex;
    gap: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.info-item .value {
    font-weight: 600;
    font-size: 1rem;
}

.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.status-active {
    background-color: var(--green-up-glow);
    color: var(--green-up);
    border: 1px solid var(--green-up);
}

.statu.pos-long {
    background: rgba(14, 203, 129, 0.15);
    color: var(--color-green);
    border: 1px solid rgba(14, 203, 129, 0.3);
}

.pos-short {
    background: rgba(246, 70, 93, 0.15);
    color: var(--color-red);
    border: 1px solid rgba(246, 70, 93, 0.3);
}

/* Barra de Pestañas Multi-Bot */
.tabs-wrapper {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
}

.tab-navigation {
    display: flex;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 0.85rem 1.5rem;
    position: relative;
    transition: all 0.25s ease;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #f9d44a);
    border-radius: 3px 3px 0 0;
    transform: scaleX(0);
    transition: transform 0.25s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(240, 185, 11, 0.05);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: transparent;
}

.tab-btn.active::after {
    transform: scaleX(1);
}

/* Dashboard Grid Layout */
.dashboard-grid {
    flex: 1;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Cards Generales */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: #3f4e68;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Metricas Grid */
.metrics-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 110px;
}

.card-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.card-value-container {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin: 0.5rem 0;
}

.card-value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.card-subtitle {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.pct-badge {
    font-size: 0.8rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

.pct-up {
    background-color: var(--green-up-glow);
    color: var(--green-up);
}

.pct-down {
    background-color: var(--red-down-glow);
    color: var(--red-down);
}

.balances-row {
    display: flex;
    justify-content: space-between;
    margin: 0.5rem 0;
}

.balance-sub {
    display: flex;
    flex-direction: column;
}

.sub-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.sub-val {
    font-weight: 600;
    font-size: 1rem;
}

/* Gráfico Card */
.chart-card {
    display: flex;
    flex-direction: column;
    min-height: 450px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chart-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-legend {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-item.toggleable {
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s, background-color 0.2s;
    user-select: none;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
}

.legend-item.toggleable:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.legend-item.toggleable:active {
    transform: scale(0.95);
}

.legend-item.toggleable.inactive {
    opacity: 0.3;
    text-decoration: line-through;
}

.legend-color {
    width: 12px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
}

.ema-fast-color { background-color: #2962ff; }
.ema-slow-color { background-color: #ff9800; }
.bb-color { background-color: rgba(189, 195, 199, 0.6); }

.chart-relative-wrapper {
    position: relative;
    width: 100%;
}

.ohlc-tooltip {
    position: absolute;
    top: 8px;
    left: 10px;
    z-index: 10;
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(20, 26, 36, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
}

.ohlc-val span {
    color: var(--text-primary);
    font-family: monospace;
}

.chart-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 5px;
    background: rgba(30, 35, 41, 0.8);
    padding: 4px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.chart-controls button {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.chart-controls button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.chart-wrapper {
    width: 100%;
    height: 350px;
    position: relative;
}

.macd-wrapper {
    width: 100%;
    height: 150px;
    position: relative;
    margin-top: 10px;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
}

.adx-wrapper {
    width: 100%;
    height: 120px;
    position: relative;
    margin-top: 10px;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
}

/* Historial Card */
.history-card {
    display: flex;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.pos-badge {
    background-color: var(--border-color);
    color: var(--text-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.05);
}

.pos-long {
    background-color: var(--green-up-glow);
    color: var(--green-up);
    border-color: var(--green-up);
}

/* Tabla Estilos */
.table-wrapper {
    overflow-x: auto;
    max-height: 250px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.history-table th {
    background-color: rgba(255,255,255,0.02);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.history-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.history-table tbody tr {
    transition: background-color 0.2s;
}

.history-table tbody tr:hover {
    background-color: rgba(255,255,255,0.02);
}

.op-compra {
    color: var(--green-up);
    font-weight: 600;
}

.op-venta {
    color: var(--red-down);
    font-weight: 600;
}

.empty-table-msg {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem !important;
}

/* Footer */
.app-footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Animaciones */
@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(240, 185, 11, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(240, 185, 11, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(240, 185, 11, 0);
    }
}

/* Colores de PnL dinámicos */
.color-green { color: var(--green-up); }
.color-red { color: var(--red-down); }

/* Adaptación responsive */
@media (min-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .metrics-container {
        grid-column: span 3;
    }
    
    .chart-card {
        grid-column: span 3;
    }
    
    .history-card {
        grid-column: span 3;
    }
}

/* --- Analíticas Globales --- */
.analytics-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 30px;
    animation: fadeIn 0.4s ease;
}

.analytics-tab {
    background: linear-gradient(135deg, rgba(41, 98, 255, 0.2), rgba(0, 229, 255, 0.2));
    border-color: var(--accent-primary) !important;
    color: #fff;
    font-weight: 700;
}

.analytics-tab:hover {
    background: linear-gradient(135deg, rgba(41, 98, 255, 0.4), rgba(0, 229, 255, 0.4));
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

.analytics-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
    color: #fff;
}

.analytics-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* --- Archivo Cortes Diarios --- */
.reports-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 30px;
    animation: fadeIn 0.4s ease;
}

.reports-tab {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.2), rgba(103, 58, 183, 0.2));
    border-color: var(--accent-secondary) !important;
    color: #fff;
    font-weight: 700;
}

.reports-tab:hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.4), rgba(103, 58, 183, 0.4));
    box-shadow: 0 0 15px rgba(156, 39, 176, 0.3);
}

.reports-tab.active {
    background: linear-gradient(135deg, #9C27B0, #673AB7) !important;
    box-shadow: 0 0 20px rgba(156, 39, 176, 0.5);
    color: #fff;
}
