/**
 * Price Chart Responsive Styles
 *
 * All @media queries for price chart components
 *
 * @package PC_Kompas_Trends
 * @since 1.0.0
 */

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

/**
 * Tablet and larger (640px+)
 *
 * - Grid layout for stats (3 columns when space allows)
 * - Larger font sizes
 */
@media (min-width: 640px) {
    .pkt-price-chart__stats {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .pkt-price-chart__stat {
        padding: clamp(0.75rem, 1.5vw, 1.25rem);
    }
}

/**
 * Medium screens (768px+)
 *
 * - More generous spacing
 * - Enhanced layout for horizontal orientation
 */
@media (min-width: 768px) {
    .pkt-price-chart {
        padding: clamp(1.5rem, 2.5vw, 2rem);
        gap: clamp(1.5rem, 2.5vw, 2rem);
    }

    .pkt-price-chart__period-selector {
        gap: clamp(0.75rem, 1.5vw, 1rem);
    }

    .pkt-price-chart__stats {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

/**
 * Large screens (1024px+)
 *
 * - Optimal sizing for desktop displays
 * - More prominent chart display
 */
@media (min-width: 1024px) {
    .pkt-price-chart {
        padding: clamp(1.5rem, 2vw, 2.5rem);
        gap: clamp(1.5rem, 2vw, 2rem);
    }

    .pkt-price-chart__stats {
        grid-template-columns: repeat(3, 1fr);
        gap: clamp(1rem, 2vw, 1.5rem);
    }

    .pkt-price-chart__stat {
        padding: clamp(1rem, 1.5vw, 1.25rem);
    }
}

/* ============================================================================
   SLIDER RESPONSIVE - TOUCH DEVICES
   ============================================================================ */

/**
 * Touch device improvements
 * - Larger touch targets for mobile
 * - Responsive sizing
 */
@media (hover: none) and (pointer: coarse) {
    .chart-slider__handle {
        width: 22px;
        height: 32px;
    }

    .chart-slider__handle--left {
        left: -11px;
    }

    .chart-slider__track {
        height: 36px;
    }

    .chart-slider__handle-icon {
        width: 5px;
        height: 12px;
    }
}

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

@media (max-width: 768px) {
    .chart-slider__track {
        height: 32px;
    }

    .chart-slider__handle {
        width: 14px;
        height: 22px;
    }

    .chart-slider__handle--left {
        left: -7px;
    }

    .chart-slider__handle--right {
        right: -7px;
    }

    /* Smaller date labels on mobile - above handles */
    .chart-slider__handle-date {
        font-size: 0.45rem;
        padding: 1px 3px;
        margin-bottom: 2px;
    }

    /* Timeline labels under slider */
    .chart-slider__labels {
        font-size: 0.5rem;
        height: 14px;
    }

    /* Product detail page mobile */
    .price-history-mobile .chart-slider {
        margin-top: 0.5rem;
    }

    .price-history-mobile .chart-slider__track {
        height: 32px;
    }

    /* Hide some timeline labels on very small screens */
    .chart-slider__labels span:nth-child(2),
    .chart-slider__labels span:nth-child(4) {
        display: none;
    }
}

@media (max-width: 480px) {
    /* Even smaller for very small screens */
    .chart-slider__handle-date {
        font-size: 0.5rem;
        padding: 2px 3px;
    }

    .chart-slider__labels {
        font-size: 0.5rem;
    }

    /* Show only first and last labels */
    .chart-slider__labels span:not(:first-child):not(:last-child) {
        display: none;
    }
}

/**
 * Touch devices - always show dates during interaction
 * On touch there's no hover, so we rely on dragging state
 */
@media (hover: none) and (pointer: coarse) {
    /* Add extra padding for larger touch handles */
    .chart-slider {
        padding: 0 clamp(14px, 2.5vw, 18px);
    }

    /* Make handles bigger for touch */
    .chart-slider__handle {
        width: 20px;
        height: 30px;
    }

    .chart-slider__handle--left {
        left: -10px;
    }

    .chart-slider__handle--right {
        right: -10px;
    }

    /* Date labels positioned outside - visible during drag */
    .chart-slider__handle-date {
        font-size: 0.65rem;
        padding: 3px 6px;
    }

    /* Show date labels only during drag on touch devices */
    .chart-slider--dragging .chart-slider__handle-date {
        opacity: 1;
        visibility: visible;
    }

    /* Builder modal - smaller touch targets */
    .product-details-modal__price-history .chart-slider {
        padding: 0 12px;
    }

    .product-details-modal__price-history .chart-slider__handle {
        width: 16px;
        height: 24px;
    }

    .product-details-modal__price-history .chart-slider__handle--left {
        left: -8px;
    }

    .product-details-modal__price-history .chart-slider__handle--right {
        right: -8px;
    }
}
