/**
 * FlyRadar - Price History Styles
 * Modal, gráficos y componentes de historial de precios
 */

/* ======================================
   BOTÓN DE HISTORIAL EN TARJETAS
   ====================================== */

.price-history-btn {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    z-index: 10;
    transition: all 0.2s ease;
}

.price-history-btn:hover {
    background: rgba(249, 115, 22, 0.8);
    border-color: rgba(249, 115, 22, 0.5);
    transform: scale(1.1);
}

.price-history-btn.loading {
    pointer-events: none;
}

.price-history-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: #f97316;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ======================================
   MODAL PRINCIPAL
   ====================================== */

.price-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.price-modal.active {
    opacity: 1;
    visibility: visible;
}

.price-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.price-modal-content {
    position: relative;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    overflow-y: auto;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.price-modal.active .price-modal-content {
    transform: translateY(0) scale(1);
}

.price-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.price-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

/* ======================================
   HEADER DEL MODAL
   ====================================== */

.price-modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
}

.price-modal-title {
    font-family: 'Unbounded', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0;
}

.route-origin,
.route-dest {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.route-arrow {
    color: #64748b;
    font-size: 1.2rem;
}

.price-modal-subtitle {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0.5rem 0 0 0;
}

/* ======================================
   RECOMENDACIÓN
   ====================================== */

.price-recommendation {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.recommendation-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
}

.recommendation-badge.level-excellent {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.recommendation-badge.level-good {
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: #22d3ee;
}

.recommendation-badge.level-neutral {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #94a3b8;
}

.recommendation-badge.level-poor {
    background: rgba(249, 115, 22, 0.15);
    border: 1px solid rgba(249, 115, 22, 0.3);
    color: #f97316;
}

.recommendation-badge.level-bad {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.recommendation-emoji {
    font-size: 1.5rem;
}

.recommendation-score {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    max-width: 200px;
}

.score-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.score-fill.level-excellent { background: linear-gradient(90deg, #22c55e, #16a34a); }
.score-fill.level-good { background: linear-gradient(90deg, #22d3ee, #06b6d4); }
.score-fill.level-neutral { background: linear-gradient(90deg, #94a3b8, #64748b); }
.score-fill.level-poor { background: linear-gradient(90deg, #f97316, #ea580c); }
.score-fill.level-bad { background: linear-gradient(90deg, #ef4444, #dc2626); }

.score-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
    min-width: 50px;
}

/* ======================================
   GRÁFICO
   ====================================== */

.price-chart-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1rem;
    height: 280px;
    margin-bottom: 1.5rem;
}

#price-chart {
    width: 100% !important;
    height: 100% !important;
}

/* ======================================
   ESTADÍSTICAS
   ====================================== */

.price-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-family: 'Unbounded', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #f8fafc;
}

.stat-item:first-child .stat-value {
    color: #22c55e;
}

/* ======================================
   INSIGHTS
   ====================================== */

.price-insights,
.price-prediction {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.price-insights h4,
.price-prediction h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #f8fafc;
}

.insights-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.insights-list li {
    padding: 0.5rem 0;
    font-size: 0.85rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.insights-list li:last-child {
    border-bottom: none;
}

.insight-positive { color: #22c55e !important; }
.insight-negative { color: #ef4444 !important; }
.insight-warning { color: #f97316 !important; }
.insight-neutral { color: #94a3b8 !important; }
.insight-hot { 
    color: #ef4444 !important;
    font-weight: 600;
    animation: pulse-text 2s infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.price-prediction p {
    margin: 0;
    font-size: 0.9rem;
    color: #94a3b8;
    line-height: 1.6;
}

.price-prediction strong {
    color: #22d3ee;
    font-family: 'Unbounded', sans-serif;
}

.price-prediction small {
    display: block;
    margin-top: 0.5rem;
    color: #64748b;
}

/* ======================================
   TOAST NOTIFICACIONES
   ====================================== */

.price-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: #f8fafc;
    font-size: 0.9rem;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

.price-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.price-toast.error {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(30, 41, 59, 1));
}

/* ======================================
   INDICADOR INLINE EN TARJETAS
   ====================================== */

.price-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.price-indicator.good {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.price-indicator.neutral {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.price-indicator.poor {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.price-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

.price-indicator.good .price-indicator-dot { background: #22c55e; }
.price-indicator.neutral .price-indicator-dot { background: #94a3b8; }
.price-indicator.poor .price-indicator-dot { background: #f97316; }

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* ======================================
   RESPONSIVE
   ====================================== */

@media (max-width: 640px) {
    .price-modal-content {
        padding: 1rem;
        border-radius: 16px;
    }

    .price-modal-title {
        font-size: 1.25rem;
    }

    .price-recommendation {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .recommendation-badge {
        justify-content: center;
    }

    .recommendation-score {
        max-width: 100%;
    }

    .price-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .price-chart-container {
        height: 220px;
    }

    .stat-value {
        font-size: 1rem;
    }
}

/* ======================================
   BADGE INDICADOR MINI (en tarjeta)
   ====================================== */

.price-badge-mini {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.price-badge-mini.excellent {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.1));
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.price-badge-mini.good {
    background: rgba(34, 211, 238, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(34, 211, 238, 0.3);
}

.price-badge-mini.neutral {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

