@import url("fonts.css");

:root {
    --bg-body: #071428;
    --bg-surface: #0f1f38;
    --bg-elevated: #152845;
    --bg-input: #0c182c;
    --border: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.22);
    --text: #eef3fa;
    --text-muted: rgba(238, 243, 250, 0.68);
    --text-label: rgba(238, 243, 250, 0.82);
    --accent: #4da3ff;
    --accent-hover: #79bbff;
    --accent-soft: rgba(77, 163, 255, 0.14);
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    --font-body: "Montserrat", system-ui, -apple-system, sans-serif;
    --font-heading: "Good Times", "Montserrat", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text);
    line-height: 1.6;
    background:
        radial-gradient(circle at top, rgba(77, 163, 255, 0.12), transparent 42%),
        linear-gradient(180deg, #0a1830 0%, var(--bg-body) 100%);
    background-color: var(--bg-body);
}

h1,
h2,
h3,
h4,
h5,
h6,
.titolo,
.modal-title,
.font-heading {
    font-family: var(--font-heading);
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1.25;
}

a {
    color: var(--accent);
}

.patina-index {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.box-index {
    width: min(100%, 520px);
    padding: 2rem;
    text-align: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.box-index h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.35rem, 4vw, 1.85rem);
    color: var(--text);
}

.box-index .subtitle,
.box-index p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.box-index img,
.logo-brand {
    display: block;
    width: min(100%, 220px);
    height: auto;
    margin: 0 auto 1.25rem;
}

label {
    display: inline-block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-label);
}

.input-pers,
select.input-pers,
select {
    width: 100%;
    max-width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.92rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-pers:focus,
select.input-pers:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-pers::placeholder {
    color: rgba(238, 243, 250, 0.35);
}

.btn-pers {
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(180deg, var(--accent-hover), var(--accent));
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.65rem 1.1rem;
    color: #04101f;
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    min-width: 150px;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.btn-pers:hover {
    filter: brightness(1.06);
}

.btn-pers:active {
    transform: translateY(1px);
}

.pagina {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

.titolo {
    font-size: clamp(1.4rem, 3vw, 2rem);
    width: 100%;
    text-align: center;
    padding: 1.25rem 0 1.75rem;
    color: var(--text);
}

.table-cont {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.table-cont > table,
.table-cont > form > table {
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    width: 100%;
}

.menu .btn-pers {
    border-radius: 0;
    min-width: 120px;
}

.menu .btn-pers:first-child {
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
}

.menu .btn-pers:last-child {
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
}

.table-pers td {
    padding: 0.85rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.table-pers tr:last-child td {
    border-bottom: none;
}

.table-pers tr:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.03);
}

.table-pers tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.06);
}

.table-pers label,
.table-cont label {
    color: var(--text-label);
}

.btn-config {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.palletta {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent);
}

.palletta-verde {
    background-color: var(--success);
}

.palletta-rossa {
    background-color: var(--danger);
}

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

.lampeggio {
    color: var(--danger);
}

.alert {
    border-radius: var(--radius-sm);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: #fde68a;
}

.db-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid var(--border);
}

.db-status .material-symbols-outlined {
    font-size: 1.25rem;
}

.db-status--ok {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.35);
    color: #a7f3d0;
}

.db-status--error {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.modal-content {
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
}

.modal-body,
.modal-footer {
    background: transparent;
}

.btn-close {
    filter: invert(1) grayscale(1);
    opacity: 0.72;
}

.text-error {
    color: var(--danger);
}

.section-lead {
    color: var(--text-muted);
    font-size: 0.92rem;
}

#config,
#monitor,
#helper {
    scroll-margin-top: 1.5rem;
    display: block;
}

@media (max-width: 768px) {
    .pagina {
        padding-inline: 1rem;
    }

    .menu {
        justify-content: stretch;
    }

    .menu .btn-pers {
        flex: 1 1 48%;
        border-radius: var(--radius-sm);
        margin-bottom: 0.5rem;
    }

    .box-index {
        padding: 1.5rem;
    }
}
