/* Shared "Performance template" dashboard styles - introduced with the Performance.cshtml
   redesign and reused on subsequent Logistics dashboard-style pages (e.g. CyclicCountReport.cshtml).
   Page-specific styling (one-off ids, animations, etc.) should stay in that page's own
   @section Styles block rather than being added here. */

.performance-grid .card {
    border-radius: 12px;
    border: 1px solid var(--border-translucent);
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}

    .performance-grid .card:hover {
        box-shadow: rgba(0, 0, 0, 0.18) 0px 6px 16px 0px;
        transform: translateY(-2px);
    }

.performance-grid .card-header {
    border-bottom: 1px solid var(--border-translucent);
    font-weight: 600;
}

/* Icon badges (card headers, stat cards, footer bars) */
.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.icon-badge-sm {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    font-size: .85rem;
}

.performance-grid .card-header .icon-badge {
    margin-right: .5rem;
}

.icon-badge-primary {
    background: var(--primary-light-translucent);
    color: var(--primary);
}

.icon-badge-success {
    background: rgba(0,177,89,.12);
    color: var(--chart-category-four);
}

.icon-badge-purple {
    background: rgba(182,105,223,.15);
    color: var(--chart-category-five);
}

.icon-badge-warning {
    background: rgba(255,196,37,.18);
    color: #9c7a00;
}

/* Filter toolbar */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: stretch;
}

.filter-pill {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    border: 1px solid var(--border-translucent);
    border-radius: 10px;
    padding: .35rem .7rem;
    min-width: 140px;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .85;
}

    .filter-pill i {
        color: var(--primary);
        margin-right: .3rem;
    }

    .filter-pill select,
    .filter-pill input {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        font-weight: 600;
        font-size: .95rem;
        text-transform: none;
        letter-spacing: normal;
        color: var(--text);
    }

        .filter-pill select:focus,
        .filter-pill input:focus {
            outline: none;
            box-shadow: none;
        }

    .filter-pill span.d-block {
        font-size: .7rem;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

/* A <label class="filter-pill"> whose only children are a text node + <select> (Owner, Period)
   sits a little high next to a <div class="filter-pill"> pill that wraps a nested <label> + <input>
   (Between/And) - this brings the two constructions back onto the same baseline. */
label.filter-pill {
    padding-top: 11px;
}

/* Staff-only filter pills (e.g. the Owner selector) get a distinct highlight so it's obvious
   at a glance that this control isn't shown to clients. */
.filter-pill-staff {
    background: rgba(255,196,37,.18);
}

/* On narrow screens the Period pill takes the full row on its own, and the two date pills
   (Between/And) share the row below it 50/50, rather than each date pill getting its own row.
   Only applies within a .filter-toolbar that groups Period with the date pills - the sibling
   combinator targets the pills that follow it (Between/And) without needing to class them up. */
@media (max-width: 640px) {
    .filter-pill-period {
        flex: 1 1 100%;
    }

    .filter-pill-period ~ .filter-pill {
        flex: 1 1 0;
        min-width: 0;
    }

        .filter-pill-period ~ .filter-pill input {
            width: 100%;
        }
}

/* Summary stat row */
.stat-card-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    margin-bottom: .5rem;
}

@media (max-width: 1007px) {
    .stat-card-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stat-card-row {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: white;
    border: 1px solid var(--border-translucent);
    border-radius: 12px;
    padding: .85rem 1rem;
}

.stat-card-top {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
}

.stat-label {
    font-size: .78rem;
    opacity: .7;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-delta {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .8rem;
    font-weight: 600;
}

/* Progress bar breakdown (Outwards / Inwards / Fulfilment, etc.) */
.progress-list {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    margin-bottom: .75rem;
}

.progress-row-label {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    margin-bottom: .2rem;
}

.progress-track {
    background: var(--border-translucent);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
}

.kpi-footer-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--primary-light-translucent);
    border-radius: 10px;
    padding: .55rem .75rem;
}

.kpi-footer-stat {
    flex: 1;
}

.kpi-footer-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .7;
}

.kpi-footer-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    font-weight: 600;
    font-size: .85rem;
    border-radius: 999px;
    padding: .15rem .55rem;
}

.kpi-delta-up {
    color: var(--chart-category-four);
    background: rgba(0,177,89,.12);
}

.kpi-delta-down {
    color: var(--chart-category-two);
    background: rgba(255,113,91,.12);
}

.kpi-footer-bar .kpi-delta {
    flex-shrink: 0;
}

/* Collapsible section divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.25rem 0 .75rem;
    cursor: pointer;
    user-select: none;
    color: var(--primary);
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

    .section-divider::after {
        content: "";
        flex: 1 1 auto;
        border-top: 1px solid var(--border-translucent);
    }

    .section-divider .bi-chevron-down {
        transition: transform .2s ease;
    }

    .section-divider[aria-expanded="true"] .bi-chevron-down {
        transform: rotate(180deg);
    }
