/* Variables de colores empresariales */
:root {
    --primary-blue: #1e3a8a;
    --light-blue: #3b82f6;
    --accent-orange: #f97316;
    --bone-white: #faf7f0;
    --dark-gray: #374151;
    --light-gray: #f3f4f6;
    --border-color: #e5e7eb;
    --success-green: #10b981;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bone-white) 0%, #f8fafc 100%);
    color: var(--dark-gray);
    line-height: 1.4;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 100vw;
    margin: 0;
    padding: 10px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header para TV */
.tv-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--light-blue) 100%);
    color: white;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.company-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.company-logo i {
    color: var(--accent-orange);
    font-size: 1.5rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Cards */
.card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.card h2 {
    color: var(--primary-blue);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h2 i {
    color: var(--accent-orange);
}

/* Layout para TV */
.tv-layout {
    display: flex;
    gap: 1rem;
    flex: 1;
    height: calc(100vh - 80px);
    overflow: hidden;
}

.ranking-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tv-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
}

/* Panel de Control Compacto */
.control-panel-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compact-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.compact-card h3 {
    color: var(--primary-blue);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.compact-card h3 i {
    color: var(--accent-orange);
    font-size: 0.8rem;
}

.compact-card form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.compact-card form.vertical-form {
    flex-direction: column;
    align-items: stretch;
}

.input-button-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.compact-card input,
.compact-card select {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bone-white);
}

.compact-card button {
    padding: 0.5rem;
    font-size: 0.8rem;
    min-width: auto;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Botón de debug */
.debug-card {
    border: 2px solid #ef4444;
    background: #fef2f2;
}

.debug-card h3 {
    color: #dc2626;
}

.debug-card h3 i {
    color: #ef4444;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    width: 100%;
    padding: 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

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

/* Contenedor de herramientas */
.tools-buttons {
    display: flex;
    gap: 0.5rem;
}

.tools-buttons button {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.5rem;
}

/* Botón de exportar */
.btn-export {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-export:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

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

/* Botón de recalcular */
.btn-recalc {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-recalc:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

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

/* Botón toggle para herramientas */
.toggle-tools-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-tools-btn:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.toggle-tools-btn:active {
    transform: scale(1.05);
}

.toggle-tools-btn.active {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.toggle-tools-btn.active:hover {
    background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
}

.toggle-tools-btn.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    pointer-events: none;
}

/* Panel de herramientas con animación */
.tools-panel {
    animation-duration: 0.3s;
    animation-fill-mode: both;
}

/* Header de herramientas */
.tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tools-header h3 {
    margin: 0;
    flex: 1;
}

/* Botón de cerrar herramientas */
.close-tools-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.close-tools-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: scale(1.1);
}

.close-tools-btn:active {
    transform: scale(1.05);
}

.tools-panel.show {
    display: block !important;
    animation-name: slideInUp;
}

.tools-panel.hide {
    animation-name: slideOutDown;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

button {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--light-blue) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

button:active {
    transform: translateY(0);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--light-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Estilos eliminados del podio - ya no se usan */

/* Tabla de Ranking optimizada para TV con Rotación */

/* Indicador de Período */
.period-indicator {
    background: white;
    padding: 1rem;
    border-radius: 8px 8px 0 0;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    border-bottom: none;
}

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

.period-header h2 {
    color: var(--primary-blue);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.period-dots {
    display: flex;
    gap: 0.5rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--light-gray);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--accent-orange);
    transform: scale(1.2);
}

.dot:hover {
    background: var(--primary-blue);
}

.period-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--dark-gray);
}

.rotation-timer {
    color: var(--accent-orange);
    font-weight: 500;
}

/* Contenedor de Tablas */
.tables-container {
    position: relative;
    min-height: 400px;
}

.table-container {
    background: white;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    border-top: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease-in-out;
    display: flex;
    flex-direction: column;
}

.table-container.active {
    opacity: 1;
    transform: translateX(0);
    position: relative;
}

.table-container.slide-out-left {
    transform: translateX(-100%);
    opacity: 0;
}

.table-container.slide-in-right {
    transform: translateX(100%);
    opacity: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
    flex: 1;
}

thead {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--light-blue) 100%);
    color: white;
}

th {
    padding: 0.8rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

tbody tr:hover {
    background-color: var(--light-gray);
}

tbody tr:nth-child(odd) {
    background-color: var(--bone-white);
}

/* Destacar Top 3 en tabla */
.position-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    min-width: 35px;
    box-shadow: var(--shadow);
}

.position-1 { 
    background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 100%); 
    color: #92400e;
    border: 2px solid #f59e0b;
}
.position-2 { 
    background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 100%); 
    color: #374151;
    border: 2px solid #6b7280;
}
.position-3 { 
    background: linear-gradient(135deg, #fed7aa 0%, #fb923c 100%); 
    color: #9a3412;
    border: 2px solid #ea580c;
}
.position-other { 
    background: var(--light-gray); 
    color: var(--dark-gray);
    border: 1px solid var(--border-color);
}

/* Filas destacadas para top 3 */
tbody tr:nth-child(1) {
    background: linear-gradient(135deg, #fef3c7 0%, #fef7cd 100%) !important;
    border-left: 4px solid #f59e0b;
    font-weight: 600;
    transform: scale(1.02);
    box-shadow: var(--shadow);
    position: relative;
}

/* Medalla de oro y copa para el primer lugar */
tbody tr:nth-child(1) td:nth-child(2)::before {
    content: "🥇";
    font-size: 1.2rem;
    margin-right: 0.5rem;
    display: inline-block;
    animation: champion-glow 2s ease-in-out infinite alternate;
}

tbody tr:nth-child(1) td:nth-child(2)::after {
    content: "🏆";
    font-size: 1rem;
    margin-left: 0.5rem;
    display: inline-block;
    animation: golden-trophy 2s ease-in-out infinite;
}

@keyframes champion-glow {
    0% { filter: brightness(1) drop-shadow(0 0 5px gold); }
    100% { filter: brightness(1.2) drop-shadow(0 0 10px orange); }
}

@keyframes golden-trophy {
    0% { 
        transform: translateY(0px) scale(1);
        filter: brightness(1.1) saturate(1.3) drop-shadow(0 0 6px gold);
    }
    25% { 
        transform: translateY(-2px) scale(1.05);
        filter: brightness(1.2) saturate(1.4) drop-shadow(0 0 8px #ffd700);
    }
    50% { 
        transform: translateY(-3px) scale(1.1);
        filter: brightness(1.3) saturate(1.5) drop-shadow(0 0 10px #ffb347);
    }
    75% { 
        transform: translateY(-2px) scale(1.05);
        filter: brightness(1.2) saturate(1.4) drop-shadow(0 0 8px #ffd700);
    }
    100% { 
        transform: translateY(0px) scale(1);
        filter: brightness(1.1) saturate(1.3) drop-shadow(0 0 6px gold);
    }
}

tbody tr:nth-child(2) {
    background: linear-gradient(135deg, #f3f4f6 0%, #f9fafb 100%) !important;
    border-left: 4px solid #6b7280;
    font-weight: 500;
    transform: scale(1.01);
    position: relative;
}

/* Medalla de plata para el segundo lugar */
tbody tr:nth-child(2) td:nth-child(2)::before {
    content: "🥈";
    font-size: 1.1rem;
    margin-right: 0.5rem;
    display: inline-block;
    animation: silver-glow 2.5s ease-in-out infinite alternate;
}

@keyframes silver-glow {
    0% { filter: brightness(1) drop-shadow(0 0 3px silver); }
    100% { filter: brightness(1.15) drop-shadow(0 0 8px #c0c0c0); }
}

tbody tr:nth-child(3) {
    background: linear-gradient(135deg, #fed7aa 0%, #fedd9a 100%) !important;
    border-left: 4px solid #ea580c;
    font-weight: 500;
    transform: scale(1.01);
    position: relative;
}

/* Medalla de bronce para el tercer lugar */
tbody tr:nth-child(3) td:nth-child(2)::before {
    content: "🥉";
    font-size: 1.1rem;
    margin-right: 0.5rem;
    display: inline-block;
    animation: bronze-glow 3s ease-in-out infinite alternate;
}

@keyframes bronze-glow {
    0% { filter: brightness(1) drop-shadow(0 0 3px #cd7f32); }
    100% { filter: brightness(1.1) drop-shadow(0 0 6px #b8860b); }
}

tbody tr:nth-child(1) td:nth-child(2) {
    color: var(--primary-blue);
    font-weight: 700;
    font-size: 1.1rem;
}

tbody tr:nth-child(1) td:nth-child(3),
tbody tr:nth-child(2) td:nth-child(3),
tbody tr:nth-child(3) td:nth-child(3) {
    font-weight: 700;
    color: var(--accent-orange);
}

/* Estadísticas Compactas para TV */
.stats-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-item {
    background: white;
    padding: 0.8rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--light-blue) 100%);
    padding: 0.6rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    min-height: 35px;
}

.stat-icon i {
    font-size: 1rem;
    color: white;
}

.stat-data {
    flex: 1;
}

.stat-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-blue);
    line-height: 1;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--dark-gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Animaciones */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-pulse {
    animation: pulse 0.6s ease-in-out;
}

.animate-slide-in {
    animation: slideIn 0.5s ease-out;
}

/* === OPTIMIZACIÓN MÓVIL ESPECÍFICA === */

/* Tablets y pantallas medianas */
@media (max-width: 1200px) {
    .tv-layout {
        flex-direction: column;
        height: auto;
    }
    
    .tv-sidebar {
        width: 100%;
        flex-direction: row;
        gap: 1rem;
    }
    
    .control-panel-compact {
        flex: 1;
    }
    
    .stats-compact {
        flex-direction: row;
        gap: 1rem;
    }
    
    .stat-item {
        flex: 1;
        min-width: 0;
    }
}

/* === MODO MÓVIL OPTIMIZADO === */
@media (max-width: 768px) {
    /* Layout móvil específico */
    .container {
        padding: 10px;
        height: auto;
    }
    
    .tv-header {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .company-logo {
        font-size: 1.5rem;
    }
    
    .live-indicator {
        font-size: 1rem;
    }
    
    /* Layout móvil: Tabla arriba (prioridad), sidebar abajo */
    .tv-layout {
        flex-direction: column;
        gap: 1.5rem;
        height: auto;
    }
    
    .ranking-section {
        order: -1; /* Tabla al inicio - PRIORIDAD */
    }
    
    .tv-sidebar {
        order: 1; /* Sidebar al final */
        width: 100%;
        flex-direction: column;
    }
    
    /* Controles móviles más grandes */
    .compact-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .compact-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .compact-card input,
    .compact-card select {
        padding: 0.8rem;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    .compact-card button {
        padding: 0.8rem;
        font-size: 1rem;
        width: 50px;
        height: 50px;
    }
    
    /* Formulario móvil mejorado */
    .input-button-row {
        gap: 0.8rem;
    }
    
    /* Tabla móvil optimizada */
    .period-indicator {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .period-header h2 {
        font-size: 1.4rem;
    }
    
    .period-dots {
        gap: 0.8rem;
    }
    
    .dot {
        width: 12px;
        height: 12px;
    }
    
    .table-container {
        border-radius: 12px;
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.8rem 0.5rem;
    }
    
    /* Badges móviles más grandes */
    .position-badge {
        padding: 0.4rem 0.8rem;
        font-size: 1rem;
        min-width: 40px;
    }
    
    /* Estadísticas móviles */
    .stats-compact {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-item {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .stat-icon {
        min-width: 50px;
        min-height: 50px;
    }
    
    .stat-icon i {
        font-size: 1.4rem;
    }
    
    .stat-number {
        font-size: 1.4rem;
    }
    
    .stat-label {
        font-size: 0.9rem;
    }
    
    /* Toast móvil */
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
    
    /* Herramientas móviles */
    .tools-buttons {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .tools-buttons .btn-danger {
        grid-column: span 1;
    }
    
    .tools-buttons button {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    /* Botón toggle en móvil */
    .toggle-tools-btn {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .tv-header {
        padding: 0.8rem;
    }
    
    .company-logo {
        font-size: 1.3rem;
    }
    
    .compact-card {
        padding: 0.8rem;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 0.5rem 0.3rem;
    }
    
    .period-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    /* Ocultar columnas menos importantes en móviles muy pequeños */
    th:nth-child(4),
    td:nth-child(4),
    th:nth-child(5),
    td:nth-child(5) {
        display: none;
    }
}

/* Estados especiales */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--dark-gray);
    opacity: 0.7;
}

.empty-state i {
    font-size: 3rem;
    color: var(--accent-orange);
    margin-bottom: 1rem;
    display: block;
}

/* Efectos especiales para TV */
.tv-layout {
    animation: slideIn 0.8s ease-out;
}

.ranking-section {
    animation: slideIn 1s ease-out 0.2s both;
}

.tv-sidebar {
    animation: slideIn 1s ease-out 0.4s both;
}

/* === INDICADORES DE TENDENCIA === */
.trend-up {
    color: #10b981;
    font-weight: 600;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    animation: trend-bounce 0.6s ease-out;
}

.trend-down {
    color: #ef4444;
    font-weight: 600;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    animation: trend-bounce 0.6s ease-out;
}

.trend-same {
    color: #6b7280;
    font-weight: 500;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    opacity: 0.7;
}

/* Tendencias específicas para semanal/mensual */
.trend-up {
    animation: trend-bounce 0.6s ease-out;
}

.trend-down {
    animation: trend-bounce 0.6s ease-out;
}

/* Tendencias sin fondo - más limpias */
tbody tr .trend-up,
tbody tr .trend-down,
tbody tr .trend-same,
tbody tr .trend-new,
tbody tr .last-sale {
    display: inline-block;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    white-space: nowrap;
    font-weight: 500;
}

/* Estilo específico para última venta en tabla diaria */
.last-sale {
    color: #10b981 !important;
    font-size: 0.7rem !important;
    font-weight: 500;
    opacity: 0.9;
}

.trend-new {
    color: #3b82f6;
    font-weight: 600;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    animation: trend-new-pulse 1s ease-out;
}

@keyframes trend-bounce {
    0% { transform: scale(0) rotate(0deg); opacity: 0; }
    50% { transform: scale(1.3) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes trend-new-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* === TOAST NOTIFICATIONS === */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-left: 4px solid;
    min-width: 300px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
}

.toast-success {
    border-left-color: #10b981;
}

.toast-podium {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #ffffff 100%);
}

.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-hide {
    opacity: 0;
    transform: translateX(100%);
}

.toast-content {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.toast-message {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--dark-gray);
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--dark-gray);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: none;
    box-shadow: none;
}

/* Scroll suave para tabla larga */
.table-container {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-orange) var(--light-gray);
}

.table-container::-webkit-scrollbar {
    width: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--accent-orange);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue);
}

/* Sección de Sincronización */
.sync-section {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.sync-section h4 {
    color: var(--primary-blue);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sync-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.btn-sync {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    white-space: nowrap;
}

.btn-sync:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

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

.btn-sync-execute {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    white-space: nowrap;
}

.btn-sync-execute:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-sync-execute:active:not(:disabled) {
    transform: translateY(0);
}

.btn-sync-execute:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

.archivo-info {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem;
    font-size: 0.8rem;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.archivo-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 6px;
    margin-top: 0.5rem;
}

.archivo-info i {
    color: var(--success-green);
}

.btn-clear-sync {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
}

.btn-clear-sync:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    transform: scale(1.05);
}

.btn-clear-sync:active {
    transform: scale(0.95);
}

/* Responsive para sincronización */
@media (max-width: 768px) {
    .btn-sync, .btn-sync-execute {
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
    }
    
    .archivo-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .btn-clear-sync {
        align-self: flex-end;
    }
}
