:root {
    --primary-color: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --maintenance-color: #6366f1;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.logo p {
    font-size: 14px;
    color: var(--text-secondary);
}

.admin-link {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.3s;
}

.admin-link:hover {
    background: #1d4ed8;
}

/* Status Banner */
.status-banner {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.status-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

.status-dot.operational {
    background: var(--success-color);
}

.status-dot.degraded {
    background: var(--warning-color);
}

.status-dot.down {
    background: var(--danger-color);
}

.status-dot.maintenance {
    background: var(--maintenance-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#statusText {
    font-size: 32px;
    font-weight: 700;
}

#statusDescription {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.uptime-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-color);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.uptime-value {
    color: var(--success-color);
    font-weight: 700;
}

/* Incidents Section */
.incidents-section {
    background: #fef2f2;
    border-left: 4px solid var(--danger-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.incidents-section h3 {
    font-size: 20px;
    margin-bottom: 15px;
}

.incident-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.incident-card:last-child {
    margin-bottom: 0;
}

.incident-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.incident-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.incident-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.incident-badge.critical {
    background: #fee2e2;
    color: #991b1b;
}

.incident-badge.major {
    background: #fef3c7;
    color: #92400e;
}

.incident-badge.minor {
    background: #dbeafe;
    color: #1e40af;
}

.incident-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

.incident-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Services Section */
.services-section {
    margin-bottom: 40px;
}

.services-section h3,
.history-section h3 {
    font-size: 24px;
    margin-bottom: 20px;
}

.services-list {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.service-item:hover {
    background: var(--bg-color);
    border-radius: 8px;
    padding-left: 15px;
    padding-right: 15px;
}

.service-item:last-child {
    border-bottom: none;
}

.service-info {
    flex: 1;
}

.service-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.expand-icon {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
    transition: transform 0.3s;
}

.service-type {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--bg-color);
    border-radius: 4px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.service-url {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Uptime Graph */
.uptime-graph {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.uptime-label {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.uptime-bars {
    display: flex;
    gap: 2px;
    flex: 1;
    height: 34px;
    align-items: flex-end;
}

.uptime-bar {
    flex: 1;
    min-width: 3px;
    height: 100%;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.2s;
}

.uptime-bar:hover {
    transform: scaleY(1.1);
}

.uptime-bar.operational {
    background: var(--success-color);
}

.uptime-bar.degraded {
    background: var(--warning-color);
}

.uptime-bar.down {
    background: var(--danger-color);
}

.uptime-bar.maintenance {
    background: var(--maintenance-color);
}

.uptime-bar.no-data {
    background: #e2e8f0;
    opacity: 0.5;
}

.service-status {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-label.operational {
    background: #d1fae5;
    color: #065f46;
}

.status-label.degraded {
    background: #fef3c7;
    color: #92400e;
}

.status-label.down {
    background: #fee2e2;
    color: #991b1b;
}

.status-label.maintenance {
    background: #e0e7ff;
    color: #3730a3;
}

.response-time {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Service Details (Expandable) */
.service-details {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 25px;
    margin: -10px 0 10px 0;
    border-left: 3px solid var(--primary-color);
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* Timeline Graph (20 minutes) */
.timeline-bars {
    display: flex;
    gap: 3px;
    height: 50px;
    align-items: flex-end;
    background: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.timeline-bar {
    flex: 1;
    min-width: 8px;
    height: 100%;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.2s;
}

.timeline-bar:hover {
    transform: scaleY(1.1);
}

.timeline-bar.operational {
    background: var(--success-color);
}

.timeline-bar.degraded {
    background: var(--warning-color);
}

.timeline-bar.down {
    background: var(--danger-color);
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 5px;
}

/* Response Time Chart */
.response-chart {
    display: flex;
    gap: 8px;
    height: 150px;
    align-items: flex-end;
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.response-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-width: 30px;
}

.response-bar {
    width: 100%;
    min-height: 5px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: auto;
}

.response-bar:hover {
    opacity: 0.8;
}

.response-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 5px;
    text-align: center;
}

.chart-legend {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-secondary);
    justify-content: center;
}

/* Response Time Line Chart */
.response-time-line-chart {
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.line-chart-container {
    position: relative;
    width: 100%;
}

.line-chart {
    width: 100%;
    height: 150px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: linear-gradient(to bottom, #f8fafc 0%, #ffffff 100%);
}

.chart-line {
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.chart-area {
    fill: #3b82f6;
    opacity: 0.1;
}

.chart-point {
    r: 2;
    transition: r 0.2s;
    cursor: pointer;
}

.chart-point:hover {
    r: 3;
}

.chart-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: absolute;
    right: -50px;
    top: 0;
    height: 150px;
    font-size: 11px;
    color: var(--text-secondary);
}

.axis-label {
    line-height: 1;
}

.chart-time-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Detail History Table */
.detail-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.detail-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 15px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    font-size: 13px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row:hover {
    background: var(--bg-color);
}

.detail-time {
    color: var(--text-secondary);
}

.detail-response {
    font-weight: 500;
    color: var(--text-primary);
}

.detail-error {
    cursor: help;
    color: var(--danger-color);
}

/* History Section */
.history-section {
    margin-bottom: 40px;
}

.history-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.time-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.time-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.time-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#historyChart {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 200px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.history-item:last-child {
    border-bottom: none;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
}

.last-updated {
    margin-top: 5px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .status-banner {
        padding: 25px;
    }

    #statusText {
        font-size: 24px;
    }

    .service-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .service-info {
        width: 100%;
    }
    
    .uptime-graph {
        width: 100%;
    }
    
    .uptime-bars {
        gap: 1px;
    }
    
    .uptime-bar {
        min-width: 2px;
    }

    .service-status {
        width: 100%;
        justify-content: space-between;
    }
    
    .detail-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .detail-section {
        margin-bottom: 20px;
    }
    
    .response-chart {
        gap: 4px;
        padding: 10px;
        height: 120px;
    }
    
    .timeline-bars {
        gap: 2px;
    }
    
    .line-chart {
        height: 120px;
    }
    
    .chart-axis {
        right: -45px;
        height: 120px;
    }

    .history-controls {
        flex-direction: column;
    }
}
