/* ==========================================================================
   RESET E REGOLE BASE
   ========================================================================== */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body { 
    font-family: 'Inter', sans-serif; 
    background: #f4f7f6; 
    color: #333; 
    line-height: 1.6; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    padding-top: 80px; 
}

/* ==========================================================================
   STRUTTURA LAYOUT E CONTENITORI (PC)
   ========================================================================== */
.container { 
    display: flex; 
    flex-wrap: wrap; 
    max-width: 1200px; 
    width: 100%;
    margin: 30px auto; 
    padding: 0 20px; 
    gap: 30px; 
    flex: 1; 
}

.col-9 { 
    flex: 1 1 calc(70% - 30px);
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px; 
}

.col-3 { 
    flex: 0 0 calc(30% - 0px);
    min-width: 340px; 
    display: flex;
    flex-direction: column;
    gap: 20px; 
}

.card {
    background: #fff; 
    padding: 30px; 
    border-radius: 8px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    height: fit-content;
    word-wrap: break-word;
}

.col-3 .card { padding: 20px; }

.col-3 img, .col-3 iframe, .col-3 ins, .col-3 script, .col-3 div {
    max-width: 100%;
}

/* Elementi Tipografici */
h1, h2, h3 { color: #222; margin-bottom: 15px; }
p { margin-bottom: 10px; }
p:last-child { margin-bottom: 0; }

.stats-highlight { background: #f8f9fa; padding: 20px; border-radius: 6px; border-left: 4px solid #007BFF; }
.stat-item { font-size: 1.1rem; margin: 8px 0; }
.stat-item strong { color: #007BFF; }

footer { background: #222; color: #bbb; text-align: center; padding: 20px; margin-top: auto; font-size: 0.9rem; }
footer a { color: #fff; text-decoration: none; }

/* ==========================================================================
   BARRA DEI MENU / HEADER (VISUALIZZAZIONE DESKTOP)
   ========================================================================== */
.header-bar {
    background-color: #fff; 
    padding: 0 40px; 
    height: 80px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    z-index: 1000; 
    box-sizing: border-box;
}

.site-logo {
    font-size: 24px; 
    font-weight: 700; 
    letter-spacing: -0.5px;
}

.site-logo a {
    color: #0066cc; 
    text-decoration: none;
}

.nav-menu {
    display: flex !important; /* Mantiene i link allineati in orizzontale su PC */
    align-items: center;
    flex-direction: row !important;
}

.nav-link {
    color: #4a5568; 
    text-decoration: none; 
    font-weight: 600; 
    margin-right: 25px; 
    font-size: 15px;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #0066cc;
}

.nav-dashboard {
    color: #0066cc;
}

.user-email {
    font-size: 14px; 
    margin-right: 20px; 
    color: #4a5568;
}

.btn-logout {
    color: red; 
    text-decoration: none; 
    font-weight: 700; 
    font-size: 15px;
}

.btn-login {
    color: #0066cc; 
    text-decoration: none; 
    font-weight: 700; 
    margin-right: 25px; 
    font-size: 15px;
    transition: opacity 0.2s ease;
}

.btn-login:hover {
    opacity: 0.8;
}

.btn-register {
    background-color: #28a745; 
    color: white; 
    text-decoration: none; 
    padding: 10px 22px; 
    border-radius: 6px; 
    font-weight: 700; 
    font-size: 15px;
    box-shadow: 0 2px 4px rgba(40,167,69,0.2);
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.btn-register:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

/* Pulsante Hamburger (Nascosto su Desktop) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #333;
}

/* ==========================================================================
   MEDIA QUERIES (COMPATTATE E OTTIMIZZATE)
   ========================================================================== */

/* Tablet e schermi intermedi (sotto i 992px) */
@media (max-width: 992px) {
    .container { flex-direction: column; }
    .col-9, .col-3 { flex: 1 1 100%; max-width: 100%; }
}

/* Smartphone e Mobile (sotto i 768px) */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
        padding-top: 80px; /* Evita che il contenuto finisca sotto il menu fisso */
    }

    .container, .row, .sidebar, .content {
        width: 100% !important;
        display: block !important;
        padding: 10px 0;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    input, textarea, button {
        width: 100%;
        box-sizing: border-box;
        padding: 12px; 
        font-size: 16px; 
    }

    /* Gestione Menu Mobile */
    .header-bar {
        padding: 0 20px; 
    }

    .menu-toggle {
        display: block; /* Mostra l'hamburger */
    }

    .nav-menu {
        display: none !important; /* Nasconde i link di base su mobile */
        flex-direction: column !important;
        position: absolute;
        top: 80px;
        left: 0;
        right: 0;
        background-color: #fff;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        padding: 20px;
        gap: 15px;
    }

    /* Classe attivata dallo JavaScript per mostrare il menu */
    .nav-menu.active {
        display: flex !important;
    }

    /* Centra tutti gli elementi nel menu a colonna */
    .nav-link, .btn-login, .btn-register, .user-email, .btn-logout {
        margin-right: 0 !important;
        text-align: center;
        width: 100%;
        box-sizing: border-box;
    }

    .btn-register {
        padding: 12px;
    }
}