/* ================================================
   index.css
   Stili specifici della homepage (index.php).
   Dipende da: base.css (caricato prima).

   Contiene: hero h1, layout wrapper, banner ricerca,
             news card, empty state, loading overlay,
             transizioni pagina, ad card, paginazione,
             giornalini, bottone "mostra altri".
================================================ */

/* ================================================
   HERO — layout, titolo, immagine, CTA
================================================ */
.hero-title {
    background: linear-gradient(135deg, #b45309 0%, #ff7000 50%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

@media (min-width: 768px) {
    .hero-row {
        flex-direction: row;
        align-items: center;
    }
}

.hero-img-wrap {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.hero-elisa-img {
    max-height: 400px;
    width: auto;
    object-fit: contain;
    display: block;
}

.hero-text {
    flex: 1;
    text-align: left;
}

.hero-subtitle {
    font-size: 1.25rem;
    line-height: 1.75;
    color: #374151;
    margin-bottom: 1.5rem;
}

.hero-cta {
    display: inline-block;
    background: linear-gradient(135deg, #b45309, #ff7000);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.75rem 1.75rem;
    border-radius: 9999px;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 4px 14px rgba(255,112,0,0.35);
}

.hero-cta:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* ================================================
   SECTION SUBTITLES — link sotto i titoletti
================================================ */
.section-subtitle {
    color: #374151;
    font-weight: 500;
}

.section-subtitle a {
    color: #b45309;
    text-decoration: underline;
    text-decoration-color: rgba(180,83,9,0.4);
    text-underline-offset: 3px;
    transition: color 0.15s;
}

.section-subtitle a:hover {
    color: #ff7000;
}

/* ================================================
   LAYOUT WRAPPER (desktop 2 colonne)
================================================ */
@media (min-width: 1024px) {
    .layout-wrapper { display: flex; max-width: 100%; margin: 0 auto; }
    .main-content   { width: 98%; }
}

/* ================================================
   NEWS CARD — layout flip 50/50
================================================ */
.news-card {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    border: 2px solid transparent;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    overflow: hidden;
    margin-bottom: 1rem;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.news-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.card-body {
    display: flex;
    align-items: flex-start;
    /*min-height: 110px;*/
}

.card-body--img-left  { flex-direction: row; }
/* da invertire, il problema lo ha il js */
.card-body--img-right { flex-direction: row-reverse; }

.card-media {
    flex: 0 0 170px;
    width: 170px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem;
}

.card-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0px 0px 10px 10px;
}

.card-text {
    flex: 1;
    padding: 0.85rem 0.85rem 0.85rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    min-width: 0;
}

.card-body--img-right .card-text {
    padding: 0.85rem 0 0.85rem 0.85rem;
}

.card-subtitle { font-size: 0.82rem; color: #6b7280; margin: 0; font-style: italic; }
.card-date     { font-size: 0.78rem; font-weight: 600; color: #2563eb; margin: 0; }
.card-location { font-size: 0.82rem; font-weight: 600; color: #374151; margin: 0; }
.card-meta     { font-size: 0.78rem; color: #6b7280; margin: 0; }
.card-author   { font-size: 0.82rem; font-weight: 600; color: #4b5563; margin: 0; }

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 640px) {
    .card-body--img-left,
    .card-body--img-right { flex-direction: row; }

    .card-media {
        flex: 0 0 30%;
        width: 30%;
        padding: 0.5rem;
    }

    .card-thumb {
        height: 70px;
        border-radius: 6px;
    }

    .card-badges .inline-block { font-size: 0.65rem; padding: 1px 6px; }

    .card-text { flex: 1; padding: 0.5rem 0.5rem 0.5rem 0; }

    .card-body--img-right .card-text { padding: 0.5rem 0 0.5rem 0.5rem; }

    .card-title  { font-size: 0.82rem; -webkit-line-clamp: 4; }
    .card-date, .card-meta, .card-location, .card-author { font-size: 0.7rem; }
}

/* ================================================
   EMPTY STATE
================================================ */
.empty-state  { text-align: center; padding: 2.5rem 1rem; color: #6b7280; }
.empty-title  { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.25rem; }
.empty-sub    { font-size: 0.85rem; }

/* ================================================
   LOADING OVERLAY — sovrapposto al contenuto
================================================ */
#eventsContainer,
#postsContainer {
    position: relative;
    min-height: 120px;
}

#eventsContainer.is-loading::after,
#postsContainer.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(255, 248, 240, 0.72);
    backdrop-filter: blur(3px);
    border-radius: 12px;
}

#eventsContainer.is-loading::before,
#postsContainer.is-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 11;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255,112,0,0.20);
    border-top-color: #ff7000;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    pointer-events: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================
   TRANSIZIONI PAGINA
================================================ */
@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

#eventsContainer.content-exit,
#postsContainer.content-exit { opacity: 0.4; }

#eventsContainer.content-enter,
#postsContainer.content-enter { animation: contentFadeIn 0.28s ease-out both; }

.loader-skeleton {
    height: 100px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f3e8d0 25%, #fde9c4 50%, #f3e8d0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    margin-bottom: 0.75rem;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ================================================
   AD CARDS
================================================ */
.ad-card {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 1px 8px rgba(0,0,0,0.07);
    background: #fff;
}

.ad-wrapper {
    position: relative;
    width: 100%;
    padding-top: 35%; /* rapporto 1000×350 */
    overflow: hidden;
}

.ad-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease;
}

/* Canvas overlay hover-to-play GIF */
.ad-gif-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.25s ease;
    z-index: 2;
}

/* Tooltip "animazione al passaggio del cursore" */
.ad-card:has(.ad-gif-canvas) .ad-wrapper::after {
    content: "▶  animazione al passaggio del cursore";
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.4);
    padding: 2px 7px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 3;
}

/* Bottone mute video mp4 */
.ad-mute-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 6px;
    transition: background 0.2s;
}

.ad-mute-btn:hover { background: rgba(0, 0, 0, 0.80); }
.ad-mute-icon { width: 100%; height: 100%; }

/* ================================================
   PAGINAZIONE
================================================ */
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    background: rgba(255,255,255,0.75);
    border: 1px solid #e5e7eb;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #ff7000;
    border-color: #ff7000;
    color: #fff;
}

.pagination-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.pagination-info {
    font-size: 0.82rem;
    color: #6b7280;
    align-self: center;
}

/* ================================================
   GIORNALINI
================================================ */
.giornalino-card {
    background: rgba(255,255,255,0.88) !important;
    transition: box-shadow 0.25s, transform 0.25s,
                max-height 0.45s ease, opacity 0.4s ease, margin 0.4s ease;
    overflow: hidden;
}

.giornalino-card:hover {
    box-shadow: 0 8px 24px rgba(255,112,0,0.18);
    transform: translateY(-3px);
}

.giornalino-card img { transition: transform 0.3s ease; }
.giornalino-card:hover img { transform: scale(1.05); }

.giornalino-hidden {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.giornalino-card:not(.giornalino-hidden) {
    max-height: 400px;
    opacity: 1;
}

/* ================================================
   PULSANTE "MOSTRA ALTRI GIORNALINI"
================================================ */
.giornalini-more-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 1.8rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #ff7000 0%, #ffaa00 100%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(255,112,0,0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.giornalini-more-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 28px rgba(255,112,0,0.45);
    background: linear-gradient(135deg, #e56500 0%, #ff9900 100%);
}

.giornalini-more-btn:active { transform: scale(0.97); }

.giornalini-more-icon {
    display: flex;
    align-items: center;
    animation: bounceDown 1.6s ease-in-out infinite;
}

.giornalini-more-icon svg { width: 20px; height: 20px; }

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(4px); }
}

/* ================================================
   NAVBAR RIGHT (search + admin)
================================================ */
.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Icona admin */
.admin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.2s;
}

.admin-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.admin-btn:hover { background: rgba(255,255,255,0.35); }

/* ================================================
   FILTER TOGGLE BUTTON — bottone fisso desktop
================================================ */
.filter-toggle-btn {
    position: fixed;
    top: 76px;
    left: 12px;
    z-index: 46;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #ff7000;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 3px 14px rgba(255,112,0,0.40);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.filter-toggle-btn:hover {
    background: #e56500;
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(255,112,0,0.50);
}

.filter-toggle-btn:active { transform: scale(0.97); }

.filter-toggle-btn svg {
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-toggle-btn.sidebar-open svg {
    transform: rotate(180deg);
}

@media (max-width: 767px) {
    .filter-toggle-btn { display: none !important; }
}

/* ================================================
   FILTER SIDEBAR (desktop)
================================================ */
.filter-sidebar {
    position: fixed;
    left: 0;
    top: 64px;
    width: min(22vw, 280px);
    height: calc(100vh - 64px);
    z-index: 45;
    background: rgba(255, 252, 245, 0.97);
    backdrop-filter: blur(8px);
    border-right: 1px solid rgba(255, 112, 0, 0.18);
    box-shadow: 4px 0 24px rgba(0,0,0,0.09);
    overflow-y: auto;
    padding: 3.5rem 1rem 2rem;
    transform: translateX(-110%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-sidebar.open {
    transform: translateX(0);
}

.filter-sidebar-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid rgba(255,112,0,0.20);
}

/* ================================================
   FILTER GROUPS & CHIPS (shared desktop + mobile)
================================================ */
.filter-group {
    margin-bottom: 1.1rem;
}

.filter-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #9ca3af;
    margin-bottom: 0.55rem;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* Base chip (usato per "Tutti" — rimane neutro arancione) */
.filter-chip {
    padding: 0.28rem 0.75rem;
    border-radius: 9999px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    color: #374151;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filter-chip:not(.filter-chip--cat):not(.filter-chip--loc):hover {
    border-color: #ff7000;
    color: #ff7000;
}

.filter-chip:not(.filter-chip--cat):not(.filter-chip--loc).filter-chip--active {
    background: #ff7000;
    border-color: #ff7000;
    color: #fff;
}

/* Chip categorie — turchese/blu come i badge dei post */
.filter-chip--cat { color: #1e40af; border-color: #bfdbfe; }
.filter-chip--cat:hover { background: #dbeafe; border-color: #1e40af; }
.filter-chip--cat.filter-chip--active {
    background: #1e40af;
    border-color: #1e40af;
    color: #fff;
}

/* Chip luoghi — verde come i badge dei post */
.filter-chip--loc { color: #166534; border-color: #bbf7d0; }
.filter-chip--loc:hover { background: #dcfce7; border-color: #166534; }
.filter-chip--loc.filter-chip--active {
    background: #166534;
    border-color: #166534;
    color: #fff;
}

/* ================================================
   DESKTOP — animazione spostamento contenuto
================================================ */
@media (min-width: 768px) {
    main.relative {
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    body.filter-open main.relative {
        margin-left: min(22vw, 280px);
    }
}

/* ================================================
   MOBILE FILTER BUTTON (navbar)
================================================ */
.mobile-filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.mobile-filter-btn:hover        { background: rgba(255,255,255,0.35); }
.mobile-filter-btn.drawer-open  { background: rgba(255,255,255,0.40); }

/* ================================================
   MOBILE FILTER DRAWER
================================================ */
.mobile-filter-drawer {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 44;
    background: rgba(255, 252, 245, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.13);
    border-bottom: 1px solid rgba(255,112,0,0.15);
    padding: 1rem 1.25rem 1.25rem;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    max-height: calc(100vh - 64px);
}

.mobile-filter-drawer.open {
    transform: translateY(0);
}

/* ================================================
   RESPONSIVE — hide/show per device
================================================ */
@media (min-width: 768px) {
    .mobile-filter-drawer { display: none !important; }
    .mobile-filter-btn    { display: none !important; }
}

@media (max-width: 767px) {
    .filter-sidebar { display: none !important; }
}

/* ================================================
   MOBILE
================================================ */
@media (max-width: 768px) {

    .navbar-inner {
        justify-content: space-between;
        padding: 0 1.25rem;
    }

    /* Logo più piccolo e a sinistra */
    .navbar-logo img {
        height: 30px !important;
        width: auto;
        /*max-width: 140px;*/
    }

    /* Nascondi search desktop */
    .search-wrapper {
        display: none !important;
    }

    /* Admin a destra — gap esplicito dal logo */
    .navbar-right {
        margin-left: auto;
        padding-left: 1rem;
    }
}