/* Price History Modal Styles - FuelMate Theme */

.price-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.price-modal.show {
    opacity: 1;
}

.price-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1100px;
    max-height: 90vh;
    background: var(--modal-bg, white);
    border-radius: 20px;
    box-shadow: var(--shadow-xl, 0 20px 60px rgba(0, 0, 0, 0.2));
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Modal Header */
.modal-header {
    background: linear-gradient(135deg, #FFB700 0%, #FFC933 100%);
    padding: 25px 30px;
    position: relative;
    color: white;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.fuel-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.modal-subtitle {
    margin-top: 8px;
    opacity: 0.9;
    font-size: 14px;
}

/* Modal Controls */
.modal-controls {
    padding: 20px 30px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.time-range-selector {
    display: flex;
    gap: 8px;
}

.range-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
}

.range-btn:hover {
    background: #f8f9fa;
}

.range-btn.active {
    background: #FFB700;
    color: white;
    border-color: #FFB700;
}

.fuel-type-selector {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: white;
}

/* Modal Body */
.modal-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface-elevated, #f8f9fa);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border, transparent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--text-primary, #333);
    margin: 8px 0;
}

.stat-value.current-price {
    color: var(--primary, #FFB700);
}

.stat-change {
    font-size: 14px;
    margin-top: 8px;
}

.stat-change .price-up {
    color: #ef4444;
}

.stat-change .price-down {
    color: #10b981;
}

.stat-subtitle {
    font-size: 11px;
    color: var(--text-tertiary, #999);
    margin-top: 4px;
}

/* Chart Container */
.chart-container {
    background: var(--surface-card, white);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    height: 300px;
    position: relative;
}

.chart-container canvas {
    max-height: 100%;
}

/* Insights Section */
.insights-section {
    margin-bottom: 30px;
}

.insights-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-primary, #333);
}

.insights-grid {
    display: grid;
    gap: 12px;
}

.insight-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--surface-elevated, #f8f9fa);
    border-left: 3px solid var(--text-secondary, #666);
}

.insight-card.positive {
    background: #f0fdf4;
    border-color: #10b981;
}

.insight-card.warning {
    background: #fef3c7;
    border-color: #f59e0b;
}

.insight-card.info {
    background: #eff6ff;
    border-color: #3b82f6;
}

.insight-card.tip {
    background: #fefce8;
    border-color: #eab308;
}

.insight-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.insight-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary, #333);
}

/* Best Days Section */
.best-days-section {
    margin-bottom: 30px;
}

.best-days-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-primary, #333);
}

.best-days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.day-card {
    background: var(--surface-elevated, #f8f9fa);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    position: relative;
    color: var(--text-primary, #333);
}

.day-card.best {
    background: linear-gradient(135deg, #FFB700 0%, #FFC933 100%);
    color: white;
}

.day-rank {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 11px;
    font-weight: bold;
    opacity: 0.7;
}

.day-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.day-price {
    font-size: 20px;
    font-weight: bold;
}

/* Comparison Section */
.comparison-section {
    margin-bottom: 30px;
}

.comparison-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-primary, #333);
}

.comparison-card {
    background: var(--surface-elevated, #f8f9fa);
    border-radius: 8px;
    padding: 20px;
}

.comparison-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.comparison-stat .label {
    font-size: 14px;
    color: var(--text-secondary, #666);
}

.comparison-stat .value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #333);
}

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

.comparison-stat .value.expensive {
    color: #ef4444;
}

/* Modal Footer */
.modal-footer {
    padding: 15px 30px;
    border-top: 1px solid var(--border, #f0f0f0);
    background: var(--surface-elevated, #f8f9fa);
}

.data-info {
    text-align: center;
    color: var(--text-secondary, #666);
    font-size: 12px;
}

/* Loading & Error States */
.loading, .no-data, .error {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary, #999);
    font-size: 14px;
}

.error {
    color: #ef4444;
}

/* Responsive Design */
@media (max-width: 768px) {
    .price-modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-title {
        font-size: 20px;
    }

    .modal-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .time-range-selector {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 8px;
    }

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

    .stat-value {
        font-size: 24px;
    }

    .chart-container {
        height: 250px;
    }

    .best-days-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .modal-body {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .range-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Animation for modal appearance */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.price-modal.show .price-modal-content {
    animation: slideIn 0.3s ease;
}

/* Scrollbar Styling */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}