:root {
    /* Variabili semplici */
    --bg: #222; /* background */
    --text: #FFFFFF; /* testo principale */
    --text-muted: #E0E0E0; /* testo secondario */

    --link: #64b5f6; /* normale */
    --link-hover: #42a5f5; /* hover */
    --link-active: #1e88e5; /* active/focus */

    --success: #66bb6a; /* verde equilibrato */
    --error: #e57373; /* rosso armonizzato */

    --focus-ring: rgba(66, 165, 245, 0.4); /* blu trasparente */
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    font-size: 18px;
    height: 100vh;
    margin: 0;
}

#main {
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#main.visible {
    opacity: 1;
}

#loader {
    position: fixed; /* copre tutto lo schermo */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg); /* stesso colore del body */
    opacity: 1;
    transition: opacity 0.5s ease;
    z-index: 9999;
}

#loader.hidden {
    opacity: 0;
}

#success.hidden,
#error.hidden {
    display: none;
}

h1 {
    font-size: 36px;
    font-weight: bold;
    margin: 0;
}

#error h1 {
    color: var(--error);
}

#error-message {
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1.5;
    margin: 10px 0;
}

h3 {
    font-size: 24px;
    margin: 20px 0 10px 0;
    color: var(--text-muted);
}

/* Link: no underline, niente ombre */
a {
    text-decoration: none;
    color: var(--link);
    font-weight: 500;
    transition: color .2s ease;
}

a:hover {
    color: var(--link-hover);
}

a:active {
    color: var(--link-active);
}

a:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Griglia servizi (due colonne uguali) */
.services-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.service-name {
    font-weight: 600;
    text-align: right;
    color: var(--text-muted);
}

#api-status,
#db-status {
    text-align: left;
}

/* Stati */
.status {
    color: var(--text);
}

.status-online {
    color: var(--success);
}

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

/* Sezioni versioni */
.version-section {
    margin: 10px 0;
}

.version-links {
    margin: 5px 0;
}

/* Loader */
.loader {
    width: 55px;
    aspect-ratio: 1;
    --g1: conic-gradient(from 90deg at 3px 3px, #0000 90deg, var(--text) 0);
    --g2: conic-gradient(from -90deg at 22px 22px, #0000 90deg, var(--text) 0);
    background: var(--g1), var(--g1), var(--g1), var(--g2), var(--g2), var(--g2);
    background-size: 25px 25px;
    background-repeat: no-repeat;
    animation: l7 1.5s infinite;
}

@keyframes l7 {
    0% {
        background-position: 0 0, 0 100%, 100% 100%
    }
    25% {
        background-position: 100% 0, 0 100%, 100% 100%
    }
    50% {
        background-position: 100% 0, 0 0, 100% 100%
    }
    75% {
        background-position: 100% 0, 0 0, 0 100%
    }
    100% {
        background-position: 100% 100%, 0 0, 0 100%
    }
}

/* Accessibilità: riduci animazioni se richiesto dal sistema */
@media (prefers-reduced-motion: reduce) {
    #main, #loader {
        transition: none;
    }

    .loader {
        animation: none;
    }
}
