/**
 * Etinion Testimoni — ettn-testimonial.css
 * Widget: Etinion Testimoni
 * Prefix: ettn-
 */

/* ══════════════════════════════════════════════════════
   1. ROOT & LAYOUT
   ══════════════════════════════════════════════════════ */

.ettn-testimonial {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* ── Grid Mode ── */
.ettn-grid {
    display: grid;
    grid-template-columns: repeat(var(--ettn-cols-d, 3), 1fr);
    gap: var(--ettn-gap, 24px);
    /* Prevent box-shadow clipping on all edges */
    padding: 10px 16px;
    margin: -10px -16px;
}

@media (max-width: 1024px) {
    .ettn-grid {
        grid-template-columns: repeat(var(--ettn-cols-t, 2), 1fr);
    }
}

@media (max-width: 767px) {
    .ettn-grid {
        grid-template-columns: repeat(var(--ettn-cols-m, 1), 1fr);
    }
}

/* ── Horizontal Scroll (Grid mode) ── */

/* Shared hscroll base: flex row, scroll, vertical-only shadow breathing */
.ettn-hscroll-desktop .ettn-grid,
.ettn-hscroll-mobile .ettn-grid {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* Only vertical padding/margin to avoid clipping top/bottom box-shadow.
       NO horizontal padding — keeps card widths exactly matching visible area. */
    padding: 12px 0;
    margin: -12px 0;
}

/* Cards inside hscroll must use auto height so align-items:stretch
   can equalise them to the tallest card */
.ettn-hscroll-desktop .ettn-grid > .ettn-card,
.ettn-hscroll-mobile .ettn-grid > .ettn-card {
    height: auto;
}

/* Desktop horizontal scroll */
@media (min-width: 1025px) {
    .ettn-hscroll-desktop .ettn-grid {
        gap: var(--ettn-gap-d, 24px);
        /* Hide scrollbar by default, show on hover */
        scrollbar-width: thin;
        scrollbar-color: transparent transparent;
    }

    .ettn-hscroll-desktop .ettn-grid:hover {
        scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
    }

    .ettn-hscroll-desktop .ettn-grid::-webkit-scrollbar {
        height: 6px;
    }

    .ettn-hscroll-desktop .ettn-grid::-webkit-scrollbar-track {
        background: transparent;
        border-radius: 3px;
    }

    .ettn-hscroll-desktop .ettn-grid::-webkit-scrollbar-thumb {
        background: transparent;
        border-radius: 3px;
        transition: background 0.2s ease;
    }

    .ettn-hscroll-desktop .ettn-grid:hover::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.5);
    }

    .ettn-hscroll-desktop .ettn-grid::-webkit-scrollbar-thumb:hover {
        background: rgba(148, 163, 184, 0.8);
    }

    .ettn-hscroll-desktop .ettn-grid > .ettn-card {
        flex: 0 0 var(--ettn-card-w-d, 32%);
        min-width: var(--ettn-card-w-d, 32%);
        scroll-snap-align: start;
    }
}

/* Tablet horizontal scroll */
@media (min-width: 768px) and (max-width: 1024px) {
    .ettn-hscroll-mobile .ettn-grid {
        gap: var(--ettn-gap-t, 20px);
        scrollbar-width: thin;
        scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
    }

    .ettn-hscroll-mobile .ettn-grid::-webkit-scrollbar {
        height: 4px;
    }

    .ettn-hscroll-mobile .ettn-grid::-webkit-scrollbar-track {
        background: transparent;
    }

    .ettn-hscroll-mobile .ettn-grid::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.3);
        border-radius: 2px;
    }

    .ettn-hscroll-mobile .ettn-grid > .ettn-card {
        flex: 0 0 var(--ettn-card-w-t, 48%);
        min-width: var(--ettn-card-w-t, 48%);
        scroll-snap-align: start;
    }
}

/* Mobile horizontal scroll */
@media (max-width: 767px) {
    .ettn-hscroll-mobile .ettn-grid {
        gap: var(--ettn-gap-m, 16px);
        scrollbar-width: none;
    }

    .ettn-hscroll-mobile .ettn-grid::-webkit-scrollbar {
        display: none;
    }

    .ettn-hscroll-mobile .ettn-grid > .ettn-card {
        flex: 0 0 var(--ettn-card-w-m, 100%);
        min-width: var(--ettn-card-w-m, 100%);
        scroll-snap-align: start;
    }
}

/* ══════════════════════════════════════════════════════
   2. VIEWPORT — CAROUSEL
   ══════════════════════════════════════════════════════ */

.ettn-viewport {
    overflow: hidden;
    position: relative;
    width: 100%;
    /* Negative margin + matching padding pushes overflow clip edge outward
       so box-shadow on first/last card is not clipped. */
    padding-left: 16px;
    padding-right: 16px;
    margin-left: -16px;
    margin-right: -16px;
    touch-action: pan-y pinch-zoom;
    -webkit-user-select: none;
    user-select: none;
}

.ettn-shadow-frame {
    padding: 10px 0;
    box-sizing: border-box;
    width: 100%;
}

.ettn-track {
    display: flex;
    align-items: stretch;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    gap: var(--ettn-gap, 24px);
}

.ettn-testimonial.is-dragging .ettn-track {
    transition: none !important;
}

.ettn-track img,
.ettn-track a {
    -webkit-user-drag: none;
    user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: auto;
}

.ettn-track a img {
    pointer-events: none;
}

.ettn-slide {
    flex: 0 0 auto;
    display: flex;
    height: auto;
    min-width: 0;
    width: var(--ettn-slide-w, 32%);
    max-width: var(--ettn-slide-w, 32%);
}

.ettn-slide > * {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

/* ══════════════════════════════════════════════════════
   3. CARD BASE
   ══════════════════════════════════════════════════════ */

.ettn-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
    box-sizing: border-box;
    border: 1px solid #eef1f6;
}

/* ── Card Style: Classic ── */
.ettn-style-classic .ettn-card {
    align-items: flex-start;
    text-align: left;
}

/* ── Card Style: Quote ── */
.ettn-style-quote .ettn-card {
    position: relative;
    padding-top: 48px;
}

/* ── Card Style: Bubble ── */
.ettn-style-bubble .ettn-card {
    position: relative;
    border-radius: 16px 16px 16px 0;
}

.ettn-style-bubble .ettn-card::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 24px;
    width: 0;
    height: 0;
    border-left: 14px solid #fff;
    border-right: 14px solid transparent;
    border-top: 14px solid #fff;
    border-bottom: 14px solid transparent;
}

/* ══════════════════════════════════════════════════════
   4. CARD ELEMENTS
   ══════════════════════════════════════════════════════ */

/* ── Quote Icon ── */
.ettn-quote-icon {
    margin-bottom: 12px;
    color: #3b82f6;
    font-size: 28px;
    line-height: 1;
}

.ettn-quote-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* ── Rating ── */
.ettn-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 12px;
}

.ettn-star {
    display: inline-flex;
    color: #e2e8f0;
    font-size: 16px;
    line-height: 1;
}

.ettn-star svg {
    width: 16px;
    height: 16px;
}

.ettn-star.is-active {
    color: #fbbf24;
}

.ettn-star.is-half {
    position: relative;
    color: #e2e8f0;
}

.ettn-star.is-half::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
}

/* ── Review Text ── */
.ettn-review {
    font-size: 15px;
    line-height: 1.6;
    color: #475569;
    margin-bottom: 16px;
    flex: 1 1 auto;
}

/* ── Author ── */
.ettn-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    width: 100%;
}

.ettn-style-centered .ettn-author {
    flex-direction: column;
    text-align: center;
}

.ettn-photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.ettn-author-info {
    min-width: 0;
}

.ettn-name {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a2e;
    line-height: 1.3;
}

.ettn-position {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 2px;
}

/* ══════════════════════════════════════════════════════
   5. NAVIGATION
   ══════════════════════════════════════════════════════ */

.ettn-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ettn-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    color: #334155;
    transition: all 0.2s ease;
    flex: 0 0 auto;
}

.ettn-arrow:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.ettn-arrow svg {
    width: 18px;
    height: 18px;
}

.ettn-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
}

.ettn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.ettn-dot.is-active {
    background: #3b82f6;
    width: 24px;
    border-radius: 4px;
}

/* ══════════════════════════════════════════════════════
   6. DRAG STATE
   ══════════════════════════════════════════════════════ */

.ettn-testimonial.is-dragging .ettn-track {
    transition: none !important;
}

.ettn-testimonial.is-dragging .ettn-card {
    pointer-events: none;
    user-select: none;
}

.ettn-testimonial.is-dragging,
.ettn-testimonial.is-dragging .ettn-viewport,
.ettn-testimonial.is-dragging .ettn-card {
    cursor: grabbing !important;
}

/* ══════════════════════════════════════════════════════
   7. ELEMENTOR EDITOR
   ══════════════════════════════════════════════════════ */

.elementor-editor-active .ettn-testimonial .ettn-card a {
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════
   8. RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    .ettn-card {
        padding: 20px;
    }

    .ettn-review {
        font-size: 14px;
    }

    .ettn-arrow {
        width: 36px;
        height: 36px;
    }

    .ettn-viewport {
        padding-left: 0;
        padding-right: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .ettn-shadow-frame {
        padding: 6px;
    }
}
