/* ============================================================
   1. VARIABILI E OVERRIDE BASE
   ============================================================ */
   :root {
    --primary-red: #9e3129;
    --primary-red-hover: #7a251f;
    --accent-gold: #c6a052;
    --font-ui: 'Inter', sans-serif;
    --font-serif: 'Lora', serif;
}

html, body { 
    overflow-x: hidden; 
}

body { 
    font-family: var(--font-ui); 
    background-color: #f8f9fa; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    color: #334155;
}

main { 
    flex-grow: 1; 
}

h1, h2, h3, h4, h5, h6, .font-serif { 
    font-family: var(--font-serif); 
}

.text-primary-red { color: var(--primary-red) !important; }
.bg-primary-red { background-color: var(--primary-red) !important; }
.text-accent-gold { color: var(--accent-gold) !important; }

/* Rimuove contorni focus nativi */
*:focus, *:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}


/* ============================================================
   2. NAVBAR STRUTTURA & COMPONENTI (76PX FISSI)
   ============================================================ */
.navbar {
    height: 76px;
    padding: 0 !important;
    background-color: var(--primary-red) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1030;
}

.navbar > .container-fluid {
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-logo {
    height: 45px;
    width: auto;
    background: #ffffff;
    border-radius: 8px;
    padding: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand-text {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    line-height: 1.25;
}

.navbar-nav .nav-link {
    font-weight: 500;
    letter-spacing: 0.4px;
    padding: 0.5rem 0.85rem !important;
    border-radius: 50rem;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center;
    line-height: 1;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
}

.navbar-nav .dropdown-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    white-space: nowrap !important;
}

.navbar-nav .dropdown-toggle::after {
    display: inline-block;
    vertical-align: middle;
    margin-left: 3px !important;
}

/* Dropdown Gruppi: Colonna Singola */
.gruppi-dropdown-menu {
    min-width: 290px;
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(158, 49, 41, 0.25) transparent;
}

.gruppi-dropdown-menu::-webkit-scrollbar {
    width: 5px;
}

.gruppi-dropdown-menu::-webkit-scrollbar-thumb {
    background: rgba(158, 49, 41, 0.25);
    border-radius: 10px;
}

/* Pulsanti */
.btn-auth {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-weight: 600;
    border-radius: 50rem;
    padding: 7px 22px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.btn-auth:hover {
    background-color: #ffffff;
    color: var(--primary-red);
    border-color: #ffffff;
}

.btn-outline-light-custom {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    text-decoration: none;
    padding: 7px 18px;
    border-radius: 50rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-outline-light-custom:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.cursor-pointer { 
    cursor: pointer; 
}

.avatar-circle {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
    user-select: none;
}

.avatar-circle:hover {
    transform: scale(1.05);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 1.2rem;
    padding: 8px 0;
}

.dropdown-item {
    font-weight: 500;
    color: #334155;
    padding: 8px 20px;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.92rem;
}

.dropdown-item:hover {
    background-color: rgba(158, 49, 41, 0.06);
    color: var(--primary-red);
}

.dropdown-item.text-danger:hover {
    background-color: rgba(158, 49, 41, 0.1);
    color: #9e3129 !important;
}


/* ============================================================
   3. RESPONSIVE MOBILE NAVBAR (< 992px)
   ============================================================ */
@media (max-width: 991.98px) {
    .navbar-brand-text {
        white-space: normal;
        font-size: 0.85rem;
    }

    .navbar-collapse {
        position: absolute;
        top: 76px;
        left: 0;
        right: 0;
        background-color: var(--primary-red);
        padding: 1.2rem 1.25rem 1.8rem;
        box-shadow: 0 20px 35px rgba(0, 0, 0, 0.4);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-nav-list {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        margin: 0 0 1rem 0 !important;
        padding: 0 !important;
    }

    .w-100-mobile {
        width: 100% !important;
    }

    .mobile-pill-link {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.75rem 1.1rem !important;
        background-color: rgba(255, 255, 255, 0.08);
        border-radius: 0.9rem !important;
        font-size: 1rem;
        font-weight: 500;
    }

    .mobile-pill-link:hover,
    .mobile-pill-link:active,
    .mobile-pill-link:focus {
        background-color: rgba(255, 255, 255, 0.18) !important;
    }

    .mobile-nav-icon {
        font-size: 1.15rem;
        color: var(--accent-gold);
        width: 24px;
        text-align: center;
    }

    .gruppi-dropdown-menu {
        background-color: rgba(0, 0, 0, 0.25) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 0.9rem !important;
        padding: 0.5rem !important;
        box-shadow: none !important;
        width: 100% !important;
        max-height: 280px;
    }

    .gruppi-dropdown-menu .dropdown-item {
        color: #ffffff;
        border-radius: 0.5rem;
        padding: 0.65rem 1rem;
        font-size: 0.92rem;
    }

    .gruppi-dropdown-menu .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.15);
        color: #ffffff;
    }

    .navbar-auth {
        padding-top: 0.8rem;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        width: 100%;
    }

    #adminBtnContainer {
        width: 100%;
    }

    #adminBtnContainer .btn-auth {
        display: block;
        width: 100%;
        text-align: center;
        padding: 9px 0;
        font-size: 0.95rem;
        font-weight: 600;
        background-color: rgba(255, 255, 255, 0.15);
        color: #ffffff;
        border: 1px solid rgba(255, 255, 255, 0.35);
        border-radius: 50rem;
        box-shadow: none;
        transition: all 0.25s ease;
    }

    #adminBtnContainer .btn-auth:hover,
    #adminBtnContainer .btn-auth:active {
        background-color: #ffffff;
        color: var(--primary-red);
        border-color: #ffffff;
    }

    #unloggedView {
        width: 100%;
        display: flex;
        gap: 0.6rem;
    }

    #unloggedView a {
        flex: 1;
        text-align: center;
        padding: 9px 0;
    }

    #unloggedView .btn-outline-light-custom {
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
}


/* ============================================================
   4. HEADER PAGINA BACHECA
   ============================================================ */
.page-header {
    padding-top: 130px; 
    padding-bottom: 30px;
}

.modern-title {
    position: relative;
    display: inline-block;
    padding-bottom: 15px;
}

.modern-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--accent-gold);
    border-radius: 3px;
}


/* ============================================================
   5. BARRA DI RICERCA & FILTRI
   ============================================================ */
.search-container {
    max-width: 700px;
    margin: 0 auto;
}

.search-input-wrapper {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 50rem;
    padding: 4px 8px;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.search-input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(198, 160, 82, 0.3);
    border-color: var(--accent-gold);
}

.search-input-wrapper input { 
    border: none !important; 
    box-shadow: none !important; 
    background: transparent; 
}

.btn-gold {
    background-color: var(--accent-gold);
    color: #ffffff;
    font-weight: 600;
    border-radius: 50rem;
    padding: 8px 20px;
    border: none;
    transition: opacity 0.2s ease;
}

.btn-gold:hover {
    background-color: #b28f45;
    color: #ffffff;
}

.btn-category {
    border: 1.5px solid #dee2e6;
    color: #64748b;
    border-radius: 50rem;
    padding: 6px 18px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    background: #ffffff;
}

.btn-category:hover, 
.btn-category.active {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: #ffffff;
}

.btn-red-custom {
    background-color: var(--primary-red);
    color: #ffffff;
    font-weight: 600;
    border-radius: 50rem;
    padding: 10px 24px;
    border: none;
    transition: background-color 0.2s ease;
}

.btn-red-custom:hover {
    background-color: var(--primary-red-hover);
    color: #ffffff;
}


/* ============================================================
   6. CARD BACHECA & PAGINAZIONE
   ============================================================ */
.card-hover { 
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); 
}

.card-hover:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12) !important; 
}

.pagination { 
    justify-content: center; 
    margin-top: 3rem; 
    gap: 4px;
}

.pagination .page-link { 
    color: #334155; 
    border-radius: 50rem !important; 
    border: none; 
    font-weight: 600; 
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.pagination .page-item.active .page-link { 
    background-color: var(--primary-red) !important; 
    color: #ffffff !important; 
    box-shadow: 0 4px 10px rgba(158, 49, 41, 0.3); 
}

.pagination .page-link:hover:not(.active) { 
    background-color: rgba(158, 49, 41, 0.08); 
    color: var(--primary-red);
}


/* ============================================================
   7. ANIMAZIONI SCROLL
   ============================================================ */
.reveal { 
    opacity: 0; 
    transform: translateY(40px); 
    transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1); 
}

.reveal.active { 
    opacity: 1; 
    transform: translateY(0); 
}

.fade-in-up { 
    animation: fadeInUp 0.8s cubic-bezier(0.165, 0.84, 0.44, 1) forwards; 
    opacity: 0; 
    transform: translateY(20px); 
}

@keyframes fadeInUp { 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}


/* ============================================================
   8. FOOTER
   ============================================================ */
.footer-link { 
    color: rgba(255, 255, 255, 0.6); 
    text-decoration: none; 
    transition: color 0.3s ease; 
    font-size: 0.85rem; 
}

.footer-link:hover { 
    color: #ffffff; 
}

footer { 
    flex-shrink: 0; 
}

#saveProfileBtn:hover,
#saveProfileBtn:focus {
    background-color: var(--primary-red-hover) !important;
    color: #ffffff !important;
}

/* ============================================================
   ARTICOLI FISSATI IN EVIDENZA (PINNED POSTS)
   ============================================================ */
   .card-pinned {
    border: 1.5px solid var(--accent-gold) !important;
    position: relative;
}

.badge-pinned {
    background-color: var(--accent-gold) !important;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    padding: 5px 12px;
    box-shadow: 0 2px 6px rgba(198, 160, 82, 0.35);
}