/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 14px;
}

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

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 3px;
}

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

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

/* Overall Status */
.overall-status {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--success-color);
    transition: all 0.3s ease;
}

.overall-status.degraded {
    border-left-color: var(--warning-color);
}

.overall-status.down {
    border-left-color: var(--error-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--success-color);
    position: relative;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.status-icon.warning {
    background: var(--warning-color);
}

.status-icon.error {
    background: var(--error-color);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.status-text h2 {
    font-size: 1.1rem;
    margin-bottom: 3px;
}

.status-text p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Services Section */
.services {
    margin-bottom: 20px;
}

.services h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.service-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.service-group-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 15px 0 8px 0;
    margin-top: 8px;
    border-bottom: 2px solid var(--primary-color);
    grid-column: 1 / -1;
}

.service-group-header:first-child {
    margin-top: 0;
}

.service-item {
    background: var(--card-bg);
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.service-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.service-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    flex-shrink: 0;
}

.service-dot.warning {
    background: var(--warning-color);
}

.service-dot.error {
    background: var(--error-color);
}

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

.service-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #e8f5e9;
    color: var(--success-color);
    white-space: nowrap;
}

.status-badge.warning {
    background: #fff3e0;
    color: var(--warning-color);
}

.status-badge.error {
    background: #ffebee;
    color: var(--error-color);
}

.response-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Footer */
footer {
    text-align: center;
    padding: 15px 0;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    margin-top: 20px;
}

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

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    font-size: 1rem;
    margin: 0;
    color: var(--text-primary);
}

.modal-close {
    font-size: 1.8rem;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.test-logs {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

.test-log-item {
    padding: 4px 0;
    color: var(--text-primary);
}

.test-log-item.success {
    color: var(--success-color);
}

.test-log-item.error {
    color: var(--error-color);
}

.test-log-item.info {
    color: var(--primary-color);
}

.test-log-item.warning {
    color: var(--warning-color);
}

.test-log-item.result {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    background: rgba(76, 175, 80, 0.1);
    border-left: 4px solid var(--success-color);
}

.test-log-item.result.warning {
    background: rgba(255, 152, 0, 0.1);
    border-left-color: var(--warning-color);
}

.test-log-item.result.error {
    background: rgba(244, 67, 54, 0.1);
    border-left-color: var(--error-color);
}

.test-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #3a7bc8;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-test {
    padding: 4px 10px;
    font-size: 0.65rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
}

.btn-test:hover {
    background: #3a7bc8;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .service-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px 15px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 10px 0;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .overall-status {
        padding: 15px 20px;
    }

    .status-icon {
        width: 35px;
        height: 35px;
    }

    .status-text h2 {
        font-size: 1rem;
    }

    .service-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

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

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.2rem;
    }

    .status-text h2 {
        font-size: 0.95rem;
    }

    .service-name {
        font-size: 0.8rem;
    }
}
