/* ============================================
   DESIGN SYSTEM - Dark Theme
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --bg-hover: #333333;

    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    --accent-primary: #00d4aa;
    --accent-secondary: #00b894;

    /* Status Colors */
    --status-operational: #00d4aa;
    --status-degraded: #fdcb6e;
    --status-partial: #e17055;
    --status-major: #d63031;
    --status-maintenance: #74b9ff;

    /* Borders */
    --border-color: #333333;
    --border-radius: 12px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-secondary);
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    flex: 1;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-xl) 0;
}

.header-content {
    display: inline-block;
}

.logo {
    display: block;
    height: 36px;
    width: auto;
    margin-bottom: var(--spacing-xs);
}

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

/* ============================================
   STATUS BANNER
   ============================================ */

.status-banner {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.status-banner.operational {
    border-color: var(--status-operational);
}

.status-banner.degraded {
    border-color: var(--status-degraded);
}

.status-banner.partial-outage {
    border-color: var(--status-partial);
}

.status-banner.major-outage {
    border-color: var(--status-major);
}

.status-banner-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.status-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-banner.operational .status-icon {
    background: rgba(0, 212, 170, 0.2);
    color: var(--status-operational);
}

.status-banner.degraded .status-icon {
    background: rgba(253, 203, 110, 0.2);
    color: var(--status-degraded);
}

.status-banner.partial-outage .status-icon,
.status-banner.major-outage .status-icon {
    background: rgba(214, 48, 49, 0.2);
    color: var(--status-major);
}

.status-icon svg {
    animation: pulse 2s ease-in-out infinite;
}

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

.status-text {
    flex: 1;
    min-width: 200px;
}

#statusTitle {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

#statusMessage {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.status-meta {
    margin-left: auto;
}

.last-updated {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* ============================================
   STATISTICS GRID
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.stat-operational .stat-value {
    color: var(--status-operational);
}

.stat-degraded .stat-value {
    color: var(--status-degraded);
}

.stat-down .stat-value {
    color: var(--status-major);
}

/* ============================================
   SECTIONS
   ============================================ */

.services-section,
.incidents-section {
    margin-bottom: var(--spacing-2xl);
}

.section-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
}

/* ============================================
   SERVICES LIST
   ============================================ */

.services-list {
    display: grid;
    gap: var(--spacing-md);
}

.service-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.service-card:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

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

.service-status-indicator.operational {
    background: var(--status-operational);
    box-shadow: 0 0 8px var(--status-operational);
}

.service-status-indicator.degraded {
    background: var(--status-degraded);
    box-shadow: 0 0 8px var(--status-degraded);
}

.service-status-indicator.partial-outage,
.service-status-indicator.major-outage {
    background: var(--status-major);
    box-shadow: 0 0 8px var(--status-major);
}

.service-status-indicator.maintenance {
    background: var(--status-maintenance);
    box-shadow: 0 0 8px var(--status-maintenance);
}

.service-info {
    flex: 1;
    min-width: 0;
}

.service-name {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin-bottom: 4px;
}

.service-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.service-category {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.service-status-text {
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-align: right;
    flex-shrink: 0;
}

.service-status-text.operational {
    color: var(--status-operational);
}

.service-status-text.degraded {
    color: var(--status-degraded);
}

.service-status-text.partial-outage,
.service-status-text.major-outage {
    color: var(--status-major);
}

.service-status-text.maintenance {
    color: var(--status-maintenance);
}

/* ============================================
   INCIDENTS LIST
   ============================================ */

.incidents-list {
    display: grid;
    gap: var(--spacing-md);
}

.incident-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
}

.incident-card.active {
    border-left: 4px solid var(--status-major);
}

.incident-card.resolved {
    border-left: 4px solid var(--status-operational);
}

.incident-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.incident-title {
    font-size: var(--font-size-md);
    font-weight: 600;
}

.incident-meta {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.incident-badge {
    font-size: var(--font-size-xs);
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.incident-badge.active {
    background: rgba(214, 48, 49, 0.2);
    color: var(--status-major);
}

.incident-badge.resolved {
    background: rgba(0, 212, 170, 0.2);
    color: var(--status-operational);
}

.incident-badge.high {
    background: rgba(214, 48, 49, 0.2);
    color: var(--status-major);
}

.incident-badge.medium {
    background: rgba(253, 203, 110, 0.2);
    color: var(--status-degraded);
}

.incident-badge.low {
    background: rgba(116, 185, 255, 0.2);
    color: var(--status-maintenance);
}

.incident-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.incident-timeline {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.incident-update {
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-md);
    border-left: 2px solid var(--border-color);
}

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

.incident-update-message {
    font-size: var(--font-size-sm);
    margin-bottom: 4px;
}

.incident-update-time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.no-incidents {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.no-incidents svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-spinner {
    text-align: center;
    padding: var(--spacing-xl);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto var(--spacing-md);
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-width: 800px;
    max-height: 90vh;
    margin: 5vh auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
}

.uptime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.uptime-card {
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: 8px;
    text-align: center;
}

.uptime-period {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-xs);
}

.uptime-percentage {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--status-operational);
}

.uptime-percentage.degraded {
    color: var(--status-degraded);
}

.uptime-percentage.poor {
    color: var(--status-major);
}

.uptime-details {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.health-history {
    margin-top: var(--spacing-lg);
}

.health-history h4 {
    font-size: var(--font-size-md);
    margin-bottom: var(--spacing-md);
}

.health-chart {
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: 8px;
    margin-bottom: var(--spacing-md);
}

.health-checks-list {
    max-height: 300px;
    overflow-y: auto;
}

.health-check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
}

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

.health-check-time {
    color: var(--text-muted);
}

.health-check-status {
    font-weight: 500;
}

.health-check-status.healthy {
    color: var(--status-operational);
}

.health-check-status.unhealthy {
    color: var(--status-major);
}

.health-check-response {
    color: var(--text-secondary);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    margin-top: auto;
    padding: var(--spacing-xl) 0;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    text-align: center;
}

.footer-content p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.separator {
    color: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: var(--spacing-md);
    }

    .header {
        margin-bottom: var(--spacing-lg);
        padding: var(--spacing-lg) 0;
    }

    .logo {
        font-size: var(--font-size-xl);
    }

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

    .status-meta {
        margin-left: 0;
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .service-card {
        flex-wrap: wrap;
    }

    .service-description {
        white-space: normal;
    }

    .modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }

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

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .uptime-grid {
        grid-template-columns: 1fr;
    }
}
