/* ========================================
   Status Page Styles
   ======================================== */

/* Status color tokens (scoped to page) */
.status-page {
    --st-green: #16a34a;
    --st-green-light: #4ade80;
    --st-green-indicator: #22c55e;
    --st-green-bg: #dcfce7;
    --st-green-text: #166534;
    --st-yellow: #ca8a04;
    --st-yellow-light: #facc15;
    --st-yellow-indicator: #eab308;
    --st-yellow-bg: #fef9c3;
    --st-yellow-text: #854d0e;
    --st-orange: #ea580c;
    --st-orange-light: #fb923c;
    --st-orange-indicator: #f97316;
    --st-orange-bg: #ffedd5;
    --st-orange-text: #9a3412;
    --st-red: #dc2626;
    --st-red-light: #f87171;
    --st-red-indicator: #ef4444;
    --st-red-bg: #fee2e2;
    --st-red-bg-light: #fecaca;
    --st-red-text: #991b1b;
    --st-blue: #2563eb;
    --st-blue-light: #60a5fa;
    --st-blue-indicator: #3b82f6;
    --st-blue-bg: #dbeafe;
    --st-blue-text: #1e40af;
    --st-gray: #6b7280;
}

.status-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.status-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    padding: 2rem;
}

.status-header-content {
    max-width: 900px;
    margin: 0 auto;
}

.status-header h1 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.status-header p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.back-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: var(--font-size-md);
}

.back-link:hover {
    text-decoration: underline;
}

/* Main Content */
.status-main {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.status-main section {
    margin-bottom: 3rem;
}

.status-main h2 {
    font-size: var(--font-size-xl-2xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Overall Status Banner */
.overall-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.overall-status-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.overall-status-text {
    font-size: var(--font-size-xl-2xl);
    font-weight: var(--font-weight-semibold);
}

/* Status Colors */
.status-green {
    background: color-mix(in srgb, var(--st-green) 10%, transparent);
    color: var(--st-green);
}
.status-green .overall-status-indicator { background: var(--st-green-indicator); }

.status-yellow {
    background: color-mix(in srgb, var(--st-yellow) 10%, transparent);
    color: var(--st-yellow);
}
.status-yellow .overall-status-indicator { background: var(--st-yellow-indicator); }

.status-orange {
    background: color-mix(in srgb, var(--st-orange) 10%, transparent);
    color: var(--st-orange);
}
.status-orange .overall-status-indicator { background: var(--st-orange-indicator); }

.status-red {
    background: color-mix(in srgb, var(--st-red) 10%, transparent);
    color: var(--st-red);
}
.status-red .overall-status-indicator { background: var(--st-red-indicator); }

.status-blue {
    background: color-mix(in srgb, var(--st-blue) 10%, transparent);
    color: var(--st-blue);
}
.status-blue .overall-status-indicator { background: var(--st-blue-indicator); }

.status-gray {
    background: color-mix(in srgb, var(--st-gray) 10%, transparent);
    color: var(--st-gray);
}
.status-gray .overall-status-indicator { background: var(--st-gray); }

/* Component List */
.component-group {
    margin-bottom: 1.5rem;
}

.component-group-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.component-list {
    list-style: none;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.component-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-primary);
}

.component-item:last-child {
    border-bottom: none;
}

.component-name {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

/* Health Check Indicator */
.health-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding-left: 1rem;
}

.health-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: background var(--transition-base);
}

.health-pulse.checking {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
}

[data-live-status="operational"] .health-pulse {
    background: var(--st-green-indicator);
}

[data-live-status="degraded"] .health-pulse {
    background: var(--st-yellow-indicator);
}

[data-live-status="partial_outage"] .health-pulse {
    background: var(--st-orange-indicator);
}

[data-live-status="major_outage"] .health-pulse {
    background: var(--st-red-indicator);
}

.health-info {
    display: flex;
    gap: 0.5rem;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.health-latency,
.health-next {
    min-width: 35px;
    text-align: right;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
}

.status-badge.status-green {
    background: var(--st-green-bg);
    color: var(--st-green-text);
}

.status-badge.status-yellow {
    background: var(--st-yellow-bg);
    color: var(--st-yellow-text);
}

.status-badge.status-orange {
    background: var(--st-orange-bg);
    color: var(--st-orange-text);
}

.status-badge.status-red {
    background: var(--st-red-bg);
    color: var(--st-red-text);
}

.status-badge.status-blue {
    background: var(--st-blue-bg);
    color: var(--st-blue-text);
}

/* Incident Cards */
.incident-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.incident-card.severity-yellow {
    border-left: 4px solid var(--st-yellow-indicator);
}

.incident-card.severity-orange {
    border-left: 4px solid var(--st-orange-indicator);
}

.incident-card.severity-red {
    border-left: 4px solid var(--st-red-indicator);
}

.incident-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.incident-severity,
.incident-status {
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
}

.incident-severity {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.incident-status {
    background: var(--accent-primary);
    color: var(--text-white);
}

.incident-card h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.5rem;
}

.incident-card h3 a {
    color: var(--text-primary);
    text-decoration: none;
}

.incident-card h3 a:hover {
    color: var(--accent-primary);
}

.incident-meta {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.incident-latest-update {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-primary);
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

/* Maintenance Cards */
.maintenance-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-left: 4px solid var(--st-blue-indicator);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.maintenance-card h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.5rem;
}

.maintenance-card h3 a {
    color: var(--text-primary);
    text-decoration: none;
}

.maintenance-card h3 a:hover {
    color: var(--accent-primary);
}

.maintenance-time {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.maintenance-affected {
    font-size: var(--font-size-md);
    color: var(--text-tertiary);
    margin-top: 0.5rem;
}

/* Incident List */
.incident-list {
    list-style: none;
}

.incident-list-item {
    margin-bottom: 0.75rem;
}

.incident-list-item:last-child {
    margin-bottom: 0;
}

.incident-link {
    display: block;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.incident-link:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.incident-link:hover .incident-view-link {
    color: var(--accent-primary);
}

.incident-link-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.incident-severity-badge,
.incident-status-badge {
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
}

.incident-severity-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.incident-status-badge {
    background: var(--st-green-bg);
    color: var(--st-green-text);
}

.incident-link .incident-title {
    display: block;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-lg);
    margin-bottom: 0.5rem;
}

.incident-link-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

.incident-view-link {
    color: var(--text-tertiary);
    font-weight: var(--font-weight-medium);
    transition: color var(--transition-base);
}

/* History page incident list (simpler style) */
.history-month .incident-list-item a {
    display: block;
    padding: 1rem 0;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-primary);
}

.history-month .incident-list-item:last-child a {
    border-bottom: none;
}

.history-month .incident-list-item a:hover {
    color: var(--accent-primary);
}

.history-month .incident-list-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.history-month .incident-list-meta {
    display: flex;
    gap: 1rem;
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

.view-history-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--accent-primary);
    text-decoration: none;
}

.view-history-link:hover {
    text-decoration: underline;
}

/* Incident Detail Page */
.incident-detail {
    background: var(--bg-primary);
}

.incident-detail-header {
    margin-bottom: 2rem;
}

.incident-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.incident-badges .incident-severity,
.incident-badges .incident-status {
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-sm);
}

.incident-badges .status-active {
    background: var(--st-red-bg-light);
    color: var(--st-red-text);
}

.incident-badges .status-resolved {
    background: var(--st-green-bg);
    color: var(--st-green-text);
}

.severity-yellow {
    background: var(--st-yellow-bg) !important;
    color: var(--st-yellow-text) !important;
}

.severity-orange {
    background: var(--st-orange-bg) !important;
    color: var(--st-orange-text) !important;
}

.severity-red {
    background: var(--st-red-bg) !important;
    color: var(--st-red-text) !important;
}

.incident-detail-header h1 {
    font-size: var(--font-size-2xl-3xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.incident-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

.meta-item strong {
    color: var(--text-primary);
}

/* Timeline */
.incident-timeline {
    margin-top: 2rem;
}

.timeline {
    list-style: none;
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-primary);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 3px solid var(--accent-primary);
}

.timeline-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-time {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

.timeline-status {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    padding: 0.125rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.timeline-body {
    font-size: var(--font-size-md-lg);
    color: var(--text-primary);
}

/* History Page */
.history-month {
    margin-bottom: 2rem;
}

.history-month h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-primary);
    margin-bottom: 0.5rem;
}

.no-incidents,
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
}

/* Footer */
.status-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    padding: 1.5rem 2rem;
    text-align: center;
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

.status-footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

.status-footer a:hover {
    text-decoration: underline;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .status-badge.status-green {
    background: color-mix(in srgb, var(--st-green-indicator) 20%, transparent);
    color: var(--st-green-light);
}

[data-theme="dark"] .status-badge.status-yellow {
    background: color-mix(in srgb, var(--st-yellow-indicator) 20%, transparent);
    color: var(--st-yellow-light);
}

[data-theme="dark"] .status-badge.status-orange {
    background: color-mix(in srgb, var(--st-orange-indicator) 20%, transparent);
    color: var(--st-orange-light);
}

[data-theme="dark"] .status-badge.status-red {
    background: color-mix(in srgb, var(--st-red-indicator) 20%, transparent);
    color: var(--st-red-light);
}

[data-theme="dark"] .status-badge.status-blue {
    background: color-mix(in srgb, var(--st-blue-indicator) 20%, transparent);
    color: var(--st-blue-light);
}

[data-theme="dark"] .severity-yellow {
    background: color-mix(in srgb, var(--st-yellow-indicator) 20%, transparent) !important;
    color: var(--st-yellow-light) !important;
}

[data-theme="dark"] .severity-orange {
    background: color-mix(in srgb, var(--st-orange-indicator) 20%, transparent) !important;
    color: var(--st-orange-light) !important;
}

[data-theme="dark"] .severity-red {
    background: color-mix(in srgb, var(--st-red-indicator) 20%, transparent) !important;
    color: var(--st-red-light) !important;
}

[data-theme="dark"] .incident-badges .status-active {
    background: color-mix(in srgb, var(--st-red-indicator) 20%, transparent);
    color: var(--st-red-light);
}

[data-theme="dark"] .incident-badges .status-resolved,
[data-theme="dark"] .incident-status-badge {
    background: color-mix(in srgb, var(--st-green-indicator) 20%, transparent);
    color: var(--st-green-light);
}

/* Uptime Section */
.uptime-section {
    margin-top: 2rem;
}

.uptime-components {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.uptime-component {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.uptime-component-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.uptime-component-name {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-lg);
    color: var(--text-primary);
}

.uptime-percent {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
}

.uptime-percent.sla-met {
    color: var(--st-green);
}

.uptime-percent.sla-missed {
    color: var(--st-red);
}

.uptime-sla-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.sla-period {
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.sla-target {
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    font-style: italic;
}

/* Uptime Grid (Calendar) */
.uptime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 10px);
    gap: 2px;
    justify-content: start;
}

.uptime-day {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.uptime-day:hover {
    transform: scale(1.5);
    z-index: 1;
}

/* Uptime Status Colors */
.uptime-operational {
    background: var(--st-green-indicator);
}

.uptime-degraded {
    background: var(--st-yellow-indicator);
}

.uptime-partial_outage {
    background: var(--st-orange-indicator);
}

.uptime-major_outage {
    background: var(--st-red-indicator);
}

.uptime-maintenance {
    background: var(--st-blue-indicator);
}

.uptime-unknown {
    background: var(--st-gray);
}

/* Uptime Grid Placeholder */
.uptime-grid-placeholder {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.loading-uptime {
    font-size: var(--font-size-md);
    color: var(--text-tertiary);
}

/* Uptime Tooltip */
.uptime-tooltip {
    position: absolute;
    z-index: var(--z-overlay);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    pointer-events: none;
    white-space: nowrap;
}

.uptime-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-primary);
}

/* Dark Mode Uptime */
[data-theme="dark"] .uptime-percent.sla-met {
    color: var(--st-green-light);
}

[data-theme="dark"] .uptime-percent.sla-missed {
    color: var(--st-red-light);
}

[data-theme="dark"] .uptime-tooltip {
    box-shadow: var(--shadow-md);
}

/* Responsive */
@media (max-width: 768px) {
    .status-header {
        padding: 1.5rem 1rem;
    }

    .status-main {
        padding: 1.5rem 1rem;
    }

    .incident-detail-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .timeline {
        padding-left: 1.5rem;
    }
}
