/**
 * Price Chart Controls Styles
 *
 * Period selector buttons and chart controls
 *
 * @package PC_Kompas_Trends
 * @since 1.0.0
 */

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

.pkt-price-chart__controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

.pkt-price-chart__period-selector {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    flex-wrap: wrap;
    width: 100%;
}

/**
 * Period Button Base Styles
 *
 * - Touch-friendly minimum height: 44px
 * - Fluid padding with clamp() for responsive sizing
 * - Smooth transitions for hover/active states
 */
.pkt-price-chart__period-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: clamp(0.5rem, 1vw, 0.75rem) clamp(0.75rem, 1.5vw, 1rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: clamp(0.875rem, 1.2vw, 1rem);
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
    flex-shrink: 0;
}

/**
 * Period Button Hover State
 *
 * - Slightly lighter background for visual feedback
 * - Border color change for focus indication
 */
.pkt-price-chart__period-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    color: var(--text-primary);
}

/**
 * Period Button Focus State
 *
 * - Visible outline for keyboard accessibility
 * - Uses accent color for high contrast
 */
.pkt-price-chart__period-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-color: var(--accent);
}

.pkt-price-chart__period-btn:focus:not(:focus-visible) {
    outline: none;
    border-color: var(--border-light);
}

/**
 * Period Button Active State
 *
 * - Accent background color to indicate selected period
 * - White text for contrast
 * - No border needed as background is already prominent
 */
.pkt-price-chart__period-btn--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 600;
}

.pkt-price-chart__period-btn--active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/**
 * Disabled state (if needed in future)
 */
.pkt-price-chart__period-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

/* ============================================================================
   DARK/LIGHT MODE SUPPORT FOR CONTROLS
   ============================================================================ */

.dark .pkt-price-chart__period-btn:hover,
html.dark .pkt-price-chart__period-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
}

/* ============================================================================
   HIGH CONTRAST MODE SUPPORT
   ============================================================================ */

@media (prefers-contrast: more) {
    .pkt-price-chart__period-btn {
        border-width: 2px;
    }
}

/* ============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================ */

/**
 * Reduced motion - disable transitions
 */
@media (prefers-reduced-motion: reduce) {
    .pkt-price-chart__period-btn {
        transition: none;
    }
}

/**
 * Focus visible - keyboard navigation
 */
.pkt-price-chart__period-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================================================
   SLIDER PERIOD BUTTONS
   ============================================================================ */

/**
 * Period buttons container below slider
 * - Centered buttons
 * - Consistent spacing
 */
.chart-slider__period-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ============================================================================
   BUILDER MODAL PRICE HISTORY CONTROLS
   ============================================================================ */

/* Price history header with toggle */
.product-details-modal__price-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Controls wrapper: checkbox + period buttons */
.product-details-modal__price-history-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.product-details-modal__price-history-header .price-history-toggle {
    display: flex;
    gap: 0.25rem;
}

.product-details-modal__price-history-header .price-history-toggle__btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color, #333);
    background: transparent;
    color: var(--text-secondary, #a0a0a0);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.product-details-modal__price-history-header .price-history-toggle__btn:hover {
    border-color: var(--accent, #d4a017);
    color: var(--accent, #d4a017);
}

.product-details-modal__price-history-header .price-history-toggle__btn.is-active {
    background: var(--accent, #d4a017);
    border-color: var(--accent, #d4a017);
    color: var(--bg-primary, #1a1a1a);
}

/* Supplier toggle in modal */
.price-history-toggle--supplier {
    margin-bottom: 0.5rem;
}

.price-history-toggle__checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary, #a0a0a0);
    cursor: pointer;
}

.price-history-toggle__checkbox input {
    width: 14px;
    height: 14px;
    accent-color: var(--accent, #d4a017);
}
