/* =============================================================================
   Price Trends view (js/views/price-trends.js)
   Group dropdown in the top bar, 12M / 24M / 36M / All range buttons, the
   stack of per-RM charts and their "no prices" overlay.
   ============================================================================= */

/* Group selector, right of the month picker in the top bar. */
.price-trends__group-select {
    width: auto;
    min-width: 13rem;
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: var(--secondary-blue, #1F3D7C);
}

/* Range buttons: one segmented control, right side of the section header. */
.price-trends__ranges {
    display: inline-flex;
    flex: 0 0 auto;
    border: 1px solid var(--light-silver, #E3E4E9);
    border-radius: 6px;
    overflow: hidden;
}

.price-trends__range-btn {
    border: none;
    border-left: 1px solid var(--light-silver, #E3E4E9);
    background: #ffffff;
    color: var(--secondary-blue, #1F3D7C);
    font-family: 'Red Hat Display', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.price-trends__range-btn:first-child {
    border-left: none;
}

.price-trends__range-btn:hover {
    background: var(--pale-cyan, #EAF7FA);
}

.price-trends__range-btn--active,
.price-trends__range-btn--active:hover {
    background: var(--primary-blue, #0F9FC4);
    color: #ffffff;
}

.price-trends__range-btn:focus-visible {
    outline: 2px solid var(--primary-blue, #0F9FC4);
    outline-offset: -2px;
}

/* One chart per RM, stacked full width. The grid's gap replaces each chart
   container's own top margin. */
.price-trends__charts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
}

.price-trends__charts > .chart-container {
    margin-top: 0;
}

/* In the side-by-side PDF layout, keep "Last 12 months (Nov-25 to Oct-26),
   ₹/kg" on one line so the narrower chart wraps its title before it, not
   mid-date. Not applied on screen, where a very narrow phone must still wrap. */
.price-trends__charts--cols-2 .price-trends__chart-window,
.price-trends__charts--cols-3 .price-trends__chart-window {
    white-space: nowrap;
}

/* PDF capture only (PriceTrendsView.setPdfLayout): charts side by side so a
   group fits a landscape page. */
.price-trends__charts--cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.price-trends__charts--cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Overlay shown when an RM has no price in the selected range. */
.price-trends__empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate, #808FAD);
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.85);
}

/* [hidden] must win over the display:flex above. */
.price-trends__empty[hidden] {
    display: none;
}

@media (max-width: 767px) {
    /* On phones the top bar can't fit picker + dropdown + export + user menu on
       one line: let this view's filter area wrap (scoped with :has so other
       views' top bars are untouched) and give the dropdown its own line. */
    .header-filter:has(.price-trends__group-select) {
        flex-wrap: wrap;
        min-width: 0;
    }

    .price-trends__group-select {
        flex: 1 1 100%;
        min-width: 0;
        margin: 0.4rem 0 0;
    }
}
