/* ============================================================
   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;
    --font-cursive: 'Dancing Script', cursive;
}

/* Impedisce lo scroll orizzontale anomalo su dispositivi mobili */
html, body { 
    overflow-x: hidden; 
}

body { 
    font-family: var(--font-ui); 
    background-color: #f8f9fa; 
    color: #334155;
}

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 i bordi blu/viola del focus nativo */
*: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;
}

/* Logo Stemma Parrocchiale */
.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;
}

/* Link di Navigazione Desktop: Tutto su un'unica riga centrata */
.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;
}

/* Fix freccia dropdown Gruppi: bloccata accanto al testo senza andare a capo */
.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 Desktop: Colonna Singola Elegante senza icone */
.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 Autenticazione & Dashboard */
.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);
}

/* Avatar Circolare */
.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 Generico (Profilo e Voci) */
.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 (< 992px)
   ============================================================ */
@media (max-width: 991.98px) {
    .navbar-brand-text {
        white-space: normal;
        font-size: 0.85rem;
    }

    /* Cassetto collassabile opaco agganciato esattamente sotto la barra */
    .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;
    }

    /* Voci a schede con icone e freccia */
    .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;
    }

    /* Dropdown Gruppi Mobile: Colonna Singola */
    .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;
    }

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

    /* Tasto Dashboard Mobile: Coerente con lo stile di login/registrazione */
    #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. HERO SECTION
   ============================================================ */
/* ============================================================
   HERO BACKGROUND OTTIMIZZATO (WEBP ULTRA-LEGGERO)
   ============================================================ */
.hero {
    height: 100vh; 
    min-height: 600px;
    padding-top: 76px; 
    margin-top: 0;
    position: relative;
    background-size: cover; 
    background-position: right center; 
    background-repeat: no-repeat;
    /* Immagine WebP Desktop compressa */
    background-image: url('/media/backg.webp'); 
}

/* Sfumatura scura per garantire leggibilità al testo bianco */
.hero::before {
    content: ''; 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: linear-gradient(to right, rgba(15, 23, 42, 0.8) 0%, rgba(15, 23, 42, 0.4) 100%);
    z-index: 1;
}

/* Solo su schermi Desktop grandi (> 992px) possiamo attivare il parallax leggero */
@media (min-width: 992px) {
    .hero {
        background-attachment: fixed;
    }
}

/* COMPORTAMENTO SMARTPHONE (< 992px): Immagine verticale leggera */
@media (max-width: 991.98px) {
    .hero {
        background-image: url('/media/backg_mobile.webp'); 
        background-position: center center;
        background-attachment: scroll; /* Rimuove il lag allo scorrimento su Safari iOS/Chrome Mobile */
    }
    
    .hero::before { 
        background: linear-gradient(rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.78)); 
    }
    
    .hero-logo { height: 140px; }
    .hero-title { font-size: 3.5rem; }
    .hero-welcome { text-align: center; font-size: 1.5rem; }
}

.hero-content-wrapper { 
    position: relative; 
    z-index: 2; 
}

.hero-logo { 
    height: 170px; 
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.5)); 
}

.hero-welcome { 
    font-family: var(--font-ui); 
    font-size: 1.8rem; 
    font-weight: 500;
    color: #ffffff; 
    text-transform: uppercase;
    letter-spacing: 4px; 
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5); 
    margin-bottom: 15px; 
    opacity: 0.95; 
}

.hero-title { 
    font-size: clamp(2.5rem, 5vw, 4.8rem); 
    line-height: 1.1; 
    text-shadow: 2px 2px 15px rgba(0, 0, 0, 0.8); 
}

.hero-subtitle { 
    font-size: 1.05rem; 
    letter-spacing: 2px; 
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.8); 
}

.hero-location { 
    font-size: 1.3rem; 
    letter-spacing: 5px; 
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.8); 
}

.hero-quote { 
    font-family: var(--font-cursive); 
    font-size: 3rem; 
    color: rgba(255, 255, 255, 0.4); 
    line-height: 1.3; 
}


/* ============================================================
   5. COMPONENTI UI & CARD
   ============================================================ */
.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;
}

.modern-title-left::after {
    left: 0;
    transform: none;
}

.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; 
}

.overlap-top { 
    margin-top: -40px; 
    position: relative; 
    z-index: 10; 
}

.btn-to-bacheca {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-red);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.btn-to-bacheca i {
    transition: transform 0.3s ease;
}

.btn-to-bacheca:hover {
    color: var(--accent-gold);
}

.btn-to-bacheca:hover i {
    transform: translateX(5px);
}


/* ============================================================
   6. COOKIE BANNER
   ============================================================ */
.cookie-banner {
    position: fixed;
    bottom: 30px;
    right: 30px; 
    max-width: 400px;
    z-index: 9999;
    transform: translateY(150%);
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.cookie-banner.show {
    transform: translateY(0);
}

.btn-cookie {
    background-color: var(--primary-red);
    color: white;
    font-weight: 600;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.btn-cookie:hover {
    background-color: var(--primary-red-hover);
    color: white;
}

@media (max-width: 576px) {
    .cookie-banner {
        bottom: 20px;
        left: 20px;
        right: 20px;
        max-width: none;
    }
}


/* ============================================================
   7. ANIMAZIONI SCROLL (REVEAL)
   ============================================================ */
.fade-in-up {
    animation: fadeInUp 1s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

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

.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);
}

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }

@media (max-width: 768px) {
    .delay-1, .delay-2, .delay-3, .delay-4 { 
        transition-delay: 0s; 
    }
}


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

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

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

/* Effetto interattivo sui contatti */
.hover-primary-red {
    transition: color 0.25s ease;
}

.hover-primary-red:hover {
    color: var(--primary-red) !important;
    text-decoration: underline !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);
}