/* ============================================
   WIDGET DE HISTORIAL DE PRECIOS - MongoDB
   ============================================ */

.price-history-widget {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin: 24px 0;
    border: 1px solid #e5e7eb;
}

/* Header del widget */
.widget-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 16px;
}

.widget-title {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.widget-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Badges de precio */
.price-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-historical {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: white;
    animation: pulse-badge 2s ease-in-out infinite;
}

.badge-down {
    background: #10b981;
    color: white;
}

.badge-up {
    background: #ef4444;
    color: white;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
    }
}

/* Grid de estadísticas */
.price-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.stat-card {
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

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

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

/* Colores específicos por tipo de stat */
.stat-current {
    border-left: 4px solid #3b82f6;
}

.stat-min {
    border-left: 4px solid #10b981;
}

.stat-min .stat-value {
    color: #10b981;
}

.stat-max {
    border-left: 4px solid #ef4444;
}

.stat-max .stat-value {
    color: #ef4444;
}

.stat-avg {
    border-left: 4px solid #f59e0b;
}

.stat-avg .stat-value {
    color: #f59e0b;
}

/* Indicador de variación */
.price-variation {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

.price-variation.negative {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.price-variation.positive {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Contenedor del gráfico */
.chart-container {
    position: relative;
    height: 300px;
    margin: 24px 0;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

/* Footer del widget */
.widget-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.widget-footer small {
    color: #6b7280;
    font-size: 0.75rem;
}

/* Estado sin datos */
.price-history-widget.no-data {
    text-align: center;
    padding: 40px 24px;
}

.no-data-message svg {
    color: #9ca3af;
    margin: 0 auto 16px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-data-message h4 {
    color: #4b5563;
    margin: 16px 0 8px;
    font-size: 1.25rem;
}

.no-data-message p {
    color: #6b7280;
    margin: 8px 0;
}

.no-data-message code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #3b82f6;
}

/* Widget compacto para comparativas */
.compact-price-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin: 16px 0;
}

.current-price-big {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.current-price-big .price-badge {
    font-size: 0.7rem;
}

.price-range {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 16px;
}

.view-history-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-history-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Comparación de precios */
.mongodb-price-comparison {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mongodb-price-comparison h3 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 1.25rem;
}

.price-comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.price-comparison-table thead {
    background: #f3f4f6;
}

.price-comparison-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-comparison-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.price-comparison-table td code {
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #3b82f6;
    font-size: 0.875rem;
}

.price-comparison-table td.price strong {
    color: #10b981;
    font-size: 1.125rem;
}

.price-comparison-table .no-data {
    color: #9ca3af;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .price-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .widget-title {
        font-size: 1.25rem;
    }
    
    .current-price-big {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .price-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .price-history-widget {
        padding: 16px;
    }
}