/* =========================================
   STILE GENERALE
========================================= */

body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background-color: #f8f9fa;
}

h1, h2, h3 {
    margin-bottom: 15px;
}

/* =========================================
   FORM
========================================= */

label {
    display: block;
    margin-top: 12px;
    font-weight: bold;
}

input,
textarea,
select {
    padding: 6px 10px;
    width: 100%;
    max-width: 400px;
    margin-top: 5px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

    /* Pulsanti generici */
    button,
    input[type=submit] {
        padding: 8px 14px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 14px;
    }

/* SOLO submit nei form principali */
form > input[type=submit] {
    margin-top: 15px;
    background-color: #0078d7;
    color: white;
}

    form > input[type=submit]:hover {
        background-color: #005a9e;
    }

/* =========================================
   TABELLE
========================================= */

table {
    border-collapse: collapse;
    width: 100%;
    max-width: 1100px;
    background-color: white;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

th {
    background-color: #f2f2f2;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* =========================================
   BOTTONI AZIONE
========================================= */

.actions-cell,
.actions {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

    .actions-cell input[type="submit"],
    .actions input[type="submit"] {
        background-color: #28a745;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        padding: 4px 8px;
        font-size: 13px;
    }

        .actions-cell input[type="submit"]:hover,
        .actions input[type="submit"]:hover {
            background-color: #218838;
        }

    .actions-cell a,
    .actions a {
        background-color: #dc3545;
        color: white;
        text-decoration: none;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 13px;
    }

        .actions-cell a:hover,
        .actions a:hover {
            background-color: #b02a37;
        }

/* =========================================
   MESSAGGI
========================================= */

.errore {
    color: red;
    font-weight: bold;
    margin-bottom: 15px;
}

.flash {
    padding: 10px;
    margin-bottom: 15px;
    font-weight: bold;
    border-radius: 4px;
}

.flash-success {
    background-color: #d4edda;
    color: #155724;
}

.flash-error {
    background-color: #f8d7da;
    color: #721c24;
}

/* =========================================
   HEADER / TOPBAR
========================================= */

.topbar {
    background-color: #0078d7;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.topbar-left {
    font-size: 16px;
    display: flex;
    align-items: center;
}

    .topbar-left span {
        font-weight: bold;
        font-size: 16px;
        margin-left: 8px;
    }

.topbar img.logo-topbar {
    height: 40px;
    max-width: 200px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-info {
    font-size: 12px;
    opacity: 0.8;
    white-space: nowrap;
}

    .user-info small {
        font-size: 11px;
        opacity: 0.7;
    }

.topbar a {
    color: white;
    text-decoration: none;
    margin-left: 8px;
    font-size: 14px;
}

    .topbar a:hover {
        text-decoration: underline;
        opacity: 0.9;
    }

.public-header {
    background-color: #0078d7;
    color: white;
    padding: 20px;
    text-align: center;
}

.container {
    max-width: 1100px;
    margin: 20px auto;
}

/* =========================================
   DASHBOARD TARIFFE / VISITE / UTENTI
========================================= */

.tr-nuovo {
    background-color: #f0fff0;
}

.tr-nuovo-header td {
    font-weight: bold;
    background-color: #dff0d8;
}

.msg-bloccato {
    color: #dc3545;
    font-weight: bold;
}

table input[type="text"],
table input[type="number"],
table input[type="date"],
table select {
    width: 100%;
    box-sizing: border-box;
    padding: 4px;
}

.totali-cell {
    padding: 6px 4px;
}

.totali-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

    .totali-row span:last-child {
        min-width: 80px;
        text-align: right;
        font-weight: bold;
    }

.totale-final {
    border-top: 1px solid #888;
    margin-top: 6px;
    padding: 6px;
    font-weight: bold;
    background-color: #dcdcdc;
    border-radius: 4px;
}

/* =========================================
   RESPONSIVE
========================================= */

@media screen and (max-width: 768px) {

    body {
        margin: 10px;
    }

    .table-wrapper {
        width: 100%;
        overflow-x: auto;
    }

    table {
        display: block;
        overflow-x: auto;
    }

    td, th {
        padding: 6px;
    }

        td.actions-cell,
        td.actions {
            display: flex;
            flex-wrap: nowrap;
            justify-content: flex-start;
            gap: 4px;
        }

    .topbar img.logo-topbar {
        height: 30px;
    }

    .topbar-right {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }
}

/* =========================================
   BOTTONI EXTRA
========================================= */

.btn-riepilogo {
    display: inline-block;
    padding: 12px 22px;
    background: #2c3e50;
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 6px;
    font-size: 16px;
}

    .btn-riepilogo:hover {
        background: #1f2d3a;
    }

/* =========================================
   FILTRI DASHBOARD
========================================= */

.filter-box {
    background: white;
    padding: 15px;
    margin: 15px auto;
    border-radius: 6px;
    border: 1px solid #ddd;
    max-width: 700px;
}

.filter-form {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

    .filter-item select {
        min-width: 120px;
    }

    .filter-item input[type=submit] {
        padding: 8px 16px;
    }

/* =========================================
   USER INFO RESPONSIVE
========================================= */

@media (max-width: 900px) {
    .user-info {
        display: none;
    }
}
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font: inherit;
    padding: 8px 10px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #2c3e50;
    min-width: 200px;
    box-shadow: 0px 4px 8px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 5px;
}

    .dropdown-content a {
        color: white;
        padding: 10px;
        display: block;
        text-decoration: none;
    }

        .dropdown-content a:hover {
            background-color: #34495e;
        }

/* Hover per mostrare il menu */
.dropdown:hover .dropdown-content {
    display: block;
}
/* =========================================
   AVVISI SCADENZA ABBONAMENTO
========================================= */

/* warning (entro 30 giorni) */
.renew-warning {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 6px;
    font-size: 12px;
    border-radius: 4px;
    background-color: #fff3cd;
    color: #856404;
}

/* urgente (entro 7 giorni) */
.renew-urgent {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 6px;
    font-size: 12px;
    border-radius: 4px;
    background-color: #f8d7da;
    color: #721c24;
    font-weight: bold;
}

/* scaduto */
.renew-expired {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 6px;
    font-size: 12px;
    border-radius: 4px;
    background-color: #dc3545;
    color: #fff;
    font-weight: bold;
}

    /* link dentro gli avvisi */
    .renew-warning a,
    .renew-urgent a,
    .renew-expired a {
        margin-left: 6px;
        text-decoration: underline;
        font-weight: bold;
    }

.renew-warning a {
    color: #856404;
}

.renew-urgent a {
    color: #721c24;
}

.renew-expired a {
    color: #fff;
}
.warning-renew {
    color: #d9534f;
    font-weight: bold;
}

.renew-box {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 15px;
    margin: 15px auto;
    width: 60%;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
}

.renew-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 15px;
    background: #28a745;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
}

    .renew-btn:hover {
        background: #218838;
    }