:root {
    /* CaseStacks Purple Theme */
    --color-primary: #635bff;
    --color-primary-hover: #4f46e5;
    --color-operational: #10b981;
    --color-degraded: #f59e0b;
    --color-down: #ef4444;
    --color-unknown: #6b7280;

    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --ring-color: rgba(17, 24, 39, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-card: #1e293b;
        --border-color: #334155;
        --text-primary: #f3f4f6;
        --text-secondary: #9ca3af;
        --ring-color: rgba(255, 255, 255, 0.1);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--color-primary);
}

.back-arrow {
    width: 1rem;
    height: 1rem;
    fill: currentColor;
    transition: transform 0.2s ease;
}

.back-link:hover .back-arrow {
    transform: translateX(-4px);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 4rem;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.025em;
}

@media (min-width: 640px) {
    h1 {
        font-size: 3.75rem;
    }
}

.gradient-text {
    background: linear-gradient(
        135deg,
        #4f46e5 0%,
        #7c3aed 15%,
        #a855f7 30%,
        #d946ef 45%,
        #ec4899 60%,
        #a855f7 75%,
        #7c3aed 90%,
        #4f46e5 100%
    );
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 4s ease-in-out infinite;
}

@media (prefers-color-scheme: dark) {
    .gradient-text {
        background: linear-gradient(
            135deg,
            #818cf8 0%,
            #a78bfa 15%,
            #c084fc 30%,
            #e879f9 45%,
            #f472b6 60%,
            #c084fc 75%,
            #a78bfa 90%,
            #818cf8 100%
        );
        background-size: 300% 300%;
        background-clip: text;
        -webkit-background-clip: text;
    }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    25% { background-position: 50% 50%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 50% 50%; }
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* Overall Status Card */
.overall-status {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    overflow: hidden;

    /* CaseStacks ring style - no shadows */
    box-shadow: 0 0 0 2px var(--ring-color);
}

/* Subtle purple glow effect for cards */
@media (prefers-color-scheme: dark) {
    .overall-status::before,
    section::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        padding: 2px;
        background: linear-gradient(135deg, #635bff30, transparent);
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask-composite: exclude;
        pointer-events: none;
    }
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-dot {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background-color: var(--color-unknown);
    animation: pulse 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.status-dot.operational {
    background-color: var(--color-operational);
    animation: none;
}

.status-dot.degraded {
    background-color: var(--color-degraded);
}

.status-dot.down {
    background-color: var(--color-down);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#overallText {
    font-size: 1.5rem;
    font-weight: 600;
}

.last-updated {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Sections */
section {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;

    /* CaseStacks ring style */
    box-shadow: 0 0 0 2px var(--ring-color);
}

.service-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.service {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px var(--ring-color);
}

.service:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 0 2px var(--color-primary);
}

.service-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.service-name {
    font-weight: 600;
    font-size: 1.125rem;
}

.service-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.service-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 180px;
}

.service-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.service-metrics {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-weight: 600;
    color: var(--text-primary);
    transition: transform 0.3s ease;
}

.service:hover .metric-value {
    transform: scale(1.05);
}

/* Uptime Chart */
.uptime-chart {
    display: grid;
    grid-template-columns: repeat(90, 1fr);
    gap: 2px;
    margin-bottom: 1rem;
}

.uptime-bar {
    height: 2.5rem;
    background-color: var(--color-operational);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.uptime-bar:hover {
    transform: scaleY(1.1);
}

.uptime-bar.degraded {
    background-color: var(--color-degraded);
}

.uptime-bar.down {
    background-color: var(--color-down);
}

.uptime-bar.no-data {
    background-color: var(--border-color);
}

.uptime-legend {
    display: flex;
    gap: 2rem;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-dot {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.legend-dot.operational {
    background-color: var(--color-operational);
}

.legend-dot.degraded {
    background-color: var(--color-degraded);
}

.legend-dot.down {
    background-color: var(--color-down);
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 3rem;
    padding: 2rem 0;
    font-size: 0.875rem;
}

.refresh-info {
    margin-top: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .overall-status {
        flex-direction: column;
        align-items: flex-start;
    }

    .service {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .service-status {
        min-width: auto;
    }

    .service-metrics {
        width: 100%;
        justify-content: space-between;
    }

    .uptime-chart {
        grid-template-columns: repeat(45, 1fr);
    }
}
