/* --- BASE & VARIABILI --- */
:root { 
    --primary: #e67e22; 
    --dark: #d35400; 
    --bg: #f0f2f5; 
    --success: #27ae60;
    --text: #2c3e50;
    --grey: #7f8c8d;
    --primary-light: #fff8f2;
    --dark2: #2c3e50; 
    --light-gray: #eee;
    --shadow: 0 10px 30px rgba(0,0,0,0.1);
    --radius: 15px;
}


* { box-sizing: border-box; }

body { 
    font-family: 'Segoe UI', sans-serif; 
    background: var(--bg); 
    margin: 0; 
    color: #333; 
    line-height: 1.6; 
}

/* --- HEADER & NAVIGATION --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10000;
    height: 70px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-left .logohome {
        width: 150px !important; /* Riduci il logo su mobile */
        min-width: 120px;
    }

header h2 { color: var(--primary); margin: 0; cursor: pointer; }

.user-nav {
    display: flex;
    align-items: center;
    gap: 8px; 
}

.nav-link i {
    font-size: 1.4rem; /* Icone grandi e leggibili */
    margin-bottom: -2px;
}

.nav-link:hover { color: var(--primary); }
.nav-link.active { font-weight: bold; color: var(--primary); }

.profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    line-height: 1; 
}

.mini-pfp {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    min-height: 32px;
    object-fit: cover; 
    object-position: center;
    border-radius: 50%;
    border: 1px solid #ddd;
    display: block;
}


.logohome {
    width: 240px !important;
        min-width: 240px;
        object-fit: cover; 
    display: inline-block;
}



.logout-link { color: #e74c3c; text-decoration: none; font-size: 0.9em; }
.back-link { text-decoration: none; color: var(--grey); font-weight: bold; }
.back-link:hover { color: var(--primary); }


/* --- LAYOUT STRUTTURALE --- */
.main-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    gap: 30px;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    height: fit-content;
}

.content { flex-grow: 1; min-width: 0; }

/* --- SIDEBAR COMPONENTS --- */
.sidebar-section { margin-bottom: 30px; background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.sidebar-section h3 { font-size: 1.1em; color: var(--dark); border-bottom: 2px solid var(--primary); padding-bottom: 8px; margin-bottom: 15px; }

.sidebar-divider { border: 0; border-top: 1px solid #eee; margin: 20px 0; }

.user-sidebar-list { list-style: none; padding: 0; margin: 0; }

.user-sidebar-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px; 
}

.user-sidebar-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    gap: 10px;
    font-size: 0.9em;
    flex-grow: 1;
}

/* Avatar Rettangolari Sidebar */
.pfp-rect-mini {
    width: 32px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.default-icon {
    background: #f8f9fa;
    font-size: 18px;
    color: #ccc;
    border: 1px dashed #ddd;
}

/* Filtri Sidebar */
.filter-list { list-style: none; padding: 0; }
.filter-list li a { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; text-decoration: none; color: #555; border-radius: 8px; transition: 0.3s; margin-bottom: 4px; }
.filter-list li a:hover, .filter-list li a.active { background: #fff; color: var(--primary); font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

.sidebar-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pill { text-decoration: none; background: #eee; color: #666; padding: 6px 14px; border-radius: 20px; font-size: 0.85em; transition: 0.3s; }
.tag-pill:hover, .tag-pill.active { background: var(--primary); color: white; }

.manage-link { font-size: 0.8em; color: #888; text-decoration: none; font-style: italic; }
.empty-msg { font-size: 0.85em; color: #999; }

/* --- SEARCH & ACTION BAR --- */
.action-bar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; gap: 20px; }
.search-form { display: flex; flex-grow: 1; max-width: 600px; position: relative; }
.search-form input { width: 100%; border-radius: 30px; padding: 12px 25px; border: 2px solid #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); transition: 0.3s; font-size: 15px; }
.search-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.1); }
.search-form button { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1.2em; }

/* --- BUTTONS --- */
.btn-add { 
    background: var(--primary); color: white; border: none; padding: 12px 25px; 
    border-radius: 25px; font-size: 16px; font-weight: bold; cursor: pointer; transition: 0.3s; 
}
.btn-add:hover { background: var(--dark); transform: scale(1.05); }

.btn-icon { background: #f8f9fa; border: 1px solid #eee; padding: 7px 11px; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 14px; transition: 0.2s; color: var(--text); }
.btn-icon:hover { background: #fff; border-color: var(--primary); transform: translateY(-1px); }
.btn-icon.edit:hover { color: #3498db; }
.btn-icon.delete:hover { color: #e74c3c; }

.btn-follow-mini { background: #e67e22; color: white; border: none; border-radius: 4px; width: 24px; height: 24px; cursor: pointer; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.btn-follow-mini:hover { background: #d35400; }

.btn-unfollow-mini { background: #f0f0f0; color: #999; border: none; border-radius: 4px; width: 24px; height: 24px; cursor: pointer; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.btn-unfollow-mini:hover { background: #e74c3c; color: white; }

.btn-following { background: #27ae60; color: white; border: none; padding: 8px 18px; border-radius: 20px; cursor: pointer; font-weight: bold; }
.btn-following:hover { background: #c0392b; }
.btn-following:hover::after { content: " Smetti"; }

/* --- FEED & CARDS --- */
.feed-container { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); 
    gap: 25px; 
    align-items: start; /* Allinea le card all'inizio per evitare altezze forzate */
}

/* --- RECIPE CARD INTEGRATA --- */
.recipe-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.recipe-card:hover {
    transform: translateY(-4px);
}

.recipe-img {
    width: 100%;
    height: 240px; /* Altezza standard Dish */
    object-fit: cover;
    display: block;
}


/* --- Tipografia Card --- */
.recipe-card h3 {
    margin: 10px 0;
    font-size: 1.1rem;
    line-height: 1.4;
    height: 2.8em; /* Altezza per esattamente 2 righe */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;  
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- CONTENUTO INFERIORE --- */
.recipe-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.recipe-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.recipe-date {
    font-size: 12px;
    color: #8e8e8e;
    font-weight: 500;
}

.recipe-title {
    font-size: 1.1rem;
    font-weight: 800; /* Dish usa font molto pesanti per i titoli */
    color: #262626;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.recipe-description {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.4;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.view-recipe-link {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
}

/* --- CONTAINER FEED (DISH STYLE) --- */
.dish-main-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* Speculare a Dish */
    gap: 20px;
    padding: 10px 0;
}

@media (max-width: 768px) {
    .dish-main-container {
        grid-template-columns: 1fr; /* Una sola colonna su mobile */
        gap: 12px;
    }
}

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.recipe-actions { display: flex; gap: 8px; }

.like-section { display: flex; align-items: center; gap: 10px; margin: 15px 0; padding-top: 10px; border-top: 1px solid #f9f9f9; }
.like-btn { background: none; border: none; cursor: pointer; font-size: 1.4em; padding: 0; transition: transform 0.2s; }
.like-btn:hover { transform: scale(1.2); }
.likes-count { font-size: 0.9em; color: #666; font-weight: 600; }

.read-more { margin-top: auto; color: var(--primary); font-weight: bold; text-decoration: none; font-size: 0.95em; display: flex; align-items: center; gap: 5px; }

.read-more:hover { gap: 8px; text-decoration: underline; transition: 0.3s; }

.btn-add { width: auto !important;    margin: 0 !important;}

/* --- Sezioni e Intestazioni --- */
.feed-section-title {
    display: flex;
    align-items: center;
    margin: 40px 0 20px;
    padding-left: 15px;
    color: #d35400;
    font-size: 1.5rem;
    border-left: 5px solid #e67e22;
}

/* --- PROFILO UTENTE --- */
.profile-hero { background: white; border-radius: 15px; padding: 30px; margin-bottom: 30px; border: 1px solid #eee; text-align: center; }
.pfp-container { position: relative; display: inline-block; margin-bottom: 15px; }
.pfp-profile { width: 130px; height: 130px; border-radius: 50%; object-fit: cover; border: 4px solid #e67e22; }

.speciality-tag { background: #fff3e0; color: #d35400; padding: 5px 15px; border-radius: 20px; font-weight: bold; font-size: 0.9em; display: inline-block; margin: 10px 0; }

.profile-stats { display: flex; justify-content: center; gap: 40px; margin-top: 20px; border-top: 1px solid #f9f9f9; padding-top: 20px; }
.stat-box { cursor: pointer; }
.stat-box span { display: block; font-size: 1.4em; font-weight: bold; color: #2c3e50; }
.stat-box label { color: #888; font-size: 0.8em; text-transform: uppercase; }

.profile-tabs { display: flex; gap: 2px; background: #eee; border-radius: 10px; padding: 5px; margin-bottom: 25px; }
.tab-btn { flex: 1; padding: 12px; border: none; background: none; cursor: pointer; font-weight: bold; color: #666; transition: 0.3s; border-radius: 8px; }
.tab-btn.active { background: white; color: #d35400; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- PAGINA DETTAGLIO RICETTA --- */
.recipe-container { 
    max-width: 900px; margin: 30px auto; background: white; 
    border-radius: 20px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
}

.recipe-hero { position: relative; width: 100%; height: 450px; background: #ddd; }
.recipe-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hero-overlay { position: absolute; bottom: 20px; right: 20px; }
.main-like { 
    background: white; border: none; padding: 12px; border-radius: 50%; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); cursor: pointer; font-size: 1.5rem; 
    transition: transform 0.2s; 
}

.recipe-body { padding: 40px; }
.recipe-header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }


.badge-container { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.view-badge-portata { background: #fff3e0; color: var(--dark); padding: 8px 16px; border-radius: 25px; font-weight: bold; font-size: 0.9em; display: inline-block; }
.view-tag-list { background: #f1f2f6; color: #57606f; padding: 8px 16px; border-radius: 25px; font-size: 0.9em; display: inline-block; }

.section-title { display: flex; align-items: center; gap: 12px; color: var(--dark); border-bottom: 2px solid #f0f2f5; padding-bottom: 12px; margin-top: 40px; font-size: 1.5em; }
.ingredients-box { background: #f9f9f9; padding: 25px; border-radius: 15px; border-left: 6px solid var(--primary); font-size: 1.1em; color: #444; margin-top: 15px; }
.instruction-box { font-size: 1.15em; color: #333; line-height: 1.8; margin-top: 15px; }

.preserve-lines { white-space: pre-wrap; word-wrap: break-word; display: block !important; visibility: visible !important; }



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


input:invalid, select:invalid, textarea:invalid {
    border-color: #ff7675 !important;
}

/* Messaggio di avviso stile notifica */
.validation-alert {
    background: #ff7675;
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none; /* Appare solo se serve tramite JS */
}

/* Tasto chiusura (X) */
.close-btn {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: 0.2s;
}
.close-btn:hover { color: var(--primary); }

/* Stile degli elementi interni alla modale */
.modal label { display: block; margin-top: 15px; font-weight: 700; color: var(--text); font-size: 0.9em; }
.modal input, .modal textarea, .modal select { 
    width: 100%; padding: 12px; margin-top: 5px; border: 1px solid #ddd; 
    border-radius: 10px; font-family: inherit; 
}

/* Correzione allineamento testata card */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Centra verticalmente il nome e i tasti */
    margin-bottom: 12px;
}

.recipe-actions {
    display: flex;
    gap: 5px; /* Spazio tra il tasto segui e il tasto blocca */
    align-items: center;
}

/* Tasto Segui (Arancione) */
.btn-follow-mini {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.8em;
    cursor: pointer;
    transition: 0.2s;
}

/* Tasto Seguito (Verde) */
.btn-following {
    background: var(--success);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.8em;
    cursor: pointer;
}

/* Tasto Icona (Blocca) */
.btn-icon {
    background: #f8f9fa;
    border: 1px solid #eee;
    padding: 5px 8px;
    border-radius: 8px;
    cursor: pointer;
}


/* --- PAGINA RETE & SUGGERIMENTI --- */
.network-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 30px; 
    margin-top: 20px; 
}

.suggestions-section { 
    grid-column: 1 / -1; 
    background: #fff5eb; 
    padding: 20px; 
    border-radius: 15px; 
    border: 1px dashed #e67e22;
    margin-bottom: 20px;
}

.suggestions-list { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 15px; 
    margin-top: 15px;
}

.user-card-mini { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: white; 
    padding: 12px 15px; 
    border-radius: 12px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
    transition: 0.3s;
}

.user-card-mini:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 6px 12px rgba(0,0,0,0.1); 
}

.user-link { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    text-decoration: none; 
    color: inherit; 
}

.pfp-mini { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    object-fit: cover; 
    border: 2px solid #e67e22; 
}

.btn-action-net { 
    border: 1px solid #dee2e6; 
    padding: 6px 10px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 0.85em; 
    transition: 0.2s;
}

.btn-follow { background: #e67e22; color: white; border: none; }
.btn-follow:hover { background: #d35400; }

.btn-unfollow-net { background: #f8f9fa; }
.btn-unfollow-net:hover { background: #ff7675; color: white; border-color: #d63031; }

@media (max-width: 768px) { 
    .network-grid { grid-template-columns: 1fr; } 
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-top: 5px;
}
.tags-container label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0 !important; /* Rimuove il margine dei label standard */
    font-weight: normal !important;
    background: white;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #eee;
    cursor: pointer;
}


/* Tasto Rimuovi più stiloso */
.btn-remove {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.btn-remove:hover {
    background: #ef4444;
    color: white;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    z-index: 3000;
    max-height: 150px;
    overflow-y: auto;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.autocomplete-suggestions div {
    padding: 10px;
    cursor: pointer;
    font-size: 0.9em;
}

.autocomplete-suggestions div:hover {
    background: #f8f9fa;
    color: var(--primary);
}
/* ==========================================================================
   STILE MODERAZIONE (Dropdown, Badges e Segnalazioni)
   ========================================================================== */

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

/* --- Pulsante Trigger --- */
.dropbtn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Link Admin/Mod --- */
.admin-mod-link {
    color: var(--primary) !important;
    font-weight: bold;
}

/* --- Contenuto del Menu --- */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 250px; /* Un po' più largo per il testo affiancato */
    max-height: 400px; /* Impedisce al menu di toccare il fondo dello schermo */
    overflow-y: auto;  /* Aggiunge la rotellina se ci sono troppe voci */
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 12px;
    z-index: 100000 !important;
}

/* --- Stato Visibile --- */
.dropdown-content.show {
    display: block;
}

/* --- Voci del Menu --- */
.dropdown-content a {
    display: flex;
    align-items: center; /* Centra verticalmente icona e testo */
    gap: 12px;
    padding: 10px 15px; /* Riduci il padding verticale[cite: 3] */
    text-align: left;
    flex-direction: row !important; /* Forza l'icona a stare a sinistra del testo[cite: 3] */
}

.dropdown-content a i {
    font-size: 1.1em;
    width: 20px; /* Larghezza fissa per le icone così il testo è allineato */
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: #fffaf5;
    color: var(--dark);
}

/* --- Separatore --- */
.dropdown-content hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 0;
}

/* --- Animazioni --- */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Badges Notifiche --- */
.header-badge {
    position: absolute;
    top: 2px;     /* Spostalo leggermente verso il basso */
    right: 2px;   /* Spostalo leggermente verso sinistra */
    background: #e74c3c;
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 50%;
    border: 2px solid white; /* Il bordo bianco aiuta a staccarlo dallo sfondo */
    z-index: 10;
}

.badge-inline {
    background: var(--primary);
    color: white;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: bold;
}

/* --- Modale Segnalazione (Specifiche) --- */
.btn-report-trigger {
    background: none;
    border: 1px solid #fab1a0;
    color: #e17055;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: 0.3s;
    margin-top: 10px;
}

.btn-report-trigger:hover {
    background: #fff5f5;
    border-color: #ff7675;
    color: #d63031;
}

.modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-send-report {
    background: #e74c3c !important;
    color: white !important;
    border: none;
    flex: 2;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
}

.btn-cancel-report {
    background: #eee !important;
    color: #666 !important;
    border: none;
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
}

/* --- Tabella Moderazione Utenti/Segnalazioni --- */
.mod-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    border-collapse: collapse;
    overflow: hidden;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.mod-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    color: var(--grey);
    font-size: 0.85em;
    text-transform: uppercase;
}

.mod-table td {
    padding: 15px;
    border-top: 1px solid #eee;
    vertical-align: middle;
}

.mini-pfp { width: 25px; height: 25px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 5px; }

/* ============================================================
   1. MODALE RICETTA (Stili Base Desktop)
   ============================================================ */
#recipeModal.modal, 
.modal-overlay { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(0,0,0,0.7); 
    backdrop-filter: blur(5px); 
    z-index: 10000; 
    align-items: center; 
    justify-content: center; 
    padding: 20px;
}

.modal-content { 
    background: white; 
    padding: 30px; 
    border-radius: 20px; 
    width: 100%; 
    max-width: 700px; 
    max-height: 90vh; 
    overflow-y: auto; 
    position: relative; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-btns {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    position: sticky;
    bottom: 0;
    background: white;
    padding-top: 15px;
}

.btn-send, .btn-chef-modale {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    flex: 2;
}

.btn-cancel {
    background: #eee;
    color: #666;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    flex: 1;
}

/* ============================================================
   2. GESTIONE DASHBOARD E LOCALI
   ============================================================ */
.btn-explore-locali {
    background: #e67e22;
    color: white !important;
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.2);
}

.btn-explore-locali:hover {
    background: #d35400;
    transform: translateY(-2px);
}

.dash-actions-container {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    margin-bottom: 15px;
    width: 100%;
}

.dash-actions-container .btn-add, 
.dash-actions-container .btn-explore-locali {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 10px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    height: 48px;
    white-space: nowrap;
}


/* --- GESTIONE TASTI PROPRIETARIO (DISH STYLE) --- */
.owner-actions {
    position: absolute; 
    top: 12px; 
    right: 12px; 
    display: flex; 
    gap: 8px;
    z-index: 10;
}

.btn-edit-mini, .btn-delete-mini {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.btn-edit-mini i { color: var(--primary); font-size: 16px; }
.btn-delete-mini i { color: var(--danger); font-size: 16px; }

.btn-edit-mini:hover, .btn-delete-mini:hover {
    transform: scale(1.1);
    background: white;
}


/* Base per icone grandi e leggibili */
.user-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    font-size: 11px;
    position: relative;
    padding: 5px;
}

a {
    text-decoration: none;
    color: inherit; /* Così i link prendono il colore del testo circostante invece del blu standard */
}

/* ============================================================
   3. DESIGN RESPONSIVE (BLOCCO UNIFICATO)
   ============================================================ */

/* --- TABLET E SMARTPHONE (Sotto i 1024px) --- */
@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column;
        padding: 10px;
    }

    .sidebar {
        width: 100%;
        position: static;
        margin-bottom: 20px;
    }

    /* Modale adattiva */
    #recipeModal {
        align-items: flex-start !important; 
        justify-content: flex-start !important;
        overflow-y: scroll !important;
        padding: 0 !important;
    }

    #recipeModal .modal-content {
        width: 100% !important;
        min-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 60px 15px 120px 15px !important;
        display: block !important; 
    }

    /* Anti-Zoom iOS */
    #recipeModal input, 
    #recipeModal select, 
    #recipeModal textarea {
        font-size: 16px !important; 
        padding: 12px !important;
        width: 100% !important;
    }

    /* Sezioni come Card */
    .section-box, .step-item, #tag-section {
        background: #fff !important;
        padding: 15px !important;
        border-radius: 12px !important;
        border: 1px solid #e5e7eb !important;
        margin-bottom: 15px !important;
        display: flex;
        flex-direction: column !important;
    }

    .step-row, .step-container {
        flex-direction: column !important;
    }

    .step-image-preview-container {
        width: 100% !important;
        height: 200px !important;
    }

    /* Chiudi modale (X) */
    #recipeModal .close-btn, 
    #recipeModal span[onclick="closeRecipeModal()"] {
        position: fixed !important;
        top: 15px !important;
        right: 15px !important;
        background: #eee;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        z-index: 10005;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
}

/* --- MOBILE STRETTO (Sotto i 768px) --- */
@media (max-width: 768px) {
    .network-grid { grid-template-columns: 1fr; }
    .action-bar-top { flex-direction: column; align-items: stretch; }

    .desktop-only { display: none !important; }
    
    #modalTitle { font-size: 1.4rem !important; font-weight: 800 !important; }

   header {
        height: 70px;
        padding: 0 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

.nav-divider{display: none !important; 

}

    /* Nascondi i link testuali diretti (Feed, Ricette, Tips) */
    .nav-link {
    position: relative; /* Questo crea il confine per il badge */
    display: inline-flex; 
    align-items: center;
    flex-direction: column;
    color: #333;
    text-decoration: none;
    }

    /* Mantieni visibili solo logo, notifiche e profilo */
    .header-left .logohome {
        width: 140px !important; /* Ridotto per fare spazio */
        min-width: 120px;
    }

    /* Trasforma la user-nav in un contenitore compatto */
    .user-nav {
        gap: 15px;
    }

    /* Crea il menu a tendina per le opzioni nascoste */
    .mobile-menu-dropdown {
        display: block; /* Da aggiungere nel tuo HTML come pulsante menu */
        position: relative;
    }

    /* Visualizzazione degli elementi dentro il dropdown */
    .dropdown-content {
        min-width: 180px;
        right: 0;
        top: 60px; /* Sotto l'header */
    }
}

/* --- SMARTPHONE PICCOLI (Sotto i 600px) --- */
@media (max-width: 600px) {
    .modal-content { padding: 15px; }
    .ingredient-row { flex-direction: column; }
    .ingredient-row input { width: 100% !important; }
    .dash-actions-container { flex-direction: column; }
    .feed-container { grid-template-columns: 1fr; }}

    
/* --- 9. MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    .dish-main-container { width: 100%; }
    .sidebar { display: none !important; }
    .recipe-card, .dish-card, .feed-item {
        border-radius: 0 !important;
        border-left: none !important; border-right: none !important;
        margin-bottom: 12px !important;
    }
}