/* =========================
   RESET
   ========================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family:
        Inter,
        "Segoe UI",
        Arial,
        sans-serif;

    background: #f1f5f9;
    color: #1e293b;
    line-height: 1.5;
}


/* =========================
   HEADER
   ========================= */

header {
    background: linear-gradient(
        135deg,
        #0f172a,
        #1e3a8a
    );

    color: white;
    text-align: center;

    padding: 38px 20px;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

header p {
    margin: 8px 0 0;
    color: #cbd5e1;
}


/* =========================
   CONTENUTO
   ========================= */

main {
    width: min(1100px, calc(100% - 32px));
    margin: 35px auto;
}

section {
    background: white;

    border-radius: 14px;

    padding: 28px;

    margin-bottom: 28px;

    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.06),
        0 8px 24px rgba(15, 23, 42, 0.05);
}

h2 {
    margin-top: 0;

    color: #0f172a;

    font-size: 1.5rem;
}

h3 {
    color: #1e293b;
}


/* =========================
   FORM
   ========================= */

form {
    width: 100%;
}

label {
    display: inline-block;

    margin-bottom: 5px;

    font-weight: 600;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;

    max-width: 430px;

    padding: 11px 12px;

    border: 1px solid #cbd5e1;
    border-radius: 8px;

    background: white;

    color: #1e293b;

    font-size: 1rem;

    outline: none;

    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2563eb;

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.12);
}

input:disabled {
    background: #e2e8f0;
    color: #64748b;
}

form p {
    margin: 0 0 18px;
}


/* =========================
   PULSANTI
   ========================= */

button {
    display: inline-block;

    border: 0;
    border-radius: 8px;

    padding: 10px 18px;

    background: #2563eb;
    color: white;

    font-size: 0.95rem;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.15s,
        transform 0.1s,
        box-shadow 0.15s;
}

button:hover {
    background: #1d4ed8;

    box-shadow:
        0 4px 12px rgba(37, 99, 235, 0.25);
}

button:active {
    transform: translateY(1px);
}


/* =========================
   LINK
   ========================= */

a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}


/* =========================
   LOGIN / REGISTRAZIONE
   ========================= */



body:has(form input[name="username"]) button {
    min-width: 110px;
}

.registrazione-box {
    margin-top: 30px;

    padding-top: 22px;

    border-top: 1px solid #e2e8f0;

    text-align: center;
}

.registrazione-box p {
    color: #64748b;
}

.registrazione-box a {
    display: inline-block;

    padding: 10px 18px;

    border: 1px solid #2563eb;
    border-radius: 8px;

    color: #2563eb;

    font-weight: 600;
}

.registrazione-box a:hover {
    background: #eff6ff;

    text-decoration: none;
}


/* =========================
   CARD
   ========================= */

.cards {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(230px, 1fr));

    gap: 20px;
}

.card {
    display: block;

    padding: 22px;

    background: white;

    border: 1px solid #e2e8f0;
    border-radius: 12px;

    color: #1e293b;

    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.05);

    transition:
        transform 0.15s,
        box-shadow 0.15s,
        border-color 0.15s;
}

.card:hover {
    transform: translateY(-3px);

    border-color: #93c5fd;

    box-shadow:
        0 8px 20px rgba(15, 23, 42, 0.10);

    text-decoration: none;
}

.card h3 {
    margin-top: 0;

    color: #2563eb;
}

.card p:last-child {
    margin-bottom: 0;
}


/* =========================
   TABELLE
   ========================= */

table {
    width: 100%;

    border-collapse: collapse;

    margin-top: 15px;

    background: white;

    border-radius: 10px;

    overflow: hidden;
}

th {
    background: #0f172a;
    color: white;

    text-align: left;

    padding: 12px;
}

td {
    padding: 12px;

    border-bottom: 1px solid #e2e8f0;

    vertical-align: middle;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

td button {
    padding: 7px 12px;
    font-size: 0.85rem;
}


/* =========================
   ADMIN
   ========================= */

table td:last-child {
    white-space: nowrap;
}

table td:last-child a {
    display: inline-block;

    padding: 7px 12px;

    background: #2563eb;
    color: white;

    border-radius: 7px;

    font-size: 0.85rem;

    text-decoration: none;
}

table td:last-child a:hover {
    background: #1d4ed8;
}

table td:last-child form {
    display: inline-block !important;
    width: auto;
}

table td:last-child form button {
    background: #dc2626;
}

table td:last-child form button:hover {
    background: #b91c1c;
}


/* =========================
   HR
   ========================= */

hr {
    border: 0;
    border-top: 1px solid #e2e8f0;

    margin: 28px 0;
}


/* =========================
   FOOTER
   ========================= */

footer {
    margin-top: 50px;

    padding: 25px;

    text-align: center;

    color: #64748b;
}


/* =========================
   SCROLLBAR
   ========================= */

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: #e2e8f0;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}


/* =========================
   SMARTPHONE
   ========================= */

@media (max-width: 700px) {

    header {
        padding: 28px 16px;
    }

    header h1 {
        font-size: 1.55rem;
    }

    main {
        width: calc(100% - 20px);
        margin: 20px auto;
    }

    section {
        padding: 20px;
    }

    input,
    select,
    textarea {
        max-width: 100%;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.85rem;
    }

    th,
    td {
        padding: 9px;
    }
}

.login-page {
    max-width: 480px;
    margin: 50px auto;
    padding: 0 20px;
}

.login-card {
    background: #ffffff;
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.10);
}

.login-card h2 {
    margin-top: 0;
    margin-bottom: 28px;
    text-align: center;
    font-size: 1.7rem;
    color: #0f172a;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    color: #334155;
}

.form-group input {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    background: #ffffff;
}

.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.registrazione-box {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.registrazione-box p {
    margin-top: 0;
    color: #64748b;
}

.btn-secondary {
    display: block;
    width: 100%;
    padding: 11px;
    border: 1px solid #2563eb;
    border-radius: 8px;
    color: #2563eb;
    background: white;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
}

.btn-secondary:hover {
    background: #eff6ff;
    text-decoration: none;
}

.message-error {
    margin-bottom: 20px;
    padding: 12px;
    border-radius: 8px;
    background: #fee2e2;
    color: #991b1b;
}

/* LOGIN */
.login-page {
    max-width: 480px;
}

/* PAGINA ADMIN */
.admin-page {
    width: min(1400px, calc(100% - 40px));
    max-width: 1400px;
}

/* =========================
   MENU AMMINISTRAZIONE
   ========================= */

.admin-nav {
    background: #0f172a;
    border-bottom: 1px solid #334155;
}

.admin-nav-content {
    width: min(1400px, calc(100% - 40px));
    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 58px;
}

.admin-nav-brand {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
}

.admin-nav-brand:hover {
    color: white;
    text-decoration: none;
}

.admin-nav-links {
    display: flex;
    align-items: center;
    gap: 5px;
}

.admin-nav-links > a,
.dropdown-button {
    padding: 10px 14px;

    border: 0;
    border-radius: 7px;

    background: transparent;
    color: #cbd5e1;

    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;

    text-decoration: none;
    cursor: pointer;
}

.admin-nav-links > a:hover,
.dropdown-button:hover,
.admin-nav-links > a.active {
    background: #1e293b;
    color: white;
    text-decoration: none;
}


/* DROPDOWN */

.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;

    position: absolute;
    right: 0;
    top: 100%;

    min-width: 190px;

    padding: 7px;

    background: white;

    border: 1px solid #e2e8f0;
    border-radius: 9px;

    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);

    z-index: 1000;
}

.dropdown-menu a {
    display: block;

    padding: 10px 12px;

    border-radius: 6px;

    color: #334155;
    text-decoration: none;
}

.dropdown-menu a:hover {
    background: #f1f5f9;
    color: #2563eb;
    text-decoration: none;
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
    display: block;
}


/* MOBILE */

@media (max-width: 700px) {

    .admin-nav-content {
        width: calc(100% - 20px);
        flex-direction: column;
        align-items: stretch;
        padding: 10px 0;
    }

    .admin-nav-brand {
        padding: 8px;
    }

    .admin-nav-links {
        flex-wrap: wrap;
    }

    .admin-nav-links > a,
    .dropdown-button {
        padding: 9px 10px;
    }

    .dropdown-menu {
        left: 0;
        right: auto;
    }
}