/* ===================================================================
   TEMA "WHITE & GOLD" v2.0 - OTTIMIZZATO
   =================================================================== */

:root {
    --primary-color: white;
    --secondary-color: #f8f9fa;
    --accent-color: #c5a47e;
    --highlight-color: black;
    --text-color: black;
    --font-primary: 'Cormorant Garamond', serif;
    --font-secondary: 'Lato', sans-serif;
    --border-radius: 20px;
    --shadow-light: 0 8px 32px rgba(31, 38, 135, 0.1);
}

/* ===================================================================
   RESET & BASE
   =================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    width: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    width: 100%;
    overflow-x: hidden;
    font-family: var(--font-secondary);
    background-color: var(--primary-color);
    color: var(--text-color);
    line-height: 1.6;
}

body.popup-active { overflow: hidden; }

/* ===================================================================
   ANIMAZIONI
   =================================================================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse-accent { 0%, 100% { box-shadow: 0 0 0 0 rgba(197, 164, 126, 0.5); } 70% { box-shadow: 0 0 0 10px rgba(197, 164, 126, 0); } }
@keyframes glow-effect { 0%, 100% { text-shadow: 0 0 5px rgba(255, 255, 255, 0.2), 0 0 10px rgba(197, 164, 126, 0.5); } 50% { text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 25px rgba(197, 164, 126, 0.8), 0 0 40px rgba(197, 164, 126, 0.5); } }
@keyframes like-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.4); } }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); } 40% { transform: translateX(-50%) translateY(-10px); } 60% { transform: translateX(-50%) translateY(-5px); } }

/* ===================================================================
   LAYOUT & Z-INDEX
   =================================================================== */
#page-wrapper { position: relative; z-index: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* ===================================================================
   HERO SECTION
   =================================================================== */
.hero {
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    background-image: url('vescica.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: transparent;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1;
}

.hero-title, .hero h2, .hero p, .social-links, .user-actions {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: var(--font-primary);
    font-size: clamp(2.8rem, 8vw, 5rem);
    font-weight: 700;
    color: black;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.hero h2 {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 400;
    color: white;
    margin-top: 1rem;
    max-width: 600px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.animated-glow { animation: glow-effect 4s ease-in-out infinite; }

/* ===================================================================
   HEADER & NAVIGATION
   =================================================================== */
.main-header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 0;
    background-color: transparent;
    transition: background-color 0.4s ease, padding 0.4s ease, box-shadow 0.4s ease;
}

body.scrolled .main-header {
    background-color: rgba(173, 140, 102, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.75rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 2rem;
}

.main-nav { display: flex; }
/* ===================================================================
   UNIFORMA LOGIN/REGISTRATI ALLO STILE NAV-LINK
   =================================================================== */

/* Rimuovi stile da pulsante e applica stile nav-link */
.main-nav .nav-user-actions .btn-primary,
.main-nav .nav-user-actions .btn-secondary,
.main-nav .nav-user-actions .welcome-user {
    /* ✅ Rimuovi tutto lo stile da pulsante */
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0.5rem 0 !important;
    margin: 0 1.25rem !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-shadow: none !important;
    transform: none !important;
    
    /* ✅ Applica stile nav-link */
    color: #e0e0e0 !important;
    text-decoration: none !important;
    font-size: 1rem !important;
    font-weight: 400 !important;
    position: relative;
    transition: color 0.3s ease !important;
    display: inline-block;
    cursor: pointer;
}

/* ✅ Aggiunge l'underline hover come gli altri link */
.main-nav .nav-user-actions .btn-primary::after,
.main-nav .nav-user-actions .btn-secondary::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.main-nav .nav-user-actions .btn-primary:hover::after,
.main-nav .nav-user-actions .btn-secondary:hover::after {
    width: 100%;
}

/* Hover effect */
.main-nav .nav-user-actions .btn-primary:hover,
.main-nav .nav-user-actions .btn-secondary:hover {
    color: #FFFFFF !important;
}

/* Welcome user text */
.main-nav .nav-user-actions .welcome-user {
    color: var(--accent-color) !important;
    font-weight: 600 !important;
    pointer-events: none; /* Non cliccabile */
}

/* Mobile: stessa cosa */
@media (max-width: 1024px) {
    .main-nav .nav-user-actions {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .main-nav .nav-user-actions .btn-primary,
    .main-nav .nav-user-actions .btn-secondary,
    .main-nav .nav-user-actions .welcome-user {
        margin: 1rem 2rem !important;
        text-align: left !important;
    }
    
    .main-nav .nav-user-actions .welcome-user {
        color: #fff !important;
        font-size: 1.1rem !important;
    }
}

.nav-link {
    color: #e0e0e0;
    text-decoration: none;
    margin: 0 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 400;
    position: relative;
    transition: color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    border-radius: 50px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 2px;
    background-color: var(--accent-color);
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-link:hover { color: #FFFFFF; }
.nav-link:hover::after { width: 100%; }

/* Desktop: sfondo ai bottoni nav */
@media (min-width: 1025px) {
    .nav-link {
        background: rgba(197, 164, 126, 0.08);
        border: 1px solid rgba(197, 164, 126, 0.15);
        margin: 0 0.3rem;
        padding: 0.5rem 1rem;
        backdrop-filter: blur(4px);
    }
    .nav-link:hover {
        background: rgba(197, 164, 126, 0.18);
        border-color: rgba(197, 164, 126, 0.4);
        box-shadow: 0 0 20px rgba(197, 164, 126, 0.1);
    }
}

/* Canvas sfondo nav */
#nav-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.5;
}
.main-nav {
    position: relative;
    z-index: 1;
}
body.scrolled .main-header #nav-canvas {
    opacity: 0.15;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-actions .btn-primary,
.user-actions .btn-secondary {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--accent-color);
}

.user-actions .btn-primary {
    background-color: var(--accent-color);
    color: var(--primary-color);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    background-color: color-mix(in srgb, var(--accent-color) 70%, transparent);
}

.user-actions .btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.user-actions .btn-secondary {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    color: var(--accent-color);
}

.user-actions .btn-secondary:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.welcome-user {
    font-size: 1rem;
    font-weight: bold;
    color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.4);
    padding: 8px 15px;
    border-radius: 50px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle { display: none; z-index: 1001; }
.mobile-menu-toggle button {
    background: none; border: none; cursor: pointer; padding: 0;
    display: flex; flex-direction: column; gap: 5px;
}
.mobile-menu-toggle button span {
    display: block; width: 25px; height: 3px;
    background-color: #FFFFFF; border-radius: 3px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ===================================================================
   SECTIONS & TYPOGRAPHY
   =================================================================== */
.section-title {
    font-family: var(--font-primary);
    font-size: 1.8rem;
    text-align: center;
    margin: 80px 0 40px 0;
    color: var(--highlight-color);
    font-weight: 600;
}

.section-divider {
    overflow: visible;
    position: relative;
    border: none;
    border-top: 1px solid rgba(197, 164, 126, 0.4);
    width: 80%;
    max-width: 700px;
    margin: 2rem auto;
    text-align: center;
}

.section-divider::after {
    content: '✧';
    display: inline-block;
    position: absolute;
    top: -1.1em; left: 50%;
    transform: translateX(-50%);
    padding: 0 0.5em;
    background-color: var(--primary-color);
    color: var(--accent-color);
    font-size: 1.8rem;
}

/* ===================================================================
   GLASS EFFECT & ANIMATIONS
   =================================================================== */
.glass-effect {
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.is-visible { opacity: 1; transform: translateY(0); }

.animate-from-left {
    opacity: 0;
    transform: translateX(-100px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-from-left.is-visible { opacity: 1; transform: translateX(0); }

.animate-from-right {
    opacity: 0;
    transform: translateX(100px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-from-right.is-visible { opacity: 1; transform: translateX(0); }

/* ===================================================================
   ABOUT SECTION
   =================================================================== */
.about-section { padding: 40px 0; text-align: center; }

.about-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 40px;
    text-align: left;
    padding: 30px;
    border-radius: 15px;
    margin-top: 20px;
}

.about-image { flex: 1 1 300px; min-width: 250px; }
.about-image img {
    width: 100%; height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

.about-text { flex: 2 1 400px; }
.about-text h3 {
    font-family: var(--font-secondary);
    color: black;
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 600;
}

.about-text p {
    font-family: var(--font-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    color: black;
    margin-bottom: 1.5em;
}

.about-text .signature {
    margin-top: 2em;
    font-style: italic;
    text-align: right;
    color: var(--accent-color);
}

.about-text .signature strong {
    display: block;
    font-style: normal;
    font-family: var(--font-primary);
    font-size: 1.3rem;
    margin-top: 0.5em;
}

/* ===================================================================
   ACCORDION (About Me & Contacts)
   =================================================================== */
.about-me { margin: 0 auto 50px auto; max-width: 700px; overflow: hidden; }
.about-me-header { display: flex; align-items: center; padding: 20px; cursor: pointer; }
.about-me-photo {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 3px solid var(--accent-color);
    object-fit: cover;
    margin-right: 20px;
    box-shadow: 0 0 15px rgba(197, 164, 126, 0.4);
}

.about-me-header h3 {
    font-family: var(--font-primary);
    font-size: 1.8rem;
    color: var(--highlight-color);
    flex-grow: 1;
}

.about-me-icon {
    font-size: 1.8rem;
    color: var(--accent-color);
    transition: transform 0.5s ease;
}

.about-me-header.active .about-me-icon { transform: rotate(45deg); }

.about-me-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    padding-top: 0;
    padding-bottom: 0;
}

.about-me-content p { padding: 0 25px 25px 25px; line-height: 1.7; }

/* ===================================================================
   ACCORDION ARCHIVIO STORICO
   =================================================================== */
.custom-accordion-header {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 10px;
    cursor: pointer;
    background-color: #c5a47e;
    border-radius: 50px;
    margin: 1.5rem auto 0 auto;
    width: fit-content;
    box-shadow: var(--shadow-light);
    transition: background-color 0.3s ease, transform 0.2s ease;
    padding: 6px 20px;
}
.custom-accordion-header:hover {
    background-color: #b8956a;
    transform: translateY(-2px);
}

.custom-accordion-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
}

.custom-accordion-icon {
    font-size: 2rem;
    font-weight: 300;
    color: black;
    transition: transform 0.4s ease;
}

/* ✅ Rotazione icona quando attivo */
.custom-accordion-header.active .custom-accordion-icon {
    transform: rotate(90deg);
}

/* ✅ CONTENUTO: DEVE PARTIRE CHIUSO (max-height: 0) */
.custom-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out, padding 0.5s ease-out;
    padding: 0 1.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0 0 15px 15px;
    margin-top: -10px;
}

/* ✅ Quando attivo, il contenuto si espande */
.custom-accordion-content.active {
    /* L'altezza è gestita via JS per l'animazione */
}


/* ===================================================================
   CATEGORY NAVIGATION & BUTTONS
   =================================================================== */
.category-navigation,
.sub-category-navigation {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.category-btn,
.sub-category-btn {
    background-color: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.category-btn.active,
.category-btn:hover,
.sub-category-btn.active,
.sub-category-btn:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(197, 164, 126, 0.5);
    transform: translateY(-2px) scale(1.05);
}

.sub-category-btn { font-size: 0.85rem; padding: 8px 18px; }

/* Search Box */
.search-container { margin: 0 auto 40px auto; max-width: 500px; }
#search-box {
    width: 100%;
    padding: 12px 20px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 50px;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

#search-box::placeholder { color: #adb5bd; }
#search-box:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(197, 164, 126, 0.5);
}

/* ===================================================================
   MENU ITEMS & COURSES
   =================================================================== */
.menu-content { padding: 20px 0; }
.loading-message, .no-results-message {
    color: var(--highlight-color);
    text-align: center;
    width: 100%;
    font-size: 1.2rem;
}

.menu-items-container { display: flex; flex-direction: column; gap: 40px; }

.menu-item {
    display: none;
    flex-direction: column;
    padding: 25px 0 0 0;
    animation: fadeIn 0.8s ease;
    overflow: hidden;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
    transition: z-index 0s 0.5s;
    padding-bottom: 50px;
}

.menu-item.visible { display: flex; }
.menu-item.commenting-active { z-index: 10; transition-delay: 0s; }

.menu-item-img {
    max-width: 50%;
    max-height: 50%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 16px;
    margin-left: auto;
    margin-right: auto;
    border: 4px solid #c5a47e;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.3);
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

.menu-item-info { padding: 0 0; }
.menu-item-info h3 {
    font-family: var(--font-primary);
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: #c5a47e;
    text-align: center;
}

.menu-item-info p {
    margin: 0 auto 12px auto;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-color);
    text-align: center;
    max-width: 70ch;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) rgba(0, 0, 0, 0.1);
}

.menu-item-info > p::-webkit-scrollbar { width: 8px; }
.menu-item-info > p::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); border-radius: 4px; }
.menu-item-info > p::-webkit-scrollbar-thumb { background-color: var(--accent-color); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
.menu-item-info > p::-webkit-scrollbar-thumb:hover { background-color: #c5a47e; filter: brightness(1.2); }

.menu-item-price-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.menu-item-price { font-size: 2rem; color: var(--accent-color); font-weight: bold; }

.menu-item-button {
    padding: 10px 25px;
    background-color: var(--accent-color);
    color: var(--primary-color);
    border: none;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(197, 164, 126, 0.4);
}

.menu-item-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(197, 164, 126, 0.6);
    filter: brightness(1.1);
}

/* ===================================================================
   EVENTI ORIZZONTALI SCORRIBILI
   =================================================================== */
.events-scroll-wrapper {
    display: flex;
    gap: 30px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 20px 10px 30px 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c5a47e rgba(197, 164, 126, 0.15);
}
.events-scroll-wrapper::-webkit-scrollbar {
    height: 8px;
}
.events-scroll-wrapper::-webkit-scrollbar-track {
    background: rgba(197, 164, 126, 0.1);
    border-radius: 4px;
}
.events-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: #c5a47e;
    border-radius: 4px;
}
.events-scroll-wrapper > .menu-item {
    flex: 0 0 auto;
    width: 380px;
    min-width: 280px;
    scroll-snap-align: start;
    margin: 0;
    display: flex !important;
}
.events-scroll-wrapper .card-layout-wrapper {
    flex-direction: column;
}
.events-scroll-wrapper .card-media-column {
    flex: 0 0 auto;
}
.events-scroll-wrapper .menu-item-img {
    max-width: 100%;
    max-height: 450px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.events-scroll-wrapper .menu-item-info h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
}
.events-scroll-wrapper .menu-item-info p {
    font-size: 0.85rem;
    max-height: 100px;
}

@media (max-width: 600px) {
    .events-scroll-wrapper {
        gap: 15px;
        padding: 10px 5px 20px 5px;
    }
    .events-scroll-wrapper > .menu-item {
        width: 280px;
        min-width: 220px;
    }
}

/* ===================================================================
   INTERACTIONS (Like & Comments)
   =================================================================== */
.interaction-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 1.5em 25px 0 25px;
    margin-top: 1em;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.like-btn, .comment-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    padding: 10px 20px;
    font-family: var(--font-secondary);
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.9rem;
}

.like-btn:hover, .comment-toggle-btn:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

.like-btn svg, .comment-toggle-btn svg {
    width: 20px; height: 20px;
    transition: fill 0.3s ease;
    fill: var(--accent-color);
}

.like-btn:hover svg, .comment-toggle-btn:hover svg { fill: var(--primary-color); }

.like-btn.liked {
    background-color: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.like-btn.liked svg { fill: white; animation: like-pop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); }

.comment-area {
    margin: 1.5em 25px 0 25px;
    padding: 1.5em;
    background: rgba(248, 249, 250, 0.7);
    border-radius: 12px;
}

.comment-area h4 { margin-top: 0; margin-bottom: 1em; color: var(--highlight-color); }

.comment-form textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    resize: vertical;
    margin-bottom: 1em;
    background: #fff;
}

.comment-form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 0.5em; }

.comment-form button[type="submit"] {
    background-color: var(--accent-color);
    border: 2px solid var(--accent-color);
    color: var(--primary-color);
    padding: 10px 20px;
    font-family: var(--font-secondary);
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.9rem;
}

.comment-form button[type="submit"]:hover { background-color: transparent; color: var(--accent-color); }

.comment-form .delete-comment-btn {
    background-color: #6c757d;
    border: 2px solid #6c757d;
    color: white;
    padding: 10px 20px;
    font-family: var(--font-secondary);
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.9rem;
}

.comment-form .delete-comment-btn:hover { background-color: #5a6268; border-color: #545b62; }

.comments-list { margin-top: 1.5em; }
.comment-item { border-bottom: 1px solid #eee; padding: 10px 0; }
.comment-item:last-child { border: none; }
.comment-item strong { color: var(--highlight-color); }
.comment-item p { margin: 5px 0 0 0; }

.interaction-bar .disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: transparent !important;
    color: var(--accent-color) !important;
}

.interaction-bar .disabled:hover { background-color: transparent !important; color: var(--accent-color) !important; }

.login-prompt {
    padding: 1.5em;
    text-align: center;
    background-color: rgba(0,0,0,0.02);
    border: 1px dashed #ddd;
    border-radius: 8px;
    margin-bottom: 2em;
}

.login-prompt a { font-weight: bold; color: var(--accent-color); text-decoration: underline; }

/* Close Accordion Button */
.close-accordion-from-bottom-btn {
    position: absolute;
    bottom: 15px; right: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-color);
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-accordion-from-bottom-btn svg { width: 20px; height: 20px; }
.close-accordion-from-bottom-btn:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* ===================================================================
   CTA SECTION
   =================================================================== */
.cta-section {
    background: var(--secondary-color);
    padding: 4rem 1rem;
    text-align: center;
}

.cta-content h2 { font-size: 1.8rem; margin-top: 0; margin-bottom: 0.5rem; }
.cta-content p { max-width: 600px; margin-left: auto; margin-right: auto; margin-bottom: 1rem; }

/* ===================================================================
   FOOTER & BACK TO TOP
   =================================================================== */
.footer {
    border-radius: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 40px;
    margin-top: 40px;
}

.back-to-top {
    position: fixed;
    bottom: 25px; right: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px; height: 50px;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 998;
    transition: all 0.4s ease;
    background-color: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(197, 164, 126, 0.4);
}

.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { transform: scale(1.1); filter: brightness(1.1); }
.back-to-top svg { width: 28px; height: 28px; color: var(--primary-color); }

/* Footer Social Icons */
.footer .about-me-content a { color: var(--accent-color); transition: color 0.3s ease; }
.footer .about-me-content a:hover { color: var(--highlight-color); }
.footer .about-me-content a svg {
    width: 24px; height: 24px;
    vertical-align: middle;
    margin-left: 8px;
    transition: transform 0.3s ease;
}
.footer .about-me-content a:hover svg { transform: scale(1.1); }

.icon-i-container { display: flex; align-items: center; justify-content: center; background-color: transparent; }
.icon-i-char {
    font-family: var(--font-primary);
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-color);
    font-style: italic;
    line-height: 1;
}

/* ===================================================================
   POPUP (Books)
   =================================================================== */
.popup-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.popup-overlay.visible { opacity: 1; visibility: visible; transition: opacity 0.3s ease; }

.popup-content {
    position: relative;
    max-width: 800px;
    width: 100%;
    padding: 30px 40px;
    border-radius: 15px;
    transform: translateY(20px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.popup-overlay.visible .popup-content { transform: translateY(0); opacity: 1; }

.popup-close {
    position: absolute;
    top: 10px; right: 15px;
    background: none; border: none;
    font-size: 2.5rem;
    color: var(--highlight-color);
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: transform 0.2s ease, color 0.2s ease;
    z-index: 10;
}

.popup-close:hover { transform: scale(1.2); color: var(--accent-color); }

.popup-main-title {
    font-family: var(--font-primary);
    color: black;
    font-size: 2.0rem;
    text-align: center;
    margin-top: 0;
    margin-bottom: 30px;
}

#book-list-container { display: flex; flex-direction: column; gap: 15px; }

.book-list-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.book-list-item:hover { background-color: rgba(255, 255, 255, 0.2); transform: scale(1.02); }
.book-list-item img { width: 60px; height: auto; border-radius: 5px; flex-shrink: 0; }
.book-list-item-title { font-family: var(--font-primary); font-size: 1.2rem; color: #ffffff; font-weight: 500; }

.popup-back {
    background: none; border: none;
    color: red;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 20px;
    padding: 5px;
}
.popup-back:hover { text-decoration: underline; }

.book-details { display: flex; align-items: center; gap: 30px; }
.book-image { flex: 0 0 250px; }
.book-image img { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,0.25); }
.book-info { flex: 1 1 auto; }
.book-info h3 { font-family: var(--font-primary); color: var(--accent-color); font-size: 2.2rem; margin-top: 0; margin-bottom: 15px; }
.book-info p { font-family: var(--font-secondary); font-size: 1.1rem; line-height: 1.7; color: #ffffff; margin-bottom: 25px; }
.book-info .menu-item-button { display: inline-block; margin-top: 10px; }

.popup-scroll-arrow {
    position: absolute;
    bottom: 15px; left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.3);
    color: var(--accent-color);
    cursor: pointer;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    animation: bounce 2s infinite;
}

.popup-scroll-arrow.visible { opacity: 1; visibility: visible; }

/* ===================================================================
   LOGIN & CONTACT FORMS
   =================================================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--secondary-color);
    background-image: url('logofede.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 2.5em;
    background-color: transparent;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-light);
    text-align: center;
    color: var(--accent-color);
}

.login-title {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    color: var(--highlight-color);
    margin-bottom: 1.2em;
}

.login-container h2 {
    color: var(--accent-color);
    font-family: var(--font-primary);
    font-size: 2.2rem;
    margin-bottom: 30px;
}

.login-container label {
    color: var(--accent-color);
    font-weight: bold;
    display: block;
    margin-bottom: 8px;
}

.form-group { margin-bottom: 1.5em; text-align: left; }
.form-group input {
    width: 100%;
    padding: 12px 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(197, 164, 126, 0.5);
}

.login-container .btn-primary {
    width: 100%;
    padding: 12px 20px;
    background-color: var(--accent-color);
    color: var(--primary-color);
    border: none;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(197, 164, 126, 0.4);
}

.login-container .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(197, 164, 126, 0.6);
    filter: brightness(1.1);
}

.login-links { margin-top: 1.5em; color: var(--text-color); }
.login-links a { color: var(--accent-color); font-weight: bold; text-decoration: none; }
.login-links a:hover { text-decoration: underline; }

.form-message { padding: 1em; margin-bottom: 1.5em; border-radius: 8px; border: 1px solid transparent; }
.form-message p { margin: 0; }
.error-message { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.success-message { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }

.login-container input[type="text"],
.login-container input[type="password"] { color: #333; }

/* Contact Form */
.contact-form-section { padding: 3em 0; background-color: transparent; }
.contact-form-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2.5em;
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-light);
}

.contact-form-container .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font-secondary);
    outline: none;
    transition: all 0.3s ease;
    resize: vertical;
}

.contact-form-container .form-group textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(197, 164, 126, 0.5);
}

.contact-form-container .btn-primary {
    width: 100%;
    padding: 12px 20px;
    background-color: var(--accent-color);
    color: var(--primary-color);
    border: none;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(197, 164, 126, 0.4);
}

.contact-form-container .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(197, 164, 126, 0.6);
    filter: brightness(1.1);
}

/* ===================================================================
   MEDIA & EMBEDS
   =================================================================== */
.menu-item-video { width: 100%; height: auto; border-radius: 8px; }

.document-link-wrapper {
    padding: 20px;
    text-align: center;
    border: 2px dashed #ccc;
    border-radius: 8px;
}

.document-download-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 10px;
}

.document-icon { font-size: 1.5em; margin-right: 10px; }

.video-container { position: relative; overflow: hidden; }

.video-watermark {
    position: absolute;
    top: 15px; right: 15px;
    font-family: var(--font-primary, 'Cinzel', serif);
    font-size: 1.2rem;
    font-weight: bold;
    color: #c5a47e;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.embedded-pdf-container {
    width: 100%;
    height: 600px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    background-color: #333;
}

.embedded-pdf-container iframe { width: 100%; height: 100%; }

/* ===================================================================
   RESOURCES GRID
   =================================================================== */
#risorse-gratuite { padding-top: 40px; padding-bottom: 40px; }

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.resource-card {
    border: 1px solid rgba(197, 164, 126, 0.2);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.resource-video-wrapper video {
    width: 100%; height: auto;
    display: block;
    background-color: #000;
}

.resource-info { padding: 20px; flex-grow: 1; }
.resource-info h3 { color: #c5a47e; margin-top: 0; margin-bottom: 10px; font-size: 1.4rem; }
.resource-info p { color: #f0f0f0; font-size: 1rem; line-height: 1.6; }

/* ===================================================================
   RESPONSIVE (TABLET & MOBILE) - CORRETTO
   =================================================================== */
@media (max-width: 1024px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background-color: #c5a47e;
        flex-direction: column;
        padding-top: 6rem;
        padding-bottom: 100px; /* ✅ Spazio extra in fondo per scrollare */
        transition: right 0.4s ease-in-out;
        z-index: 1000;
        
        /* ✅ RENDI SCORREVOLE VERTICALMENTE */
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* Scroll fluido su iOS */
    }

    .main-nav.active { right: 0; }
    .nav-link { margin: 1rem 2rem; font-size: 1.2rem; }
    
    /* ✅ Personalizza scrollbar per Chrome/Safari */
    .main-nav::-webkit-scrollbar {
        width: 6px;
    }
    .main-nav::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
    }
    .main-nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }
    .main-nav::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }
    
    .mobile-menu-toggle { display: block; }
    #mobile-menu-btn.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    #mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
    #mobile-menu-btn.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
    
    /* ✅ USER ACTIONS SCORREVOLI ANCHE LORO */
    .user-actions {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background-color: #b8956a; /* Leggermente più scuro per distinguerlo */
        flex-direction: column;
        justify-content: flex-start; /* ✅ Inizia dall'alto per scrollare */
        padding: 6rem 2rem 100px 2rem; /* ✅ Spazio per scroll */
        gap: 15px;
        transition: right 0.4s ease-in-out;
        z-index: 999;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        
        /* ✅ RENDI SCORREVOLE */
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .user-actions.active {
        right: 0;
        display: flex !important;
    }
    
    /* ✅ Scrollbar per user-actions */
    .user-actions::-webkit-scrollbar {
        width: 6px;
    }
    .user-actions::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
    }
    .user-actions::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }
    
    .user-actions .btn-primary,
    .user-actions .btn-secondary {
        width: 100%;
        text-align: center;
        padding: 15px 20px;
        font-size: 1rem;
        flex-shrink: 0; /* ✅ Evita che i bottoni si schiaccino */
    }
    
    .user-actions .welcome-user {
        text-align: center;
        padding: 10px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        margin-bottom: 10px;
        display: block !important;
        flex-shrink: 0; /* ✅ Evita che il testo si schiacci */
    }
}


@media (max-width: 768px) {
    .container { max-width: 100%; padding-left: 15px; padding-right: 15px; }
    .section-title { font-size: 1.8rem; margin: 50px 0 30px; }

    .hero { min-height: 450px; padding: 60px 15px 40px; }
    .hero-title { font-size: clamp(1.8rem, 7.5vw, 1.8rem); }
    .hero h2 { font-size: 1.3rem; margin-top: 1rem; }

    .about-content { flex-direction: column; gap: 25px; padding: 20px; }
    .about-text, .about-text .signature { text-align: center; }

    .category-btn, .sub-category-btn { padding: 8px 16px; font-size: 0.85rem; }
    .menu-item { padding: 20px 0; max-width: 95%; }
    .menu-item-img { max-width: 92%; }
    .menu-item-info h3 { font-size: 1.2rem; }

    .menu-item-price-action { flex-direction: column; align-items: flex-start; gap: 12px; }
    .menu-item-price { font-size: 1.7rem; }

    .video-watermark { font-size: 0.9rem; top: 10px; right: 10px; }
    .embedded-pdf-container { height: 500px; }

    .about-me-photo { width: 64px; height: 64px; }
    .about-me-header h3 { font-size: 1.5rem; }
    .social-links { gap: 20px; }
    .social-links svg { width: 28px; height: 28px; }

    .popup-content { padding: 15px 8px 15px; max-height: 90vh; overflow-y: auto; }
    .book-details { flex-direction: column; text-align: center; gap: 20px; }
    .book-image { width: 65%; max-width: 220px; }
    .book-info h3 { font-size: 1.8rem; }
    .book-info p { font-size: 1rem; }

    .back-to-top { bottom: 18px; right: 18px; width: 44px; height: 44px; }
    .back-to-top svg { width: 24px; height: 24px; }

    .header-container { padding: 0 1rem; }
    
    /* ✅ SU MOBILE: Mostra sempre i pulsanti quando il menu è aperto */
    .user-actions .welcome-user {
        display: none !important;
    }
}

/* ===================================================================
   ACCORDION DENTRO LE CARD DEI CORSI
   =================================================================== */
.accordion-container {
    padding: 0 25px 25px 25px;
    width: 100%;
}

.accordion-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    margin-top: 10px;
    transition: background-color 0.3s ease;
    border: 1px solid rgba(197, 164, 126, 0.2);
}

.accordion-item-header:hover {
    background-color: rgba(197, 164, 126, 0.1);
}

.accordion-item-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #c5a47e;
    font-family: var(--font-primary);
}

.accordion-icon {
    font-size: 1.5rem;
    color: var(--accent-color);
    transition: transform 0.4s ease;
    font-weight: 300;
}

.accordion-item-header.active .accordion-icon {
    transform: rotate(45deg);
}

/* ✅ CONTENUTO ACCORDION - DEVE PARTIRE NASCOSTO */
.accordion-item-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding: 0 15px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 8px 8px;
}

.accordion-item-content p {
    padding: 20px 0;
    margin: 0;
    max-width: 80ch;
    color: var(--text-color);
    line-height: 1.7;
}

/* ✅ ACCESSIBILITÀ - FOCUS VISIBILE */
.accordion-item-header:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
