/* Pharmacy First national overview (/pharmacy-first) - page-specific styles,
   following the same per-page-stylesheet pattern as home.css/market-share.css.
   Colours/spacing reuse the tokens in _variables.scss (primary #0f79f3,
   secondary #796df6, radius 10px) rather than introducing new ones. */

/* ---------- Hero ---------- */

.pf-hero {
    position: relative;
    overflow: hidden;
    padding: 48px 40px;
    background: linear-gradient(135deg, #0f79f3 0%, #796df6 100%);
    color: #ffffff;
}

.pf-hero-shapes {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.pf-hero-shapes::before,
.pf-hero-shapes::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.pf-hero-shapes::before {
    width: 380px;
    height: 380px;
    top: -160px;
    right: -100px;
}

.pf-hero-shapes::after {
    width: 240px;
    height: 240px;
    bottom: -130px;
    left: -60px;
    background: rgba(255, 255, 255, 0.06);
}

.pf-hero-content {
    position: relative;
    z-index: 1;
}

.pf-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.pf-hero-title {
    margin-top: 18px;
    font-weight: 600;
    line-height: 1.2;
    /* The site's global `h1 { color: var(--bs-heading-color) }` rule (in
       style.css) applies directly to this element and otherwise overrides
       the white text this heading would inherit from .pf-hero's gradient
       background - inheritance always loses to a rule that targets the
       element itself. */
    color: #ffffff;
}

.pf-hero-subtitle {
    margin: 10px 0 0;
    max-width: 640px;
    font-size: 17px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.88);
}

.pf-hero-meta {
    margin: 16px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pf-hero-stats {
    position: relative;
    z-index: 1;
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 991.98px) {
    .pf-hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.pf-hero-stat-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
}

.pf-hero-stat-label {
    margin-top: 4px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.pf-hero-stat-badge {
    margin-top: 8px;
    display: inline-flex;
}

/* Trend badges keep their semantic colours on the gradient hero too, just
   with a translucent chip background instead of the light bg-opacity-10 used
   on white cards elsewhere. */
.pf-hero-stat-badge .bg-success,
.pf-hero-stat-badge .bg-danger,
.pf-hero-stat-badge .bg-primary {
    background-color: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}

.pf-hero-stat-badge .text-success,
.pf-hero-stat-badge .text-danger,
.pf-hero-stat-badge .text-primary {
    color: #ffffff !important;
}

/* ---------- Cards (bg-white panels) ----------
   The site's global dark-mode rules recolour text (p, h1-h6, .text-secondary,
   .text-dark) to light shades everywhere, on the assumption that containers
   use Bootstrap's .card class, which the site overrides to a dark background
   in [data-theme="dark"]. This page instead builds its panels with the
   bg-white/border-white utility combo (not .card), which the global rules
   don't touch - leaving light text sitting on a background that's still
   white. Every such panel on this page pairs bg-white with border-white, so
   that combination is targeted directly, keeping the fix local to this page
   rather than touching the global .bg-white utility. */

[data-theme="dark"] .bg-white.border-white {
    background-color: #1b232d !important;
    border-color: #1b232d !important;
}

/* ---------- Section rhythm ---------- */

.pf-section {
    margin-bottom: 40px;
}

.pf-section-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0f79f3;
    margin-bottom: 6px;
}

.pf-section-subtitle {
    color: #64748b;
    max-width: 720px;
    margin-bottom: 0;
}

[data-theme="dark"] .pf-section-subtitle {
    color: rgba(255, 255, 255, 0.68);
}

.pf-copy {
    color: #475569;
    max-width: 760px;
}

[data-theme="dark"] .pf-copy {
    color: rgba(255, 255, 255, 0.72);
}

/* Bootstrap ships 2/3/4/6/12-column tiers but no 5-up tier, needed for the
   5 distribution stat tiles (median/mean/p25/p75/p90) sitting side by side. */
@media (min-width: 992px) {
    .col-lg-2-4 {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

/* ---------- Stat tiles (distribution / key stats) ---------- */

.pf-stat-tile {
    height: 100%;
    padding: 18px 20px;
    border-radius: 10px;
    background: #f8fbff;
    border: 1px solid #eef2f7;
}

[data-theme="dark"] .pf-stat-tile {
    background: #172033;
    border-color: #2b3648;
}

.pf-stat-tile-label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
}

[data-theme="dark"] .pf-stat-tile-label {
    color: rgba(255, 255, 255, 0.68);
}

.pf-stat-tile-value {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    color: #0f172a;
}

[data-theme="dark"] .pf-stat-tile-value {
    color: #f1f5f9;
}

.pf-stat-tile-footnote {
    margin-top: 4px;
    font-size: 12.5px;
    color: #94a3b8;
}

/* ---------- Chart cards ---------- */

.pf-chart-card {
    padding: 24px;
}

@media (max-width: 575.98px) {
    .pf-chart-card {
        padding: 16px;
    }
}

.pf-chart-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 0;
}

[data-theme="dark"] .pf-chart-subtitle {
    color: rgba(255, 255, 255, 0.68);
}

.pf-chart-canvas {
    margin-top: 8px;
}

.pf-narrative {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 8px;
    background: #f1f2fd;
    border-left: 3px solid #0f79f3;
    font-size: 14px;
    color: #334155;
}

[data-theme="dark"] .pf-narrative {
    background: rgba(15, 121, 243, 0.12);
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- Segmented metric toggle ---------- */

.pf-toggle {
    display: inline-flex;
    padding: 3px;
    border-radius: 8px;
    background: #f1f5f9;
    gap: 2px;
}

[data-theme="dark"] .pf-toggle {
    background: #172033;
}

.pf-toggle-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    color: #64748b;
    white-space: nowrap;
    cursor: pointer;
}

[data-theme="dark"] .pf-toggle-btn {
    color: rgba(255, 255, 255, 0.68);
}

.pf-toggle-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] .pf-toggle-btn.active {
    background: #293542;
    color: #f1f5f9;
}

/* ---------- ICB table ---------- */

/* Bootstrap's .table rule paints each cell with its own opaque
   background-color (--bs-table-bg, which resolves to --bs-body-bg - a light
   colour that's never redefined for this site's custom [data-theme="dark"]
   attribute, since that's normally Bootstrap's own [data-bs-theme="dark"]
   job). That per-cell background sits on top of the dark .bg-white.border-white
   card behind it, and plain cell text (e.g. the ICB name column, which carries
   no colour class of its own) falls back to --bs-table-color, which is black
   and never redefined for dark mode either - the same white-on-white problem
   as the cards above, just inverted and one layer deeper. Redefining the
   variables on .pf-table lets the dark card show through every cell with
   readable text on top. */
[data-theme="dark"] .pf-table {
    --bs-table-bg: transparent;
    --bs-table-color: #f1f5f9;
    --bs-table-border-color: rgba(255, 255, 255, 0.09);
}

.pf-table-search {
    max-width: 280px;
}

.pf-table th[data-sort-key] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.pf-table th[data-sort-key] .material-symbols-outlined {
    font-size: 16px;
    vertical-align: -3px;
    opacity: 0.35;
}

.pf-table th[data-sort-key].pf-sort-active .material-symbols-outlined {
    opacity: 1;
    color: #0f79f3;
}

.pf-table td,
.pf-table th {
    font-size: 13.5px;
}

.pf-pagination-btn {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 12.5px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.pf-pagination-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.pf-pagination-btn.active {
    background: #0f79f3;
    border-color: #0f79f3;
    color: #fff;
}

[data-theme="dark"] .pf-pagination-btn {
    background: #172033;
    border-color: #2b3648;
    color: rgba(255, 255, 255, 0.75);
}

.pf-table-empty {
    text-align: center;
    color: #94a3b8;
    padding: 24px 0;
}

/* ---------- Clinical pathways time explorer ---------- */

.pf-time-explorer-month {
    display: inline-block;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #0f172a;
}

[data-theme="dark"] .pf-time-explorer-month {
    color: #f1f5f9;
}

.pf-time-explorer-range-labels {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.pf-time-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

#pf-condition-slider {
    min-width: 120px;
}

#pf-condition-slider::-webkit-slider-thumb {
    background: #0f79f3;
}

#pf-condition-slider::-moz-range-thumb {
    background: #0f79f3;
    border: none;
}

#pf-condition-slider::-moz-range-progress {
    background: #0f79f3;
}

#pf-ums-sparkline,
#pf-referrals-sparkline {
    height: 32px;
    margin-top: 2px;
}

@media (max-width: 575.98px) {
    .pf-time-explorer-month {
        font-size: 17px;
    }
}

/* ---------- Methodology ---------- */

.pf-methodology summary {
    cursor: pointer;
    font-weight: 500;
    color: #0f172a;
    list-style: none;
}

.pf-methodology summary::-webkit-details-marker {
    display: none;
}

.pf-methodology summary::before {
    content: "add";
    font-family: "Material Symbols Outlined";
    margin-right: 8px;
    font-size: 18px;
    vertical-align: -4px;
    color: #0f79f3;
}

.pf-methodology[open] summary::before {
    content: "remove";
}

[data-theme="dark"] .pf-methodology summary {
    color: #f1f5f9;
}

.pf-methodology-body {
    margin-top: 12px;
    font-size: 13.5px;
    color: #475569;
}

[data-theme="dark"] .pf-methodology-body {
    color: rgba(255, 255, 255, 0.72);
}

.pf-methodology-body dt {
    font-weight: 500;
    color: #0f172a;
    margin-top: 10px;
}

[data-theme="dark"] .pf-methodology-body dt {
    color: #f1f5f9;
}

.pf-methodology-body dd {
    margin-bottom: 0;
}
