/* ============================================
   SFO - Global Styles
   ============================================ */

* {
    box-sizing: border-box;
}

html,
body {
    padding: 0;
    margin: 0;
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 14px;
    color: #333;
}

body {
    /* Rimuovo centering verticale */
    display: block;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Alerts */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-weight: 500;
}

.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

#alert-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    z-index: 2000; /* Sopra al menu */
    pointer-events: none; /* Clicca attraverso se non c'è alert */
}

.alert-box {
    pointer-events: auto;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Dashboard */
.left, .right{
    display: flex;
    flex-direction: column;
}

/* Ensure items inside the left/right dashboard columns can be laid out
   horizontally when needed (single-row). This rule overrides the
   vertical default for the dashboard areas. */
.dashboard .left,
.dashboard .right {
    flex-direction: row; /* place children in one row */
    align-items: center;  /* vertically center items */
    gap: 8px;             /* space between items */
}

/* Targeted helper class to force a single-row layout when needed. */
.row-inline {
    display: flex;       /* ensure it's a flex container */
    flex-direction: row; /* force children on a single row */
    align-items: center;
    gap: 8px;
}

.dashboard {

        padding: 15px 20px;
        margin: 10px auto;
        width: 90%;
        max-width: 900px;
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        display: flex;
        justify-content: space-between;
        align-items: center;
/*    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 1200;
    display: flex;
    justify-content: space-between;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    padding: 15px 20px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;*/
}

.dashboard a {
    display: inline-block;
    margin: 10px 5px;
    padding: 10px 15px;
    background-color: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.dashboard a:hover {
    background-color: #764ba2;
}

/* --- 2. DASHBOARD WRAPPER (Separato) --- */
#dashboard-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
        
    /* TRUCCO ANTI-FLASH: 
       Nascondiamo con opacity 0 inizialmente. 
       Lo script inline lo renderà visibile (opacity 1) appena ha deciso se deve essere nascosto (translateY) o no.
    */
    opacity: 0; 
}

#dashboard-wrapper.visible {
    opacity: 1;
}

#dashboard-wrapper.nav-hidden {
    transform: translateY(-100%);
    /* Quando è nascosto col transform, deve comunque avere opacity 1 per quando riappare */
    opacity: 1 !important; 
}

/* Main Container */
.container{
    width: 90%;
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    min-height: 2000px;
    padding-top: 80px; /* Spazio per la dashboard sticky */
}
/*.container {
    margin-top: 80px; 
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 900px;
}*/

/* Typography */
h1 {
    color: #333;
    font-size: 24px;
    margin: 0 0 20px 0;
}

h2 {
    color: #333;
    font-size: 20px;
    margin: 0 0 15px 0;
}

p {
    color: #666;
    margin-top: 10px;
}



/* Forms & Inputs */
form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

input[type="text"],
input[type="password"],
input[type="email"] {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 14px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 3px rgba(102, 126, 234, 0.4);
}

/* Default Buttons */
button {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 16px;
    padding: 10px 15px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #764ba2;
}

button:active {
    transform: scale(0.98);
}

/* ============================================
   Admin Area Styles
   ============================================ */

.admin-area {
    width: 100%;
    max-width: 900px;
    margin: 20px auto 0;
    background: #fff;
    padding: 18px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.admin-form {
    display: block;
    margin: 0 0 18px 0;
    padding: 14px;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fafafa;
}

.admin-form input[type="text"],
.admin-form input[type="password"] {
    width: calc(100% - 14px);
    padding: 8px;
    margin: 6px 0;
    border: 1px solid #d6d6d6;
    border-radius: 4px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f1f1;
    font-size: 14px;
}

.admin-table thead th {
    background: #f7f7f7;
    font-weight: 600;
}

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

/* Admin Actions */
.admin-actions {
    text-align: center;
}

.admin-actions form {
    display: inline-block;
    margin: 2px;
}

        .members-list {
            background: #f8f9fa;
            border-radius: 4px;
            padding: 15px;
            margin-bottom: 20px;
        }
        .members-list h3 {
            margin-bottom: 10px;
            color: #333;
        }
        .members-list ul {
            list-style: none;
        }
        .members-list li {
            padding: 8px 12px;
            border-bottom: 1px solid #e9ecef;
            display: flex;
            align-items: flex-start;
            gap: 10px;
        }
        .members-list li:last-child {
            border-bottom: none;
        }
        .member-icon {
            font-size: 1.2em;
            line-height: 1.4;
            flex-shrink: 0; /* Impedisce che l'icona si riduca */
        }
        .member-name {
            flex-shrink: 0; /* Non si riduce */
            text-align: left; /* Allineamento a sinistra */
        }
        .member-id {
            font-size: 0.85em;
            color: #999;
        }
        /* Spazio tra member-name e admin-actions */
        .members-list li > .admin-actions {
            margin-left: auto; /* Spinge le azioni a destra */
        }
/* ============================================
   Button Classes
   ============================================ */

.btn {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-block;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary {
    background-color: #4285f4;
    color: #fff;
}

.btn-primary:hover {
    background-color: #3367d6;
}

.btn-ghost {
    background-color: transparent;
    border: 1px solid #ccc;
    color: #333;
}

.btn-ghost:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.btn-danger {
    background-color: #e34a4a;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c93333;
}

.btn.small {
    font-size: 12px;
    padding: 6px 8px;
}

/* Force small buttons in admin actions table */
.admin-actions button {
    padding: 6px 8px !important;
    font-size: 12px !important;
    text-transform: none !important;
}

/* ============================================
   Modal for Confirmations
   ============================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.modal {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 420px;
    width: 95%;
}

.modal .modal-message {
    margin-bottom: 15px;
    color: #222;
    font-size: 16px;
}

.modal .modal-actions {
    text-align: right;
    margin-top: 20px;
}

.modal .modal-actions .btn {
    margin-left: 8px;
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 10px;
    z-index: 1000;
    border-radius: 5px;
}

.dropdown-menu a {
    display: block;
    padding: 5px 10px;
    text-decoration: none;
    color: black;
    border-radius: 3px;
}

.dropdown-menu a:hover {
    background-color: #f0f0f0;
}

.dropdown-menu.hidden {
    display: none;
}

.dropdown-menu:not(.hidden) {
    display: block;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 720px) {
    .container {
        max-width: 95%;
        padding: 20px;
    }

    .admin-area {
        padding: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 6px;
        font-size: 13px;
    }

    .admin-actions button {
        padding: 5px 6px !important;
        font-size: 11px !important;
    }

    .modal {
        width: 90%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 20px;
    }

    .dashboard a {
        display: block;
        margin: 8px 0;
    }
/* Responsive: on small screens, stack the items again for readability */
/*    .row-inline {
        flex-direction: column !important;
        gap: 6px;
        align-items: stretch;
    }
*/
}
