@view-transition {
  navigation: auto;
}

:root {
    --color-passed: #4ade80;
    --color-failed: #f87171;
    --color-warning: #fbbf24;
    --color-recovering: #facc15;
    --color-unknown: #d1d5db;
    --color-bg: #f9fafb;
    --color-text: #1f2937;
    --color-header-bg: #1e3a8a;
    --color-header-text: #f9fafb;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, 
        Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
}

header {
    background-color: var(--color-header-bg);
    color: var(--color-header-text);
    padding: 1rem 2rem;
}

.header-link {
    color: var(--color-header-text);
    text-decoration: none;
}

.header-link:hover {
    text-decoration: underline;
}

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

h1, h2, h3, h4 {
    margin-bottom: 0.5rem;
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    margin-right: 0.5rem;
}

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

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

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

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

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

/* Services list */
.services-list {
    list-style: none;
    margin: 2rem 0;
}

.service {
    margin-bottom: 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.service-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
}

.service-header.passed {
    background-color: var(--color-passed);
}

.service-header.failed {
    background-color: var(--color-failed);
}

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

.service-header.recovering {
    background-color: var(--color-recovering);
}

.service-header.unknown {
    background-color: var(--color-unknown);
}

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

.service-link, .health-check-link {
    color: inherit;
    text-decoration: none;
}

.service-link:hover, .health-check-link:hover {
    text-decoration: underline;
}

.service-status {
    font-weight: 600;
}

/* Health checks */
.health-checks {
    list-style: none;
    padding: 1rem;
}

.health-check {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background-color: white;
    border: 1px solid #e5e7eb;
    min-height: 230px; /* Set minimum height to prevent resize during state changes */
}

.health-check:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.health-check.passed {
    border-left: 4px solid var(--color-passed);
}

.health-check.failed {
    border-left: 4px solid var(--color-failed);
}

.health-check.warning {
    border-left: 4px solid var(--color-warning);
}

.health-check.recovering {
    border-left: 4px solid var(--color-recovering);
}

.health-check.unknown {
    border-left: 4px solid var(--color-unknown);
}

.health-check-info {
    display: flex;
    flex-direction: column;
}

.health-check-id {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.health-check-data {
    font-size: 0.875rem;
    color: #4b5563;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 20rem;
}

.health-check-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.health-check-status {
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.health-check.passed .health-check-status {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-passed);
    border: 1px solid var(--color-passed);
}

.health-check.failed .health-check-status {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-failed);
    border: 1px solid var(--color-failed);
}

.health-check.warning .health-check-status {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
    border: 1px solid var(--color-warning);
}

.health-check.recovering .health-check-status {
    background-color: rgba(250, 204, 21, 0.1);
    color: var(--color-recovering);
    border: 1px solid var(--color-recovering);
}

.health-check.unknown .health-check-status {
    background-color: rgba(209, 213, 219, 0.1);
    color: var(--color-unknown);
    border: 1px solid var(--color-unknown);
}

/* Progress ring component */
.progress-container {
    position: relative;
    width: 60px;
    height: 60px;
    margin-left: 1rem;
}

.progress-ring {
    transform: rotate(-90deg);
    width: 60px;
    height: 60px;
}

.progress-ring-circle {
    fill: none;
    stroke-width: 4;
    r: 26;
    cx: 30;
    cy: 30;
    stroke-dasharray: 163.36;
    stroke-dashoffset: 163.36;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-ring-bg {
    stroke: #e5e7eb;
}

.progress-ring-progress {
    stroke: currentColor;
    stroke-linecap: round;
    opacity: 0.8;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: inherit;
}

/* Progress ring status indicators */
.status-processing {
    color: #2563eb;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

.status-due {
    color: #f59e0b;
    font-weight: bold;
}

.health-check-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
}

.check-action-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.run-check-button {
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-weight: 500;
}

.run-check-button:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.last-result-info {
    font-size: 0.875rem;
    color: #4b5563;
    margin-left: 1rem;
}

/* Styling for check result timestamp */
.check-result-info {
    font-size: 0.75rem;
    color: #6b7280;
    min-height: 1.2rem; /* Ensures the space is reserved even when empty */
    min-width: 5rem; /* Ensures a minimum width for consistency */
    flex: 1;
    display: flex;
    align-items: center;
}

/* Health check footer - ensure proper spacing */
.health-check-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.5rem;
}

.health-check-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

/* Toggle Control container */
.toggle-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f3f4f6;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
}

/* Toggle Switch styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 18px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #9ca3af;
    border-radius: 20px;
    transition: .4s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background-color: #ef4444;
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px #ef4444;
}

input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Toggle label */
.toggle-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #4b5563;
    white-space: nowrap;
}

/* Add visual indicator for disabled checks */
.health-check.disabled {
    opacity: 0.6;
    background-color: #f1f5f9;
}

/* Style for the 'No data yet' text */
.no-data-text {
    font-style: italic;
    color: #9ca3af;
}

.result-link {
    text-decoration: none;
    color: inherit;
}

.result-link:hover {
    text-decoration: underline;
}

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

/* Dashboard controls */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
}

.dashboard-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    text-decoration: none;
    font-weight: 600;
}

.service-btn {
    background-color: #93c5fd;
    color: #1e40af;
}

.check-btn {
    background-color: #a7f3d0;
    color: #065f46;
}

/* Messages */
.no-services-message,
.no-checks-message {
    padding: 2rem;
    text-align: center;
    background-color: var(--color-unknown);
    border-radius: 0.25rem;
    margin: 1rem 0;
}

.no-services-message p,
.no-checks-message p,
.empty-message p {
    margin-bottom: 1.5rem;
}

.empty-action {
    margin-top: 1.5rem;
}

/* Next check info styles */
.next-check-info {
    font-size: 0.75rem;
    text-align: right;
    color: #4b5563;
    min-width: 100px;
    background-color: #f9fafb;
    padding: 0.375rem;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
}

.next-check-time {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
    color: #1f2937;
}

.next-check-countdown {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 500;
}

.check-status {
    display: block;
    text-align: center;
    font-weight: 600;
}

/* Due check specific styles */
.check-due {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid #f59e0b;
}

.health-check .progress-ring-progress.due {
    stroke: #f87171 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .service-header,
    .health-check {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .service-status,
    .health-check-status {
        margin-top: 0.5rem;
    }
    
    .health-check-details {
        margin-top: 0.75rem;
        width: 100%;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .next-check-info {
        text-align: left;
    }
}