/**
 * Price History Tab Styles
 * Styling for the price history feature in PC Builder
 *
 * Matches the existing builder UI design language
 */

/* ============================================
   MAIN CONTAINER
   ============================================ */

.parts-list__history {
    padding: clamp(1rem, 3vw, 1.5rem);
}

/* ============================================
   CONTROLS / PERIOD SELECTOR
   ============================================ */

.price-history__controls {
    margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}

.price-history__period-selector {
    display: inline-flex;
    gap: 0;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 4px;
}

.price-history__period-btn {
    min-height: 36px;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.price-history__period-btn:hover {
    color: var(--text-primary);
}

.price-history__period-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.price-history__period-btn--active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ============================================
   CHART CONTAINER
   ============================================ */

.price-history__chart-container {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
    min-height: 300px;
    position: relative;
}

.price-history__chart {
    height: clamp(280px, 45vh, 420px);
    width: 100%;
    position: relative;
}

.price-history__chart canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ============================================
   LOADING STATE
   ============================================ */

.price-history__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.price-history__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: price-history-spin 0.8s linear infinite;
}

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

/* ============================================
   ERROR STATE
   ============================================ */

.price-history__error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.price-history__error svg {
    width: 32px;
    height: 32px;
    color: var(--error);
    opacity: 0.8;
}

.price-history__error span {
    font-size: 0.9375rem;
}

.price-history__error .btn {
    margin-top: 0.5rem;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.price-history__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.price-history__empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.4;
}

.price-history__empty p {
    font-size: 0.9375rem;
    margin: 0;
}

/* ============================================
   PRICE EXPLANATION NOTICE
   ============================================ */

.price-history__notice {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-top: 0;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: clamp(0.75rem, 2vw, 0.8125rem);
    line-height: 1.5;
    color: var(--text-secondary);
}

.price-history__notice svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
    opacity: 0.7;
}

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

@media (max-width: 640px) {
    .price-history__period-selector {
        width: 100%;
        display: flex;
    }

    .price-history__period-btn {
        flex: 1;
        text-align: center;
    }

    .price-history__chart-container {
        padding: 0.75rem;
    }

    .price-history__chart {
        height: 260px;
    }

    .price-history__notice {
        padding: 0.75rem;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .price-history__spinner {
        animation: none;
    }

    .price-history__period-btn {
        transition: none;
    }
}
