/*
 * PM-AJAY Hostel Component dashboard.
 *
 * Scoped under .phc so nothing here reaches the rest of the site.
 *
 * Built against the approved artwork: 1272px of content, which at a 1440px
 * viewport leaves the 84px gutters the design shows. That is deliberately
 * different from the Adarsh Gram and Grants-in-Aid dashboards (1304/68) —
 * this one is matched to its own image rather than to its siblings.
 *
 * Standalone: shares no stylesheet with either sibling, so any of the three
 * can change without regressing the others.
 */

.phc {
    --phc-blue:      #1a73e8;
    --phc-blue-dark: #1a5fb4;
    --phc-ink:       #202124;
    --phc-muted:     #5f6368;
    --phc-line:      #e4e7ec;
    --phc-track:     #e8eaed;
    --phc-hero-bg:   #eaf2fd;
    --phc-donut-rest:#dfe1e5;

    max-width: 1272px;
    margin: 0 auto;
    padding: 32px 0 56px;
    color: var(--phc-ink);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.phc *,
.phc *::before,
.phc *::after { box-sizing: border-box; }

/* ── Page header ─────────────────────────────────────────────────────────── */

/*
 * Title only. This design carries no Year control and no Reset — there is
 * nothing time-varying on the page for them to act on.
 */
.phc-masthead { margin-bottom: 28px; }

.phc-masthead h2.phc-title {
    margin: 0;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--phc-blue-dark);
    letter-spacing: -0.01em;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.phc-hero {
    display: grid;
    grid-template-columns: minmax(0, 480fr) minmax(0, 672fr);
    gap: 40px;
    align-items: center;
    background: var(--phc-hero-bg);
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 36px;
}

.phc-kpi-label {
    margin: 0 0 12px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3c4043;
}

.phc-kpi-value {
    font-size: 60px;
    line-height: 1;
    font-weight: 700;
    color: var(--phc-blue);
    letter-spacing: -0.02em;
    margin: 0 0 22px;
}

.phc-kpi-note {
    margin: 0 0 26px;
    font-size: 14px;
    color: #3c4043;
    max-width: 480px;
}

.phc-hero-meters {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/*
 * Metrics here are tight against the artwork: a meter measures 83px, so the
 * two of them plus the 15px gap fill the hero's 255px between its 40px
 * paddings. Loosening any of the three gaps below pushes the hero taller than
 * the design.
 */
.phc-meter {
    background: #fff;
    border-radius: 8px;
    padding: 14px 18px 12px;
}

.phc-meter-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
}

.phc-meter-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--phc-ink);
}

.phc-meter-pct {
    font-size: 14px;
    font-weight: 700;
    color: var(--phc-blue);
}

.phc-meter-note {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--phc-muted);
}

/* ── Bars ────────────────────────────────────────────────────────────────── */

.phc-track {
    height: 7px;
    border-radius: 4px;
    background: var(--phc-track);
    overflow: hidden;
}

.phc-track > span {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--phc-blue);
}

.phc-hero .phc-kpi-note + .phc-track { background: #d9e4f7; }

/* ── Card shell ──────────────────────────────────────────────────────────── */

.phc-card {
    background: #fff;
    border: 1px solid var(--phc-line);
    border-radius: 10px;
    min-width: 0;
}

.phc-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 21px 22px 19px;
    border-bottom: 1px solid var(--phc-line);
}

.phc-card-head h3 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--phc-ink);
}

.phc-card-head p {
    margin: 0;
    font-size: 12.5px;
    color: var(--phc-muted);
}

/*
 * Download affordance — a bare glyph, no chrome. Inert while this is static.
 *
 * The selector carries .phc on purpose: Elementor's global kit styles bare
 * elements, and `.elementor-kit-N button` is a class plus an element, which
 * outranks a lone `.phc-dl` and would repaint this as a themed button with a
 * border, an 8px radius and 9px/16px padding.
 */
.phc button.phc-dl {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--phc-muted);
    cursor: pointer;
    line-height: 0;
}

.phc button.phc-dl:hover {
    color: var(--phc-blue);
    background: transparent;
}

.phc-card-body { padding: 30px 22px; }

.phc-card-foot {
    padding: 16px 22px 18px;
    border-top: 1px solid var(--phc-line);
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--phc-muted);
}

.phc-card-foot strong { color: #3c4043; font-weight: 700; }

/* ── Occupancy: doughnut beside the stat grid ────────────────────────────── */

/*
 * minmax(0, …) rather than a bare fr on the stat column.
 *
 * A plain `1fr` is `minmax(auto, 1fr)`, and that auto minimum resolves to the
 * track's min-content. The doughnut column is a fixed width so it is safe, but
 * the stat column holds long unbroken figures and the same floor applies —
 * capping the minimum at 0 keeps the split honest at every width.
 */
.phc-occ {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 30px;
    align-items: center;
}

.phc-chart {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 0 auto;
}

/* Chart.js writes width/height attributes onto the canvas; keep them contained. */
.phc-chart canvas { max-width: 100%; }

.phc-stats {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 24px;
    row-gap: 37px;
}

.phc-stat-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--phc-ink);
    line-height: 1.2;
    margin-bottom: 4px;
}

.phc-stat-key {
    font-size: 12.5px;
    color: var(--phc-muted);
}

/* ── API unavailable ─────────────────────────────────────────────────────── */

/*
 * Shown only when the summary endpoint has never been reached on this site —
 * a normal outage serves the last good figures instead, so this is rare.
 */
.phc-unavailable {
    padding: 18px 20px;
    border: 1px solid var(--phc-line);
    border-radius: 10px;
    background: #fafbfc;
    font-size: 13px;
    color: var(--phc-muted);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1000px) {
    .phc-hero { grid-template-columns: 1fr; gap: 30px; }
    .phc-occ  { grid-template-columns: 1fr; gap: 34px; }
}

@media (max-width: 782px) {
    .phc { padding: 20px 0 40px; }

    .phc-masthead h2.phc-title { font-size: 24px; }

    .phc-hero { padding: 28px 22px; }
    .phc-kpi-value { font-size: 44px; }

    .phc-stats { row-gap: 28px; column-gap: 16px; }
    .phc-stat-val { font-size: 19px; }
}

/* ── Print ───────────────────────────────────────────────────────────────── */

@media print {
    .phc-dl { display: none !important; }
    .phc-card { break-inside: avoid; }
}
