* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
}

body {
    background-color: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    padding: 15px;
}

.container {
    width: 98%;
    max-width: 98vw;
    margin: 0 auto;
    background: #1e293b;
    padding: 20px;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* HEADER */
header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #334155;
}

header h1 {
    color: #f8fafc;
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 300;
}

/* CONTROLES */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    background: #334155;
    border: 1px solid #475569;
    border-radius: 6px;
    flex-wrap: wrap;
    gap: 15px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 500;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.control-group select {
    padding: 8px 12px;
    border: 1px solid #475569;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.9rem;
    min-width: 160px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.control-group select:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.btn-refresh {
    padding: 8px 20px;
    background: #d97706;
    color: #0f172a;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-refresh:hover {
    background: #f59e0b;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.update-info {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-left: 15px;
}

.update-info span {
    font-weight: 500;
    color: #0f172a;
    background: #fbbf24;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    border-radius: 4px;
}

/* CONTENIDO PRINCIPAL - 2 COLUMNAS */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 25px;
    margin-bottom: 30px;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* TABLAS GENERALES */
.table-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #92400e, #d97706);
    color: #0f172a;
    padding: 12px 15px;
    border-bottom: 1px solid #334155;
}

.table-header h3 {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    background: rgba(15, 23, 42, 0.15);
    padding: 3px 10px;
    font-size: 0.7rem;
    border-radius: 10px;
    font-weight: 400;
}

.table-content {
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #334155;
}

th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #cbd5e1;
    font-size: 0.8rem;
    white-space: nowrap;
    border-bottom: 2px solid #475569;
}

td {
    padding: 10px 8px;
    font-size: 0.85rem;
    color: #e2e8f0;
    border-bottom: 1px solid #334155;
    font-family: 'Courier New', 'Consolas', monospace;
}

tbody tr:hover {
    background: #2d3748;
}

.latest-row {
    background-color: rgba(146, 64, 14, 0.2) !important;
}

.latest-row td:first-child {
    color: #fcd34d;
    font-weight: 500;
}

/* GRÁFICO CON TEMA OSCURO */
.chart-section {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 15px;
}

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

.chart-header h2 {
    color: #f8fafc;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-controls select {
    padding: 8px 12px;
    border: 1px solid #475569;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.9rem;
    min-width: 140px;
    border-radius: 4px;
    cursor: pointer;
}

.chart-container {
    width: 100%;
    height: 350px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 5px;
    margin-bottom: 10px;
}

#candleChart {
    width: 100% !important;
    height: 100% !important;
}

.chart-info {
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

.chart-info strong {
    color: #0f172a;
    background: #fbbf24;
    padding: 2px 8px;
    border-radius: 4px;
}

.chart-note {
    margin-top: 5px;
    font-style: italic;
    color: #64748b;
    font-size: 0.8rem;
}

/* ANÁLISIS TÉCNICO HORIZONTAL */
.analysis-section {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    overflow: hidden;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    padding: 12px 15px;
    border-bottom: 1px solid #334155;
}

.analysis-header h3 {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-content-horizontal {
    overflow-x: auto;
    padding: 10px;
    background: #0f172a;
}

#analysis-table-horizontal {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
}

#analysis-table-horizontal th {
    padding: 12px;
    background: #334155;
    text-align: center;
    font-weight: 600;
    color: #cbd5e1;
    border: 1px solid #475569;
    white-space: nowrap;
    min-width: 70px;
}

#analysis-table-horizontal td {
    padding: 12px;
    text-align: center;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.85rem;
    border: 1px solid #334155;
    min-width: 70px;
    background: #1e293b;
}

/* COLORES PARA PENDIENTES POSITIVAS Y NEGATIVAS - TEMA OSCURO */
.pendiente-positiva {
    background-color: rgba(34, 197, 94, 0.2) !important;
    color: #4ade80 !important;
    font-weight: 600;
    border: 1px solid rgba(34, 197, 94, 0.3) !important;
}

.pendiente-negativa {
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
    font-weight: 600;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.celda-destacada {
    background-color: rgba(251, 191, 36, 0.2) !important;
    font-weight: 600;
    color: #fde68a !important;
    border: 1px solid rgba(251, 191, 36, 0.3) !important;
}

.analysis-footer {
    padding: 12px 15px;
    background: #334155;
    border-top: 1px solid #475569;
    font-size: 0.75rem;
    color: #94a3b8;
}

.analysis-footer p {
    margin: 0;
}

.analysis-footer strong {
    color: #cbd5e1;
}

/* FOOTER MEJORADO */
footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #334155;
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    color: #94a3b8;
    font-size: 0.85rem;
}

.footer-content p {
    margin-bottom: 5px;
}

.footer-note {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.4;
}

.footer-note strong {
    color: #cbd5e1;
}

/* ESTADOS - TEMA OSCURO */
.loading, .error, .no-data {
    text-align: center;
    padding: 30px !important;
    font-style: italic;
    font-size: 0.9rem;
}

.loading {
    color: #94a3b8;
    background: rgba(30, 41, 59, 0.5);
}

.error {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.no-data {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.positive {
    color: #4ade80 !important;
    font-weight: 600;
}

.negative {
    color: #f87171 !important;
    font-weight: 600;
}

/* SCROLLBAR PERSONALIZADO */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
        width: 97%;
    }
    
    body {
        padding: 10px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .control-group {
        justify-content: space-between;
        width: 100%;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .analysis-content-horizontal {
        overflow-x: auto;
    }
    
    .control-group select {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
        width: 96%;
    }
    
    .chart-container {
        height: 220px;
    }
    
    .control-group select, .btn-refresh {
        width: 100%;
    }
    
    .table-header h3, .analysis-header h3, .chart-header h2 {
        font-size: 0.8rem;
    }
    
    .table-header, .analysis-header {
        padding: 10px 12px;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 0.75rem;
    }
}
