/* ============================================================ *
 *  Dashboard cards (Material-flavored summary tiles)            *
 * ============================================================ */

.dashboard {
    padding: 1rem 0;
}

.dash-card {
    display: block;
    height: 100%;
    border-radius: 12px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
    overflow: hidden;
}

.dash-card:hover,
.dash-card:focus {
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18), 0 2px 4px rgba(0, 0, 0, .10);
    transform: translateY(-2px);
    color: var(--bs-body-color);
    border-color: var(--bs-primary-border-subtle);
}

.dash-card-inner {
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    gap: .75rem;
    height: 100%;
    padding: 1rem 1.1rem 1rem;
}

/* Header ----------------------------------------------------- */

.dash-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    padding-bottom: .6rem;
}

.dash-card-title {
    font-size: 1.05rem;
    line-height: 1.2;
}

.dash-card-updated {
    white-space: nowrap;
}

/* Occupancy ring (CSS conic gradient — no SVG/JS) ------------ */

.dash-card-occupancy {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .25rem 0;
}

/* Liquid-fill ring with a parking-lot metaphor: the rising fill is asphalt
   (tinted by --color, which JS sets green/amber/red by occupancy %) overlaid
   with diagonal yellow stripes that read as parking-bay markings from above.
   The empty area at the top is a soft sky/light wash. The stripes pan slowly
   so the card feels alive without distracting from the number. */
.occ-ring {
    --pct: 0;
    --size: 130px;
    --color: var(--bs-primary, #2196f3);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #f6f9fc 0%, #e8eef4 100%);
    border: 1px solid var(--bs-border-color);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}

.occ-ring::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--pct) * 1%);
    background-image:
        repeating-linear-gradient(
            -45deg,
            transparent 0,
            transparent 8px,
            rgba(255, 213, 79, 0.9) 8px,
            rgba(255, 213, 79, 0.9) 11px
        ),
        linear-gradient(180deg,
            var(--color) 0%,
            color-mix(in srgb, var(--color) 70%, #000) 100%);
    transition: height 600ms ease, background-image 600ms ease;
    animation: occ-stripes-pan 6s linear infinite;
}

@keyframes occ-stripes-pan {
    from { background-position: 0 0, 0 0; }
    to   { background-position: -22px 22px, 0 0; }
}

/* Thin specular highlight at the top of the rising fill — sells the
   "surface" feeling without being a literal water wave. */
.occ-ring::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(var(--pct) * 1%);
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.6) 50%,
        transparent 100%);
    transition: bottom 600ms ease;
    z-index: 1;
}

.occ-ring-text {
    position: relative;
    z-index: 2;
    text-align: center;
    line-height: 1.1;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(2px);
    padding: .35rem .65rem;
    border-radius: 999px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.occ-ring-pct {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bs-emphasis-color);
}

.occ-ring-sub {
    display: block;
    font-size: .75rem;
    color: var(--bs-secondary-color);
}

.occ-status {
    text-align: center;
}

/* KPI chip row ----------------------------------------------- */

.dash-card-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .35rem;
    padding-top: .25rem;
    border-top: 1px solid var(--bs-border-color-translucent);
}

.kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .55rem .25rem;
    border-radius: 8px;
    background: var(--bs-tertiary-bg);
    transition: background .15s ease;
}

.kpi i {
    font-size: 1.05rem;
    line-height: 1;
    margin-bottom: .15rem;
}

.kpi-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-emphasis-color);
    line-height: 1.1;
}

.kpi-label {
    font-size: .7rem;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: .03em;
    line-height: 1.1;
    margin-top: .05rem;
    text-align: center;
}

.kpi.is-alert {
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text-emphasis);
}
.kpi.is-warning {
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
}

/* Footer ----------------------------------------------------- */

.dash-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--bs-border-color-translucent);
    padding-top: .55rem;
    color: var(--bs-secondary-color);
}

.dash-card-footer i {
    transition: transform .15s ease;
}

.dash-card:hover .dash-card-footer i {
    transform: translateX(3px);
}

/* Loading / error overlays (kept from earlier phases) -------- */

.box-loading,
.box-error {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #6c757d;
    padding: .5rem;
}
.box-error {
    color: #dc3545;
}

/* Mobile: dashboard tile tweaks --------------------------------- */
@media (max-width: 575.98px) {
    .occ-ring {
        --size: 110px;
    }
    .occ-ring-pct {
        font-size: 1.4rem;
    }
    .dash-card-inner {
        padding: .85rem .9rem;
        gap: .6rem;
    }
    .kpi i {
        font-size: .95rem;
    }
    .kpi-value {
        font-size: .9rem;
    }
}
