* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #111223;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

header {
    background: #111223;
    color: white;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

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

.logo-drubbit {
    height: 40px;
    width: auto;
}

header h1 {
    font-size: 1.8em;
    font-weight: 600;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.last-update {
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: 400;
}

.btn-refresh {
    background: #EE595A;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
}

.btn-refresh:hover {
    background: #d94546;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(238, 89, 90, 0.3);
}

.btn-refresh:active {
    transform: translateY(0);
}

.btn-refresh.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-refresh.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.error-message {
    background: #fee;
    color: #EE595A;
    padding: 15px 40px;
    border-left: 4px solid #EE595A;
    margin: 20px 40px;
    border-radius: 4px;
    font-weight: 500;
}

/* Resumen totalizador */
.summary-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 30px 40px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.summary-card.highlight-card {
    background: linear-gradient(135deg, #FFF 0%, #FFF 100%);
    border: 2px solid #4054B2;
}

.summary-label {
    font-size: 0.85em;
    color: #666;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 1.8em;
    font-weight: 700;
    color: #4054B2;
}

.highlight-card .summary-value {
    color: #4054B2;;
}

/* Tabla */
.table-container {
    overflow-x: auto;
    padding: 20px 10px 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.89em;
}

thead {
    background: #111223;
    position: sticky;
    top: 0;
    z-index: 10;
}

thead th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: white;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    font-size: 0.85em;
    cursor: pointer;
    user-select: none;
    position: relative;
}

thead th.sortable:hover {
    background: #1a1d38;
}

thead th.number-col {
    text-align: right;
}

.sort-icon {
    display: inline-block;
    margin-left: 5px;
    opacity: 0.3;
}

thead th.sort-asc .sort-icon::after {
    content: '▲';
    opacity: 1;
    color: #EE595A;
}

thead th.sort-desc .sort-icon::after {
    content: '▼';
    opacity: 1;
    color: #EE595A;
}

tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody td {
    padding: 15px 12px;
    vertical-align: middle;
}

.logo-cell {
    width: 250px;
    padding: 10px !important;
}

.logo-img {
    width: 140px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.currency {
    font-weight: 500;
    color: #2d3748;
}

.positive {
    color: #48bb78;
    font-weight: 600;
}

.negative {
    color: #EE595A;
    font-weight: 600;
}

.highlight {
    background-color: #4054b229;;
    font-weight: 600;
}

.number-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

footer {
    background: #111223;
    padding: 20px 40px;
    text-align: center;
    color: #999;
    font-size: 0.9em;
    border-top: 1px solid #e9ecef;
}

/* Responsive */
@media (max-width: 1400px) {
    .logo-img {
        width: 180px;
        height: 40px;
    }
    
    .logo-cell {
        width: 180px;
    }
}

@media (max-width: 1200px) {
    .table-container {
        padding: 20px;
    }
    
    header {
        padding: 20px;
    }
    
    .summary-container {
        padding: 20px;
        gap: 15px;
    }
    
    thead th, tbody td {
        padding: 12px 8px;
        font-size: 0.85em;
    }
    
    .logo-img {
        width: 150px;
        height: 35px;
    }
    
    .logo-cell {
        width: 150px;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .header-controls {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .btn-refresh {
        width: 100%;
        justify-content: center;
    }
    
    .summary-container {
        grid-template-columns: repeat(2, 1fr);
        padding: 15px;
    }
    
    .summary-value {
        font-size: 1.4em;
    }
    
    table {
        font-size: 0.8em;
    }
    
    .logo-img {
        width: 100px;
        height: 30px;
    }
    
    .logo-cell {
        width: 100px;
    }
}

/* Animación de entrada */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

tbody tr {
    animation: fadeIn 0.3s ease;
}

/* Estilos para números grandes */
.big-number {
    font-size: 1.05em;
    font-weight: 700;
}

.small {
    font-size: 0.85em;
    margin-top: 2px;
}
