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

/* ================================
   BODY
================================ */
body {
    background-color: #f4f6f8;
    color: #333;
}

/* ================================
   MENUBAR (DESKTOP BASE)
================================ */
#menubar {
    width: 100%;
    height: 70px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* LOGO */
#logoImg {
    height: 45px;
    width: auto;
}

/* TITOLO */
#titolo {
    font-size: 24px;
    font-weight: 600;
    margin-left: 10px;
}

/* LINKS DESKTOP */
#links {
    display: flex;
    align-items: center;
    gap: 20px;
}

#links a {
    text-decoration: none;
    color: #444;
    font-size: 16px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transition: color 0.2s ease, background-color 0.2s ease;
}

#links a:hover {
    color: #0077ff;
}

/* AVATAR DESKTOP */
#userImage {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 5px;
}

/* ================================
   HAMBURGER
================================ */
#hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

#hamburger span {
    width: 26px;
    height: 3px;
    background-color: #333;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* ================================
   MOBILE
================================ */
@media (max-width: 768px) {

    #hamburger {
        display: flex;
    }

    #links {
        position: absolute;
        top: 70px;
        right: 0;
        width: 220px;
        background-color: #ffffff;
        flex-direction: column;
        align-items: stretch;
        padding: 6px 0;
        box-shadow: -2px 6px 14px rgba(0, 0, 0, 0.18);

        /* animazione */
        opacity: 0;
        transform: translateY(-10px);
        pointer-events: none;
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    #links.show {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    #links a {
        font-size: 15px;
        padding: 8px 16px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    #links a:hover {
        background-color: #f2f2f2;
    }

    /* avatar mobile */
    #userImage {
        width: 28px;
        height: 28px;
    }
}

/* ================================
   HAMBURGER → X
================================ */
#hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

#hamburger.open span:nth-child(2) {
    opacity: 0;
}

#hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}







/* pulsanti centrali */
/* ================================
   ACTION BUTTONS CONTAINER
================================ */
#actionContainer {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 60px;
    padding: 0 20px;
    flex-wrap: wrap;
}

/* ================================
   ACTION CARD
================================ */
.actionCard {
    width: 260px;
    height: 260px;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.actionCard:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

/* ================================
   ACTION IMAGE
================================ */
.actionCard img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 15px;
}

/* ================================
   ACTION TEXT
================================ */
.actionCard p {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* ================================
   MOBILE
================================ */
@media (max-width: 768px) {
    #actionContainer {
        gap: 25px;
        margin-top: 40px;
        flex-wrap: nowrap;  /*evita che i pulsanti vadano sotto */
    }

    .actionCard {
        width: 200px;
        height: 200px;
        border-radius: 16px;
    }

    .actionCard img {
        width: 90px;
        height: 90px;
    }

    .actionCard p {
        font-size: 16px;
    }
}




/* Spinning loading wheel */
/* LOADING OVERLAY */
#loadingOverlay {
    display: none; /* nascosto all’inizio */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    align-items: center;  /* centrare spinner */
    justify-content: center; /* centrare spinner */
    z-index: 9999;
    /* display: flex solo quando lo mostri tramite JS */
}


/* SPINNER */
.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #0077ff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* ================================
   LOGIN CONTAINER
================================ */
#loginContainer {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ================================
   LOGIN CARD
================================ */
#loginForm {
    width: 100%;
    max-width: 380px;
    background-color: #ffffff;
    padding: 35px 30px;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    animation: fadeUp 0.4s ease;
}

/* titolo */
#loginForm h2 {
    text-align: center;
    font-size: 26px;
    margin-bottom: 5px;
}

.subtitle {
    text-align: center;
    font-size: 14px;
    color: #777;
    margin-bottom: 25px;
}

/* ================================
   INPUT
================================ */
.inputGroup {
    margin-bottom: 18px;
}

.inputGroup label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #444;
}

.inputGroup input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.inputGroup input:focus {
    outline: none;
    border-color: #0077ff;
    box-shadow: 0 0 0 3px rgba(0, 119, 255, 0.15);
}

/* ================================
   BUTTON
================================ */
#loginBtn {
    width: 100%;
    padding: 13px;
    border-radius: 12px;
    border: none;
    background-color: #0077ff;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#loginBtn:hover {
    background-color: #005fd1;
}

#loginBtn:active {
    transform: scale(0.98);
}

/* ================================
   EXTRA
================================ */
.extra {
    margin-top: 18px;
    text-align: center;
    font-size: 14px;
}

.extra a {
    color: #0077ff;
    text-decoration: none;
    font-weight: 500;
}

.extra a:hover {
    text-decoration: underline;
}

/* ================================
   ANIMATION
================================ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   USER PROFILE PAGE
================================ */

/* contenitore centrale */
.user-card {
    max-width: 420px;
    margin: 60px auto 30px;
    background-color: #ffffff;
    border-radius: 22px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    animation: fadeUp 0.4s ease;
}

/* header */
.user-card-header {
    background: linear-gradient(135deg, #0077ff, #005fd1);
    padding: 30px 20px 40px;
    text-align: center;
    color: #ffffff;
}

/* avatar */
.user-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 4px solid #ffffff;
    background-color: #fff;
    object-fit: cover;
    margin-bottom: 15px;
}

/* username */
.user-name {
    font-size: 22px;
    font-weight: 600;
}

/* body */
.user-card-body {
    padding: 30px;
}

.user-card-body p {
    font-size: 15px;
    color: #444;
    margin-bottom: 14px;
    line-height: 1.4;
}

.user-card-body strong {
    color: #222;
}

/* ================================
   LOGOUT BUTTON
================================ */
#logoutButton {
    display: block;
    margin: 25px auto 0;
    padding: 12px 26px;
    border-radius: 14px;
    border: none;
    background-color: #ff4d4d;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#logoutButton:hover {
    background-color: #e60000;
}

#logoutButton:active {
    transform: scale(0.97);
}

/* ================================
   MOBILE
================================ */
@media (max-width: 480px) {
    .user-card {
        margin: 40px 15px;
    }

    .user-avatar {
        width: 90px;
        height: 90px;
    }

    .user-name {
        font-size: 20px;
    }
}




/* ================================
   ADMIN PAGE SPECIFIC
================================ */
.admin-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
    animation: fadeUp 0.4s ease;
}

.admin-header {
    text-align: center;
    margin-bottom: 30px;
}

.admin-header h1 {
    font-size: 32px;
    color: #222;
}

/* Badge stats */
.stats-card {
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.status-badge {
    width: 12px;
    height: 12px;
    background-color: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #2ecc71;
}

/* Tabella Moderna */
.table-container {
    background: white;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.admin-table th {
    background-color: #f8f9fa;
    color: #777;
    text-align: left;
    padding: 16px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #eee;
}

.admin-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f1f1;
    color: #444;
}

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

.admin-table tr:hover {
    background-color: #fcfdfe;
}

.id-pill {
    background: #eee;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: bold;
    color: #555;
}

/* Pulsanti Admin */
.admin-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-admin {
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-admin.primary { background: #0077ff; color: white; }
.btn-admin.secondary { background: #f4f6f8; color: #444; border: 1px solid #ddd; }
.btn-admin.danger { background: #fff1f1; color: #ff4d4d; border: 1px solid #ffcccc; }

.btn-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}








/* ================================
   RESPONSIVE TABLE (MOBILE)
================================ */
@media (max-width: 768px) {
    .admin-container {
        margin: 20px auto;
    }

    /* Nascondiamo la testata della tabella */
    .admin-table thead {
        display: none;
    }

    /* Trasformiamo ogni riga in una "Card" */
    .admin-table, .admin-table tbody, .admin-table tr, .admin-table td {
        display: block;
        width: 100%;
    }

    .admin-table tr {
        margin-bottom: 15px;
        border: 1px solid #eee;
        border-radius: 12px;
        padding: 10px;
        background: #fff;
    }

    .admin-table td {
        text-align: right;
        padding: 8px 10px;
        border-bottom: 1px dotted #eee;
        position: relative;
        font-size: 14px;
    }

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

    /* Aggiungiamo le etichette (ID, Username, ecc.) prima del valore */
    .admin-table td::before {
        content: attr(data-label); /* Usa l'attributo data-label del PHP */
        float: left;
        font-weight: 600;
        color: #888;
        text-transform: uppercase;
        font-size: 11px;
    }

    /* Pulsanti Admin in verticale su mobile */
    .admin-actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn-admin {
        text-align: center;
        width: 100%;
    }
}





/* Rifinitura per input data e placeholder */
.inputGroup input[type="datetime-local"] {
    font-family: inherit;
    color: #444;
}

/* Stile per i sottotitoli nel form */
.user-card-body h3 {
    font-size: 14px;
    color: #777;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Allineamento pulsante nella card */
#generateUser {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    font-size: 16px;
}



/* Ottimizzazione Campi Data per Mobile */
input[type="datetime-local"] {
    appearance: none;               /* Rimuove stili di default strani su alcuni browser */
    -webkit-appearance: none;
    min-height: 48px;               /* Altezza minima consigliata per il tocco (Apple/Google standard) */
    cursor: pointer;
    background-color: #fff;
    position: relative;
}

/* Forza la dimensione del font su mobile per evitare lo zoom automatico di iOS */
@media (max-width: 768px) {
    input[type="datetime-local"], 
    input[type="text"] {
        font-size: 16px !important; /* Sotto i 16px, l'iPhone fa lo zoom automatico quando clicchi */
    }
    
    .inputGroup {
        margin-bottom: 22px;        /* Aumenta un po' lo spazio tra i campi su mobile */
    }
}

/* Rende l'icona del calendario più visibile (opzionale) */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
}