/* ============================================================
   NTA Reviews — Frontend Styles
   Brand: #ffd60a (yellow), #0F3D94 (navy), #111 (dark)
   ============================================================ */

:root {
    --nta-yellow: #ffd60a;
    --nta-navy:   #0F3D94;
    --nta-dark:   #111111;
    --nta-gray:   #f4f6fb;
    --nta-border: #e2e6ef;
    --nta-text:   #333333;
    --nta-muted:  #6b7280;
    --nta-radius: 10px;
    --nta-shadow: 0 2px 12px rgba(15,61,148,.09);
    --nta-trans:  .32s ease;
}

/* ── Wrapper ──────────────────────────────────────────────── */
.nta-reviews-wrap {
    font-family: inherit;
    color: var(--nta-text);
    max-width: 860px;
    margin: 0 auto;
}

/* ── Tabs ─────────────────────────────────────────────────── */
.nta-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
    border-bottom: 2px solid var(--nta-border);
    padding-bottom: 0;
}

.nta-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--nta-muted);
    cursor: pointer;
    transition: color var(--nta-trans), border-color var(--nta-trans);
    letter-spacing: .01em;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    line-height: 1.2;
    margin-bottom: -2px;
    box-shadow: none;
}

.nta-tab:hover {
    background: transparent;
    color: var(--nta-navy);
    border-bottom-color: var(--nta-border);
}

.nta-tab--active {
    background: transparent;
    color: var(--nta-navy);
    border-bottom: 3px solid var(--nta-navy);
    box-shadow: none;
}

.nta-tab__count {
    font-size: .75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: transparent;
    color: var(--nta-muted);
    transition: background var(--nta-trans), color var(--nta-trans);
}

.nta-tab--active .nta-tab__count {
    background: var(--nta-yellow);
    color: var(--nta-dark);
}

/* ── Panel ────────────────────────────────────────────────── */
.nta-panel--hidden {
    display: none;
}

/* ── Accordion list ───────────────────────────────────────── */
.nta-accordion {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Review card ──────────────────────────────────────────── */
.nta-card {
    --nta-card-bg: #fff;
    background: var(--nta-card-bg);
    border: none;
    border-radius: var(--nta-radius);
    box-shadow: none;
    padding: 18px 20px 10px;
    cursor: pointer;
    transition: background-color .25s ease;
}

@media (hover: hover) {
    .nta-card:hover { --nta-card-bg: #f8f9fc; }
}

/* ── Card header ──────────────────────────────────────────── */
.nta-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

/* ── Avatar: initials ─────────────────────────────────────── */
.nta-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--nta-navy);
    color: #fff;
    font-size: .85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: .04em;
    line-height: 1;
    overflow: hidden;
}

/* ── Avatar: photo ────────────────────────────────────────── */
.nta-avatar--img {
    background: var(--nta-gray);
    padding: 0;
}

.nta-avatar__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.nta-card__meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nta-card__name {
    font-weight: 700;
    font-size: .9rem;
    color: var(--nta-dark);
    line-height: 1.2;
}

.nta-card__date {
    font-size: .78rem;
    color: var(--nta-muted);
}

/* ── Stars ────────────────────────────────────────────────── */
.nta-card__stars {
    display: flex;
    gap: 1px;
    font-size: 1rem;
    flex-shrink: 0;
}

.nta-star--full  { color: var(--nta-yellow); }
.nta-star--empty { color: #dde1ea; }

/* ── Review text (single element: clamped when closed, full when open) ── */
/* Closed: clamped to ~3 lines with a fade at the bottom.
   Open: JS sets max-height to the measured full height → one smooth expansion.
   The 1200px on the expanded rule is only a fallback before JS runs. */
.nta-card__full {
    position: relative;
    max-height: 5.1em; /* ~3 lines @ line-height 1.7 (closed clamp) */
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: .88rem;
    line-height: 1.7;
    color: var(--nta-text);
    margin-bottom: 4px;
}

/* Fade-out gradient hinting there's more text (closed state only) */
.nta-card__full::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.1em;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--nta-card-bg, #fff));
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.nta-card--expanded .nta-card__full {
    max-height: 1200px; /* fallback; JS overrides with measured scrollHeight */
}

.nta-card--expanded .nta-card__full::after {
    opacity: 0; /* no fade once expanded */
}

.nta-card__full p {
    margin: 0 0 .6em;
}

.nta-card__full p:last-child {
    margin-bottom: 0;
}

.nta-card__full a {
    /* Links are clickable without triggering card toggle (handled in JS) */
    position: relative;
    z-index: 1;
}

/* ── Toggle: centered chevron arrow (desktop only) ────────── */
/* Inspired by nta-recensioni-slider: CSS-drawn corner rotated to arrow */
.nta-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 10px 0 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--nta-navy);
    opacity: 0.5;
    transition: opacity 0.35s ease;
}

.nta-toggle:hover,
.nta-card:hover .nta-toggle { opacity: 1; }

.nta-toggle__icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-top: 2.5px solid currentColor;
    border-right: 2.5px solid currentColor;
    border-radius: 1px;
    transform: rotate(135deg); /* ↓ pointing down */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nta-card--expanded .nta-toggle__icon {
    transform: rotate(-45deg); /* ↑ pointing up */
}

/* ── Discover CTA button ──────────────────────────────────── */
.nta-discover-btn {
    display: block;
    width: fit-content;
    margin: 0 auto 28px;
    text-align: center;
    padding: 11px 26px;
    background: var(--nta-navy);
    color: #fff;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 6px;
    letter-spacing: .03em;
    transition: background var(--nta-trans);
}

.nta-discover-btn:hover {
    background: #0a2d6e;
    color: #fff;
    text-decoration: none;
}

/* ── Empty state ──────────────────────────────────────────── */
.nta-empty {
    color: var(--nta-muted);
    font-style: italic;
    padding: 20px 0;
    text-align: center;
    font-size: .9rem;
}

/* ── Torna su button (desktop) ────────────────────────────── */
.nta-back-top {
    display: block;
    margin: 32px auto 0;
    padding: 10px 28px;
    background: none;
    border: 2px solid var(--nta-navy);
    border-radius: 4px;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 700;
    color: var(--nta-navy);
    cursor: pointer;
    letter-spacing: .06em;
    text-transform: uppercase;
    transition: background var(--nta-trans), color var(--nta-trans);
    width: fit-content;
}

.nta-back-top:hover {
    background: var(--nta-navy);
    color: #fff;
}

/* ── Accessibility: focus outlines ───────────────────────── */
.nta-tab:focus-visible,
.nta-toggle:focus-visible,
.nta-carousel-arrow:focus-visible,
.nta-carousel-dot:focus-visible {
    outline: 2px solid var(--nta-navy);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    .nta-tabs {
        flex-direction: column;
        gap: 0;
        border-bottom: none;
        margin-bottom: 20px;
    }

    .nta-tab {
        width: 100%;
        border-bottom: none;
        border-left: 3px solid transparent;
        padding: 10px 14px;
        font-size: .95rem;
        text-align: left;
    }

    .nta-tab--active {
        border-bottom: none;
        border-left: 3px solid var(--nta-navy);
    }

    .nta-tab:hover {
        border-bottom-color: transparent;
        border-left-color: var(--nta-border);
    }

    .nta-card {
        padding: 16px 16px 12px;
        box-sizing: border-box;
    }

    .nta-avatar {
        width: 36px;
        height: 36px;
        font-size: .78rem;
    }

    .nta-card__name  { font-size: .85rem; }
    .nta-card__stars { font-size: .9rem; }

    /* Hide elements not used in carousel */
    .nta-back-top { display: none; }
    .nta-toggle   { display: none; }

    /* Full text always visible in carousel (no clamp, no fade) */
    .nta-card__full {
        max-height: none;
        overflow: visible;
        transition: none;
    }

    .nta-card__full::after { display: none; }

    /* Accordion becomes the slide viewport */
    .nta-accordion {
        position: relative;
        overflow: hidden;
        gap: 0;
    }

    /* Cards hidden by default; only active slide shown */
    .nta-card               { display: none; }
    .nta-card.nta-card--active { display: block; }

    /* ── Carousel wrapper (injected by JS) ─────────────────── */
    /* Full width: arrows now live in the bottom nav bar, not side gutters,
       so the review text can use the whole card width (was too narrow). */
    .nta-carousel-wrap {
        position: relative;
        padding: 0;
    }

    /* ── Bottom nav bar: prev — dots — next ────────────────── */
    .nta-carousel-nav {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 14px;
        margin-top: 16px;
    }

    /* ── Arrows (inline in the nav bar) ────────────────────── */
    .nta-carousel-arrow {
        position: static;
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--nta-navy);
        opacity: 0.55;
        transition: opacity var(--nta-trans);
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .nta-carousel-arrow:not([disabled]):active,
    .nta-carousel-arrow:not([disabled]):hover { opacity: 1; }

    .nta-carousel-arrow[disabled] { opacity: 0.18; cursor: default; }

    /* CSS-drawn chevron — matches nta-recensioni-slider icon style */
    .nta-carousel-arrow::before {
        content: '';
        display: block;
        width: 12px;
        height: 12px;
        border-top: 2.5px solid currentColor;
        border-right: 2.5px solid currentColor;
        border-radius: 1px;
    }

    .nta-carousel-arrow--prev::before { transform: rotate(-135deg) translate(2px, -2px); }
    .nta-carousel-arrow--next::before { transform: rotate(45deg) translate(-2px, -2px); }

    /* ── Dot indicators ────────────────────────────────────── */
    .nta-carousel-dots {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
    }

    .nta-carousel-dot {
        position: relative;
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--nta-border);
        border: none;
        padding: 0;
        cursor: pointer;
        transition: background var(--nta-trans), transform var(--nta-trans);
        -webkit-tap-highlight-color: transparent;
    }

    /* Extended tap area */
    .nta-carousel-dot::after {
        content: '';
        display: block;
        position: absolute;
        inset: -8px;
    }

    .nta-carousel-dot--active {
        background: var(--nta-navy);
        transform: scale(1.5);
    }
}
