/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.last-updated {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Status groups */
.status-group {
    margin-bottom: 30px;
}

.group-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.endpoints-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Status cards */
.status-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.status-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #dee2e6;
    transition: all 0.2s ease;
    cursor: pointer;
}

.status-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.status-card.up {
    border-left-color: #28a745;
}

.status-card.down {
    border-left-color: #dc3545;
}

.status-card.unknown {
    border-left-color: #ffc107;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.endpoint-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-indicator.up {
    background-color: #d4edda;
    color: #155724;
}

.status-indicator.down {
    background-color: #f8d7da;
    color: #721c24;
}

.status-indicator.unknown {
    background-color: #fff3cd;
    color: #856404;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.up {
    background-color: #28a745;
}

.status-dot.down {
    background-color: #dc3545;
}

.status-dot.unknown {
    background-color: #ffc107;
}

/* Metrics */
.metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.metric {
    text-align: center;
}

.metric-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.uptime-value {
    color: #28a745;
}

.nines-value {
    color: #007bff;
}

/* Sparkline */
.sparkline-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.sparkline-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 8px;
}

.sparkline {
    height: 40px;
    width: 100%;
    background-color: #f8f9fa;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.sparkline-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #28a745;
    transition: all 0.3s ease;
}

/* Card footer */
.card-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    text-align: right;
}

.view-details {
    color: #007bff;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.status-card:hover .view-details {
    color: #0056b3;
}

/* Loading and error states */
.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 1.1rem;
}

.error-banner {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #dc3545;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .endpoints-grid {
        grid-template-columns: 1fr;
    }
    
    .metrics {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Animation for status changes */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.status-card.updating {
    animation: pulse 1s infinite;
}

/* Service Detail Page Styles */
.service-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.service-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.service-title {
    font-size: 2.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.service-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
}

.service-status.up {
    background-color: #d4edda;
    color: #155724;
}

.service-status.down {
    background-color: #f8d7da;
    color: #721c24;
}

.service-status.unknown {
    background-color: #fff3cd;
    color: #856404;
}

.service-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.metric-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.metric-card h3 {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card .value {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.metric-card .unit {
    font-size: 0.9rem;
    color: #6c757d;
}

.sparkline-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.sparkline-section h3 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 15px;
}

.detail-sparkline {
    height: 100px;
    width: 100%;
    background-color: #f8f9fa;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.detail-sparkline-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #28a745;
    transition: all 0.3s ease;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 20px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #0056b3;
}

.back-link::before {
    content: "←";
    font-size: 1.2rem;
}

/* Responsive adjustments for service detail */
@media (max-width: 768px) {
    .service-detail {
        padding: 15px;
    }
    
    .service-title {
        font-size: 2rem;
    }
    
    .service-metrics {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .metric-card .value {
        font-size: 1.5rem;
    }
}
