/* ==========================================================================
   Homepage Showcase - "Cashback in evidenza"
   HERO SLIDESHOW: un solo merchant per volta, full-width.
   Layout premium, editoriale, mobile-first
   Verde coerente con il brand Migliorcashback
   ========================================================================== */

:root {
    --showcase-green: #059669;
    --showcase-green-dark: #047857;
    --showcase-green-light: #ecfdf5;
    --showcase-green-bg: rgba(5, 150, 105, 0.9);
}

/* ── Utility: screen-reader only ───────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Section wrapper ───────────────────────────────────────────── */
.homepage-showcase {
    padding: 32px 0 8px;
    margin-bottom: 0;
}

/* ════════════════════════════════════════════════════════════════
   CASO UNICO: Singolo merchant (hero full-width)
   Mantenuta per compatibilità con 1 solo merchant
   ════════════════════════════════════════════════════════════════ */
.showcase-grid--single {
    display: block;
}

/* ════════════════════════════════════════════════════════════════
   SLIDER: Nuovo layout slideshow - 1 merchant per volta
   ════════════════════════════════════════════════════════════════ */
.showcase-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.showcase-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.showcase-slide {
    flex: 0 0 100%;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

/* ════════════════════════════════════════════════════════════════
   Card base (hero full-width per ogni slide)
   ════════════════════════════════════════════════════════════════ */
.showcase-card {
    display: block;
    position: relative;
    border-radius: 0;
    overflow: hidden;
    text-decoration: none;
    color: var(--color-white);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.showcase-card:focus-visible {
    outline: 2px solid var(--showcase-green);
    outline-offset: -3px;
    border-radius: var(--radius-lg);
}

/* ── Hero card (unica tipologia) ───────────────────────────────── */
.showcase-card--hero {
    width: 100%;
    aspect-ratio: 21 / 10;
    min-height: 260px;
    display: block;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: var(--color-white);
}

@media (min-width: 768px) {
    .showcase-card--hero {
        min-height: 340px;
        aspect-ratio: 21 / 9;
    }
}

@media (min-width: 1024px) {
    .showcase-card--hero {
        min-height: 400px;
        max-height: 430px;
        aspect-ratio: 21 / 8;
    }
}

@media (min-width: 1400px) {
    .showcase-card--hero {
        max-height: 440px;
    }

    .showcase-card--hero .showcase-content {
        padding-left: 120px;
        max-width: 780px;
    }

    .showcase-arrow--prev {
        left: 32px;
    }

    .showcase-arrow--next {
        right: 32px;
    }
}

.showcase-card--hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.showcase-card--hero:focus-visible {
    outline: 2px solid var(--showcase-green);
    outline-offset: 2px;
    border-radius: var(--radius-lg);
}

/* ── Card inner ────────────────────────────────────────────────── */
.showcase-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ════════════════════════════════════════════════════════════════
   Image
   ════════════════════════════════════════════════════════════════ */
.showcase-image-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.showcase-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}

/* ── Overlay di velatura ──────────────────────────────────────────
     Overlay scuro orizzontale per migliorare la leggibilità dei testi
     sovrapposti alle immagini della vetrina.

     Più intenso a sinistra (dove sono posizionati testi e CTA),
     sfuma gradualmente verso destra dove spesso ci sono soggetti.
     Non copre mai del tutto l'immagine: la lascia visibile ma
     rende il testo ben leggibile senza affidarsi solo al text-shadow. */
.showcase-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.46) 12%,
        rgba(0, 0, 0, 0.32) 28%,
        rgba(0, 0, 0, 0.18) 48%,
        rgba(0, 0, 0, 0.08) 68%,
        transparent 88%,
        transparent 100%
    );
    opacity: 1;
    pointer-events: none;
    z-index: 1;
}

/* ── Text shadow per leggibilità ────────────────────────────────
     Ombra leggera sui testi per compensare l'overlay minimale. */
.showcase-content .showcase-title,
.showcase-content .showcase-desc,
.showcase-content .showcase-cashback-value {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

/* ════════════════════════════════════════════════════════════════
   Content - logo e testi in un unico blocco coeso
   ════════════════════════════════════════════════════════════════ */
.showcase-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 32px 28px;
    max-width: 600px;
}

.showcase-card--hero .showcase-content {
    padding: 48px 56px 48px 100px;
    max-width: 720px;
}

/* ── Logo badge ────────────────────────────────────────────────── */
.showcase-logo-badge {
    position: relative;
    top: auto;
    left: auto;
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 64px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.showcase-logo-badge img {
    width: auto;
    height: auto;
    max-width: 80%;
    max-height: 75%;
    object-fit: contain;
    display: block;
}

.showcase-card--hero .showcase-logo-badge {
    width: 182px;
    height: 117px;
    padding: 8px 14px;
    margin-bottom: 14px;
}

.showcase-card--hero .showcase-logo-badge img {
    max-width: 166px;
    max-height: 100px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ── Badge chip ────────────────────────────────────────────────── */
.showcase-chip {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--showcase-green);
    color: var(--color-white);
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

/* ── Titolo ────────────────────────────────────────────────────── */
.showcase-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-white);
    margin-bottom: 6px;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ── Descrizione ───────────────────────────────────────────────── */
.showcase-desc {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ── Cashback ──────────────────────────────────────────────────── */
.showcase-cashback {
    margin-bottom: 12px;
}

.showcase-cashback-value {
    display: inline-block;
    background: var(--showcase-green-bg);
    color: var(--color-white);
    font-size: var(--font-size-lg);
    font-weight: 800;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    letter-spacing: -0.3px;
    text-shadow: none;
}

/* ── CTA button ────────────────────────────────────────────────── */
.showcase-cta {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    background: var(--showcase-green);
    color: var(--color-white);
    font-size: var(--font-size-sm);
    font-weight: 700;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    transition:
        background 0.2s ease,
        transform 0.15s ease;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.showcase-card:hover .showcase-cta {
    background: var(--showcase-green-dark);
    transform: translateY(-1px);
}

.showcase-card:active .showcase-cta {
    transform: scale(0.97);
}

/* ════════════════════════════════════════════════════════════════
   FRECCE ELEGANTI - stile premium semi-trasparente
   ════════════════════════════════════════════════════════════════ */
.showcase-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #1f2937;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition:
        opacity 0.35s ease,
        background 0.25s ease,
        transform 0.25s ease,
        box-shadow 0.25s ease;
    opacity: 0.4;
    padding: 0;
}

/* Di default: poco visibili, appaiono su hover della vetrina */
.showcase-slider:hover .showcase-arrow,
.showcase-arrow:focus-visible {
    opacity: 1;
}

/* Hover sulla freccia: più contrasto, ombra */
.showcase-arrow:hover {
    background: rgba(255, 255, 255, 0.92);
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Focus visibile */
.showcase-arrow:focus-visible {
    outline: 2px solid var(--showcase-green);
    outline-offset: 2px;
    opacity: 1;
}

/* Attivo: leggero feedback */
.showcase-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.showcase-arrow--prev {
    left: 24px;
}

.showcase-arrow--next {
    right: 24px;
}

/* Icona SVG della freccia */
.showcase-arrow svg {
    display: block;
    width: 22px;
    height: 22px;
}

/* ════════════════════════════════════════════════════════════════
   INDICATORI (dots)
   ════════════════════════════════════════════════════════════════ */
.showcase-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 14px 0 2px;
}

.showcase-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition:
        background 0.3s ease,
        transform 0.2s ease;
}

.showcase-indicator:hover {
    background: var(--color-text-muted);
    transform: scale(1.2);
}

.showcase-indicator--active {
    background: var(--showcase-green);
    transform: scale(1.2);
}

.showcase-indicator:focus-visible {
    outline: 2px solid var(--showcase-green);
    outline-offset: 2px;
}

/* ════════════════════════════════════════════════════════════════
   Mobile (≤767px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .homepage-showcase {
        padding: 20px 0 12px;
    }

    .showcase-grid--single {
        padding: 0 16px;
    }

    .showcase-card--hero {
        border-radius: var(--radius-md);
        min-height: 240px;
        aspect-ratio: 16 / 10;
    }

    .showcase-card--hero .showcase-content {
        padding: 28px 24px;
        max-width: 100%;
    }

    .showcase-card--hero .showcase-logo-badge {
        width: 143px;
        height: 91px;
        padding: 6px 10px;
        margin-bottom: 14px;
    }

    .showcase-card--hero .showcase-logo-badge img {
        max-width: 130px;
        max-height: 78px;
    }

    .showcase-slider {
        border-radius: var(--radius-md);
        margin: 0 16px;
    }

    .showcase-card {
        border-radius: var(--radius-md);
    }

    /* Mobile: overlay più presente perché testo e immagine
       si sovrappongono maggiormente su schermi stretti */
    .showcase-overlay,
    .referral-hero-overlay {
        background: linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.6) 0%,
            rgba(0, 0, 0, 0.52) 15%,
            rgba(0, 0, 0, 0.38) 32%,
            rgba(0, 0, 0, 0.22) 52%,
            rgba(0, 0, 0, 0.1) 75%,
            transparent 100%
        );
    }

    .showcase-content {
        padding: 20px;
        max-width: 100%;
    }

    .showcase-title {
        font-size: var(--font-size-lg);
    }

    .showcase-desc {
        font-size: var(--font-size-xs);
        -webkit-line-clamp: 1;
    }

    .showcase-chip {
        top: 10px;
        right: 10px;
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    .showcase-cashback {
        margin-bottom: 10px;
    }

    .showcase-cashback-value {
        font-size: var(--font-size-base);
        padding: 3px 10px;
    }

    .showcase-cta {
        font-size: var(--font-size-xs);
        padding: 8px 18px;
    }

    .showcase-logo-badge {
        width: 90px;
        height: 58px;
        padding: 6px 10px;
        margin-bottom: 12px;
    }

    /* Frecce nascoste su mobile */
    .showcase-arrow {
        display: none;
    }

    .showcase-indicators {
        gap: 6px;
        padding: 10px 0 0;
    }

    .showcase-indicator {
        width: 8px;
        height: 8px;
    }
}

/* ════════════════════════════════════════════════════════════════
   Tablet (768px - 1023px)
   ════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
    .showcase-card--hero {
        min-height: 320px;
        max-height: 360px;
    }

    .showcase-card--hero .showcase-content {
        padding: 32px 32px 32px 72px;
        max-width: 560px;
    }

    .showcase-card--hero .showcase-logo-badge {
        width: 156px;
        height: 99px;
        padding: 6px 12px;
    }

    .showcase-card--hero .showcase-logo-badge img {
        max-width: 144px;
        max-height: 86px;
    }

    .showcase-arrow--prev {
        left: 20px;
    }

    .showcase-arrow--next {
        right: 20px;
    }
}

/* ════════════════════════════════════════════════════════════════
   Mobile extra-small (≤400px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
    .showcase-card--hero {
        min-height: 200px;
    }

    .showcase-card--hero .showcase-content {
        padding: 20px 18px;
    }

    .showcase-card--hero .showcase-logo-badge {
        width: 117px;
        height: 75px;
        padding: 5px 8px;
        margin-bottom: 10px;
    }

    .showcase-card--hero .showcase-logo-badge img {
        max-width: 106px;
        max-height: 64px;
    }

    .showcase-logo-badge {
        width: 72px;
        height: 46px;
        padding: 4px 8px;
        margin-bottom: 8px;
    }

    .showcase-content {
        padding: 14px;
    }

    .showcase-title {
        font-size: var(--font-size-base);
    }

    .showcase-cashback {
        margin-bottom: 8px;
    }

    .showcase-cashback-value {
        font-size: var(--font-size-sm);
    }

    .showcase-cta {
        font-size: 0.6rem;
        padding: 6px 14px;
    }

    .showcase-desc {
        display: none;
    }

    .showcase-chip {
        display: none;
    }
}

/* ════════════════════════════════════════════════════════════════
   Reduced motion
   ════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .showcase-card:hover {
        transform: none;
    }

    .showcase-card--hero:hover {
        transform: none;
    }

    .showcase-track {
        transition: none;
    }

    .showcase-arrow {
        display: none;
    }
}

/* ════════════════════════════════════════════════════════════════
   Dark mode adjustments
   ════════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
    .showcase-logo-badge {
        background: var(--color-white);
    }

    .referral-hero-card .showcase-image-wrapper {
        background: #065f46;
    }

    .referral-hero-chip {
        background: rgba(255, 255, 255, 0.12);
    }

    .showcase-overlay,
    .referral-hero-overlay {
        background: linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.6) 0%,
            rgba(0, 0, 0, 0.52) 12%,
            rgba(0, 0, 0, 0.38) 28%,
            rgba(0, 0, 0, 0.22) 48%,
            rgba(0, 0, 0, 0.1) 68%,
            transparent 88%,
            transparent 100%
        );
    }
}

/* Dark mode via classe manuale (toggle utente) */
html.dark-mode .showcase-overlay,
html.dark-mode .referral-hero-overlay {
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.52) 12%,
        rgba(0, 0, 0, 0.38) 28%,
        rgba(0, 0, 0, 0.22) 48%,
        rgba(0, 0, 0, 0.1) 68%,
        transparent 88%,
        transparent 100%
    );
}

/* ==========================================================================
   Referral Hero Card (solo utenti loggati in homepage)
   ========================================================================== */

.referral-hero-card .showcase-image-wrapper {
    background: #009977;
}

.referral-hero-overlay {
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.42) 12%,
        rgba(0, 0, 0, 0.28) 28%,
        rgba(0, 0, 0, 0.14) 48%,
        rgba(0, 0, 0, 0.06) 68%,
        transparent 88%,
        transparent 100%
    );
}

.referral-hero-chip {
    top: 20px !important;
    left: 20px !important;
    right: auto !important;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.referral-hero-amount {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1;
    color: var(--color-white);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    margin-top: 8px;
}

.referral-hero-amount-label {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-white);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 12px;
}

.referral-hero-sub {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--color-white);
    margin: 0 0 4px 0;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

.referral-hero-sub strong {
    font-weight: 800;
}

.referral-hero-micro {
    font-size: 0.85rem;
    opacity: 0.85;
    line-height: 1.5;
    color: var(--color-white);
    margin: 0 0 18px 0;
    max-width: 440px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.referral-hero-cta {
    align-self: flex-start;
}

@media (max-width: 767px) {
    .referral-hero-amount {
        font-size: 2.8rem;
        margin-top: 4px;
    }

    .referral-hero-amount-label {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .referral-hero-sub {
        font-size: 0.95rem;
    }

    .referral-hero-micro {
        font-size: 0.8rem;
        max-width: 100%;
        margin-bottom: 14px;
    }

    .referral-hero-chip {
        top: 12px !important;
        left: 12px !important;
        font-size: 0.7rem;
        padding: 4px 10px;
    }
}
