/* ===== RESET ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
}

/* ===== SFONDO ===== */
.page-background {
    min-height: 100vh;
    background: url("images/f1.jpg") no-repeat center center fixed;
    background-size: cover;
}

/* ===== TOP BAR ===== */
.top-bar {
    background: rgba(0, 0, 0, 0.85);
    padding: 12px 0;
}

.nav {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav a:hover {
    background: #e10600;
}

.nav .logout {
    background: #555;
}

.nav .logout:hover {
    background: #c00000;
}

/* ===== CONTENUTO ===== */
.page-content {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

/* ===== FORM / BOX ===== */
.form-container {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
}

.form-container h2,
.form-container h3 {
    margin-bottom: 20px;
    text-align: center;
}

/* ===== INPUT ===== */
label {
    margin-top: 12px;
    display: block;
    font-weight: bold;
}

input,
select,
button {
    width: 100%;
    margin-top: 6px;
    padding: 10px;
    border-radius: 6px;
    border: none;
}

button {
    margin-top: 20px;
    background: #e10600;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

button:hover {
    background: #b00000;
}

/* ===== MESSAGGI ===== */
.success {
    color: lightgreen;
    margin-bottom: 15px;
    text-align: center;
}

.error {
    color: #ff8080;
    margin-bottom: 10px;
    text-align: center;
}

.dashboard-links {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

.dashboard-links li {
    margin: 12px 0;
    text-align: center;
}

.dashboard-links a {
    display: block;
    padding: 12px;
    background: #e10600;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
}

.dashboard-links a:hover {
    background: #b00000;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    color: white;
}

.ranking-table th,
.ranking-table td {
    padding: 10px;
    border-bottom: 1px solid #444;
    text-align: center;
}

.ranking-table th {
    background: #111;
}

.ranking-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}

.ranking-table button {
    background: #444;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.ranking-table button:hover {
    background: #666;
}

.dashboard-button {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 20px;
    background: #e10600;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
}


.dashboard-button:hover {
    background: #b00000;
}

/* wrapper tabella */
.table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
}

/* tabella previsioni */
.predictions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8px;
}

/* intestazioni */
.predictions-table th {
    text-align: left;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 10px;
    white-space: nowrap;
}

/* celle */
.predictions-table td {
    padding: 10px;
    vertical-align: top;
    white-space: nowrap;
}

/* colonna utente */
.predictions-table .user-col {
    font-weight: bold;
    white-space: nowrap;
    width: 150px;
}

/* colonna top8 */
.predictions-table .top8-col {
    font-family: monospace;
    line-height: 1.4;
    width: 200px;
}

/* righe alternate */
.predictions-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.05);
}

.container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 30px;

    background: rgba(0, 0, 0, 0.85);
    /* overlay */
    border-radius: 12px;

    color: #f1f1f1;
    /* testo chiaro */
}

.container h1,
.container h2,
.container h3,
.container p,
.container label,
.container th,
.container td {
    color: #f1f1f1;
}

.predictions-table th {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* colonne compatte */
.predictions-table td,
.predictions-table th {
    font-size: 8px;
    white-space: nowrap;
}

/* top 8 verticale */
.predictions-table .top8-col {
    white-space: normal;
    font-family: monospace;
    line-height: 1.4;
    width: 180px;
}

/* colonne numeriche pi� strette */
.predictions-table td:nth-child(10),
.predictions-table td:nth-child(14),
.predictions-table td:nth-child(15) {
    text-align: center;
    width: 60px;
}

/* contenitore scrollabile */
.table-scroll {
    max-height: 65vh;
    /* altezza massima visibile */
    overflow-y: auto;
    overflow-x: auto;
    border-radius: 8px;
}

/* header fisso */
.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 10;

    background: rgba(20, 20, 20, 0.95);
    color: #ffffff;
}

/* evita sovrapposizioni */
.table-scroll table {
    border-collapse: separate;
    border-spacing: 0;
}

/* separatore header */
.table-scroll thead th {
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

/* scrollbar pi� discreta (WebKit) */
.table-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

.table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.form-section {
    margin-top: 30px;
    margin-bottom: 10px;
    font-size: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

.helper-text {
    font-size: 13px;
    color: #ccc;
    margin-bottom: 15px;
}

form label {
    margin-top: 12px;
    display: block;
}

form select,
form input {
    width: 100%;
}

/* testo leggibile nei campi */
form select,
form input {
    color: #f1f1f1;
    /* testo chiaro */
    background-color: rgba(0, 0, 0, 0.6);
}

/* option del select */
form select option {
    color: #000;
    /* menu a tendina leggibile */
    background-color: #fff;
}


/* stato iniziale */
select,
input {
    border: 2px solid #ccc;
    transition: border-color 0.2s, background-color 0.2s;
}

/* valido ? verde */
select:required:valid,
input:required:valid {
    border: 2px solid #4caf50;
    background-color: rgba(76, 175, 80, 0.15);
    color: #ffffff;
}

/* non valido ? rosso */
select:required:invalid,
input:required:invalid {
    border: 2px solid #ff4d4d;
    background-color: rgba(255, 77, 77, 0.15);
    color: #ffffff;
}

/* option disabilitata (top 8) */
select option.option-disabled,
select option:disabled {
    color: #999 !important;
    background-color: #e0e0e0 !important;
}

.form-error {
    background: rgba(255, 0, 0, 0.15);
    color: #ffdddd;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    text-align: center;
}

.table-wrapper {
    overflow-x: auto;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.6);
    color: #f1f1f1;
}

.score-table th,
.score-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.score-table th {
    background: rgba(0, 0, 0, 0.85);
    position: sticky;
    top: 0;
}

.score-table td.points {
    font-weight: bold;
    text-align: right;
}

.score-table td.points2 {
    font-weight: bold;
    text-align: left;
}

.total-score {
    margin-top: 15px;
    font-size: 18px;
    text-align: right;
}

.actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.multiplier-box {
    background: rgba(0, 0, 0, 0.65);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.multiplier-box h3 {
    margin-top: 0;
}

.multiplier-box ul {
    margin: 8px 0;
    padding-left: 18px;
}

.multiplier-summary {
    margin-top: 10px;
    font-size: 18px;
    font-weight: bold;
}

.form-success {
    background: rgba(0, 128, 0, 0.2);
    color: #ccffcc;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.form-warning {
    background: rgba(255, 165, 0, 0.2);
    color: #ffe0b3;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}


.wide-container {
    max-width: 2000px;
    /* o 1800px */
    margin: 0 auto;
    padding: 0 15px;
    background: rgba(0, 0, 0, 0.85);
    /* overlay */
    color: #f1f1f1;
    /* testo chiaro */
}

.results-box {
    border: 2px solid #ff1e1e;
    /* rosso F1 */
    border-radius: 12px;
    padding: 16px;
    margin: 25px 0;
    background: rgba(0, 0, 0, 0.75);

    box-shadow:
        0 0 0 2px rgba(0, 0, 0, 0.8),
        0 8px 20px rgba(0, 0, 0, 0.6);
}

.results-box h3 {
    margin-top: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 6px;
    color: #fff;
}

.grid-item {
    background: rgba(0, 0, 0, 0.7);
    margin-bottom: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.grid-pos {
    width: 28px;
    text-align: right;
    font-weight: bold;
    color: #ff1e1e;
}

.grid-name {
    flex: 1;
    text-align: center;
}

.grid-box {
    background: rgba(0, 0, 0, 0.75);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.grid-box h3 {
    margin-top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 6px;
}

.grid-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.grid-list li {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
}

.pos {
    width: 30px;
    text-align: right;
    font-weight: bold;
    color: #ff1e1e;
}

.driver {
    flex: 1;
}

.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .two-cols {
        grid-template-columns: 1fr;
    }
}

.delta {
    width: 60px;
    text-align: center;
    font-weight: bold;
}

.delta.pos {
    color: #3cff00;
    /* verde */
}

.delta.neg {
    color: #ff3b3b;
    /* rosso */
}

.delta.zero {
    color: #ffffff;
    /* bianco */
}

.submission-box {
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
}

.submission-line {
    margin: 15px 0 20px 0;
    padding: 10px 15px;
    background: rgba(0,0,0,0.6);
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.totals-box {
    margin: 20px 0 20px auto;
    padding: 15px 20px;
    background: rgba(0,0,0,0.6);
    border-radius: 8px;
    width: 270px;
}

.total-line {
    display: flex;
    justify-content: space-between;
    margin: 6px 0;
    font-size: 16px;
}

.total-label {
    flex: 1;
}

.total-value {
    width: 120px;        /* larghezza fissa */
    text-align: right;   /* allineamento a destra */
    font-weight: bold;
}

.info-box {
    margin: 30px 0;
    padding: 20px;
    background: rgba(0,0,0,0.6);
    border-radius: 8px;
    text-align: center;
}

.teams-list {
    margin-top: 25px;
}

.team-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0,0,0,0.6);
    border-radius: 8px;
}

.team-image img {
    width: 120px;
    height: auto;
    margin-right: 20px;
}

.team-info {
    display: flex;
    flex-direction: column;
}

.driver-name {
    font-size: 18px;
    font-weight: bold;
}

.team-name {
    font-size: 15px;
    opacity: 0.8;
}

