/*
 * The public status page (views/status/index.php, plain layout): the banner with the overall state, the
 * components with a bar per day of the history, the platforms below the review import, and the incident lists.
 * A status is always written out as well; colour only repeats it.
 */

/* The plain layout centres error pages; this page starts at the top of its column. */
.status-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    width: 100%;
    padding-bottom: var(--space-10);
}

.status-header {
    display: flex;
    flex-direction: column;
    gap: var(--title-gap-lg);
}

/* Tone of a status: the banner icon, the bars of the history and the dots of the platforms. */
.status-tone-success {
    --status-tone-bg: var(--success-bg);
    --status-tone-border: var(--success-border);
    --status-tone-icon: var(--success-icon);
}

.status-tone-warning {
    --status-tone-bg: var(--warning-bg);
    --status-tone-border: var(--warning-border);
    --status-tone-icon: var(--warning-icon);
}

.status-tone-danger {
    --status-tone-bg: var(--danger-bg);
    --status-tone-border: var(--danger-border);
    --status-tone-icon: var(--danger-icon);
}

.status-tone-info {
    --status-tone-bg: var(--info-bg);
    --status-tone-border: var(--info-border);
    --status-tone-icon: var(--info-icon);
}

.status-tone-neutral {
    --status-tone-bg: var(--neutral-bg);
    --status-tone-border: var(--neutral-border);
    --status-tone-icon: var(--neutral-icon);
}

.status-banner {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    border-color: var(--status-tone-border);
}

.status-banner-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--status-tone-bg);
    color: var(--status-tone-icon);
    font-size: 19px;
}

.status-banner-text {
    min-width: 0;
}

.status-banner-title {
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: var(--leading-tight);
}

.status-banner-meta {
    margin-top: var(--title-gap-sm);
    color: var(--text-muted);
    font-size: var(--text-sm);
    text-wrap: pretty;
}

.status-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.status-section-title {
    font-size: var(--text-md);
    font-weight: 600;
}

/* Components */

.status-component {
    padding: var(--space-5);
    border-top: 1px solid var(--border-muted);
}

.status-component:first-child {
    border-top: 0;
}

.status-component-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.status-component-text {
    display: flex;
    flex-direction: column;
    gap: var(--title-gap-tight);
    min-width: 0;
}

.status-component-name {
    font-size: var(--text-base);
    font-weight: 600;
}

.status-component-desc {
    color: var(--text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
}

/* One bar per day, oldest first; every bar takes an equal share of the row. */
.status-history {
    display: flex;
    gap: 2px;
    height: 28px;
    margin-top: var(--space-4);
}

.status-day {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 2px;
    background: var(--border);
}

.status-day.is-operational {
    background: var(--success-solid);
}

.status-day.is-degraded {
    background: var(--warning-solid);
}

.status-day.is-outage {
    background: var(--danger-solid);
}

.status-day.is-maintenance {
    background: var(--info-solid);
}

.status-history-ends {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-1);
    color: var(--text-subtle);
    font-size: var(--text-xs);
}

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin: 0;
    padding: 0;
    color: var(--text-subtle);
    font-size: var(--text-xs);
    list-style: none;
}

.status-legend li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-legend .status-day {
    flex: none;
    width: 6px;
    height: 14px;
}

/* Platforms below the review import */

.status-platforms {
    margin-top: var(--space-4);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.status-platforms-summary {
    --disclosure-right: var(--space-4);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px var(--space-3);
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    padding-left: var(--space-4);
    border-radius: var(--radius);
    font-size: var(--text-sm);
}

.status-platforms-title {
    font-weight: 600;
}

.status-platforms-count {
    color: var(--text-muted);
}

.status-platform-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
    gap: var(--space-2) var(--space-6);
    margin: 0;
    padding: var(--space-3) var(--space-4) var(--space-4);
    border-top: 1px solid var(--border-muted);
    list-style: none;
}

.status-platform {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    font-size: var(--text-sm);
}

.status-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--success-solid);
}

.status-platform.is-degraded .status-dot {
    background: var(--warning-solid);
}

.status-platform.is-outage .status-dot {
    background: var(--danger-solid);
}

.status-platform.is-maintenance .status-dot {
    background: var(--info-solid);
}

.status-platform-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-platform-status {
    flex: none;
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.status-platform.is-degraded .status-platform-status {
    color: var(--warning);
}

.status-platform.is-outage .status-platform-status {
    color: var(--danger);
}

.status-platform.is-maintenance .status-platform-status {
    color: var(--info);
}

/* Incidents */

.status-incidents {
    margin: 0;
    padding: 0;
    list-style: none;
}

.status-incident {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-muted);
}

.status-incident:first-child {
    border-top: 0;
}

.status-incident-text {
    display: flex;
    flex-direction: column;
    gap: var(--title-gap-tight);
    min-width: 0;
}

.status-incident-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.status-incident-meta {
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.status-empty {
    padding: var(--space-5);
    color: var(--text-muted);
}

.status-note {
    color: var(--text-subtle);
    font-size: var(--text-xs);
}

@media (max-width: 640px) {
    .status-banner,
    .status-component {
        padding: var(--space-4);
    }

    .status-history {
        gap: 1px;
        height: 24px;
    }

    .status-day {
        border-radius: 1px;
    }

    .status-incident {
        align-items: flex-start;
        flex-direction: column;
        gap: var(--space-2);
        padding: var(--space-4);
    }
}
