/**
 * Aha Orbit Testimonials PRO — 3D Carousel Layout CSS.
 *
 * Loaded ONLY when the 3D Carousel layout is active.
 *
 * @package Aha_Orbit_Testimonials_Pro
 * @since   1.2.0
 */

/* ── CSS custom property defaults (overridable via per-orbit meta) ──────── */
.otp-layout-carousel-3d {
    --ot-text-primary: #1e293b;
    --ot-text-secondary: #64748b;
    --ot-accent-color: #3b82f6;
    --ot-card-bg: #ffffff;
    --ot-name-color: var(--ot-accent-color);
    --ot-role-color: var(--ot-text-secondary);
    --ot-quote-color: var(--ot-text-secondary);
    --ot-arrow-color: var(--ot-text-secondary);
    --ot-bullet-color: var(--ot-text-secondary);
    --ot-bullet-active-color: var(--ot-accent-color);
    --ot-transition-speed: 800ms;

    position: relative;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    color: var(--ot-text-primary);
    overflow: visible;
    /* Crucial to show reflections */
}

.otp-layout-carousel-3d *,
.otp-layout-carousel-3d *::before,
.otp-layout-carousel-3d *::after {
    box-sizing: border-box;
}

/* ── Container ───────────────────────────────────────────────────────────── */
.otp-carousel-3d-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    min-height: 510px;
    /* Base height to handle perspective spacing and reflections */
}

/* ── 3D Stage & Track ────────────────────────────────────────────────────── */
.otp-carousel-3d-stage {
    flex-grow: 1;
    overflow: visible;
    /* Crucial to prevent clipping of 3D rotated cards and reflections */
    perspective: 1000px;
    perspective-origin: 50% 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: auto;
    min-height: 430px;
    position: relative;
    cursor: grab;
}

.otp-carousel-3d-stage.ot-is-dragging {
    cursor: grabbing;
}

.otp-carousel-3d-track {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform var(--ot-transition-speed) cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.otp-carousel-3d-stage.ot-is-dragging .otp-carousel-3d-track {
    transition: none !important;
}

/* ── Slides ──────────────────────────────────────────────────────────────── */
.otp-carousel-3d-slide {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 340px;
    min-height: 410px;
    height: auto;
    margin-left: -170px;
    margin-top: -205px;
    transform-style: preserve-3d;
    transition: transform var(--ot-transition-speed) cubic-bezier(0.25, 1, 0.5, 1),
        opacity var(--ot-transition-speed) ease,
        z-index var(--ot-transition-speed) step-end;
    will-change: transform, opacity;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.otp-carousel-3d-slide.is-active {
    pointer-events: auto;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.otp-carousel-3d-card {
    background: var(--ot-card-bg);
    border-radius: 24px;
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.06), 0 5px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    height: 100%;
    width: 100%;
    position: relative;
    backface-visibility: hidden;
    /* Smooth scaling hover effect when active */
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Glassmorphism adjustment for dark colors */
.otp-layout-carousel-3d[style*="--ot-card-bg"] .otp-carousel-3d-card {
    backdrop-filter: blur(10px);
}

/* Active card specific glow/neon border */
.otp-carousel-3d-slide.is-active .otp-carousel-3d-card {
    border-color: color-mix(in srgb, var(--ot-accent-color) 40%, transparent);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08),
        0 0 15px color-mix(in srgb, var(--ot-accent-color) 20%, transparent);
}

/* ── Reflection Effect ───────────────────────────────────────────────────── */
.otp-has-reflection .otp-carousel-3d-card {
    -webkit-box-reflect: below 12px linear-gradient(transparent 50%, rgba(255, 255, 255, 0.15) 100%);
}

/* Quote Icon */
.otp-3d-quote-icon {
    position: absolute;
    top: 1.25rem;
    left: 1.5rem;
    color: var(--ot-quote-color);
    opacity: 0.15;
    display: flex;
}

.otp-3d-quote-icon svg {
    width: 60px;
    height: 60px;
}

/* Star Rating */
.otp-3d-star-rating {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 0.25rem 0;
}

.otp-layout-carousel-3d .otp-3d-star {
    font-size: 1.4rem;
    color: #d1d5db;
    transition: color 0.2s ease;
    user-select: none;
}

.otp-layout-carousel-3d .otp-3d-star--filled {
    color: #f59e0b;
}

.otp-layout-carousel-3d .otp-3d-star--half {
    position: relative;
    display: inline-block;
    color: #d1d5db;
}

.otp-layout-carousel-3d .otp-3d-star--half::after {
    content: "\2605";
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
    color: #f59e0b;
}

/* Testimonial Text */
.otp-3d-text {
    font-size: 1.05rem;
    line-height: 1.6;
    font-style: italic;
    font-weight: 500;
    color: var(--ot-text-primary);
    margin: 0;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Limit lines to prevent text overflow in fixed height card */
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: visible;
    text-overflow: ellipsis;
}

/* Author block */
.otp-3d-author {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.otp-3d-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 72px;
    height: 72px;
}

.otp-layout-carousel-3d .otp-carousel-3d-card img.otp-3d-avatar-img,
.otp-3d-avatar-img {
    width: 72px !important;
    height: 72px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    border: 3px solid var(--ot-card-bg) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
    max-width: none !important;
}

.otp-3d-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4776e6, #8e54e9);
    /* fallback */
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    text-transform: uppercase;
    user-select: none;
    border: 3px solid var(--ot-card-bg);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

/* Cycling gradients per slide */
.otp-carousel-3d-slide:nth-child(6n+1) .otp-3d-avatar-initials {
    background: linear-gradient(135deg, #4776e6, #8e54e9);
}

.otp-carousel-3d-slide:nth-child(6n+2) .otp-3d-avatar-initials {
    background: linear-gradient(135deg, #0ba360, #3cba92);
}

.otp-carousel-3d-slide:nth-child(6n+3) .otp-3d-avatar-initials {
    background: linear-gradient(135deg, #f7971e, #ffd200);
}

.otp-carousel-3d-slide:nth-child(6n+4) .otp-3d-avatar-initials {
    background: linear-gradient(135deg, #f953c6, #b91d73);
}

.otp-carousel-3d-slide:nth-child(6n+5) .otp-3d-avatar-initials {
    background: linear-gradient(135deg, #1a85ff, #00c6fb);
}

.otp-carousel-3d-slide:nth-child(6n+6) .otp-3d-avatar-initials {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

/* Social badge inside avatar */
.otp-3d-avatar-wrap .otp-3d-social-badge {
    width: 24px;
    height: 24px;
}

.otp-3d-avatar-wrap .otp-3d-social-badge svg {
    width: 14px;
    height: 14px;
}

.otp-3d-author-info {
    margin-bottom: 0.25rem;
}

.otp-3d-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ot-name-color);
    margin: 0 0 0.15rem;
    line-height: 1.3;
}

.otp-3d-role {
    font-size: 0.85rem;
    color: var(--ot-role-color);
    margin: 0;
    font-weight: 500;
}

.otp-layout-carousel-3d .otp-carousel-3d-card img.otp-3d-company-logo,
.otp-3d-company-logo {
    display: block !important;
    max-height: 24px !important;
    width: auto !important;
    max-width: 90px !important;
    margin: 0.35rem auto 0 !important;
    object-fit: contain !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: 0.7;
    filter: grayscale(20%);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.otp-layout-carousel-3d .otp-carousel-3d-card img.otp-3d-company-logo:hover,
.otp-3d-company-logo:hover {
    opacity: 1;
    filter: grayscale(0%);
}

/* ── Social badges ───────────────────────────────────────────────────────── */
.otp-layout-carousel-3d .otp-3d-social-badge-link {
    display: block;
    text-decoration: none;
}

.otp-layout-carousel-3d .otp-3d-social-badge {
    position: absolute;
    bottom: -1px;
    right: -1px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #555;
    color: #fff;
    border: 2px solid var(--ot-card-bg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    z-index: 3;
    transition: transform 0.2s ease;
    pointer-events: auto;
    width: 24px;
    height: 24px;
}

.otp-layout-carousel-3d .otp-3d-social-badge-link:hover .otp-3d-social-badge {
    transform: scale(1.15);
}

.otp-layout-carousel-3d .otp-3d-social-badge svg {
    width: 14px;
    height: 14px;
    display: block;
    fill: currentColor;
}

.otp-layout-carousel-3d .otp-3d-social-badge--facebook {
    background: #1877f2;
}

.otp-layout-carousel-3d .otp-3d-social-badge--instagram {
    background: radial-gradient(circle at 30% 110%, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.otp-layout-carousel-3d .otp-3d-social-badge--linkedin {
    background: #0a66c2;
}

.otp-layout-carousel-3d .otp-3d-social-badge--twitter {
    background: #000;
}

.otp-layout-carousel-3d .otp-3d-social-badge--youtube {
    background: #ff0000;
}

.otp-layout-carousel-3d .otp-3d-social-badge--tiktok {
    background: #010101;
}

.otp-layout-carousel-3d .otp-3d-social-badge--google {
    background: #fff;
}

.otp-layout-carousel-3d .otp-3d-social-badge--trustpilot {
    background: #00b67a;
}

/* ── Navigation Buttons ──────────────────────────────────────────────────── */
.otp-layout-carousel-3d .otp-3d-nav-btn {
    background: var(--ot-card-bg);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    color: var(--ot-arrow-color);
    transition: background 0.3s, transform 0.3s, color 0.3s, box-shadow 0.3s;
    flex-shrink: 0;
    z-index: 15;
    position: relative;
}

.otp-layout-carousel-3d .otp-3d-nav-btn:hover {
    background: var(--ot-bullet-active-color);
    color: #fff;
    box-shadow: 0 6px 20px color-mix(in srgb, var(--ot-bullet-active-color) 40%, transparent);
    transform: translateY(-4px) scale(1.08);
}

.otp-layout-carousel-3d .otp-3d-prev {
    margin-right: 20px;
}

.otp-layout-carousel-3d .otp-3d-next {
    margin-left: 20px;
}

/* ── Pagination dots ─────────────────────────────────────────────────────── */
.otp-layout-carousel-3d .otp-3d-pagination-bullets {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0;
    z-index: 12;
    position: relative;
}

.otp-layout-carousel-3d .otp-3d-bullet {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--ot-bullet-color);
    opacity: 0.3;
    cursor: pointer;
    transition: all 0.3s ease;
}

.otp-layout-carousel-3d .otp-3d-bullet.active {
    background-color: var(--ot-bullet-active-color);
    opacity: 1;
    width: 24px;
    border-radius: 5px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .otp-carousel-3d-container {
        min-height: 450px;
    }

    .otp-carousel-3d-stage {
        height: 400px;
    }

    .otp-carousel-3d-slide {
        width: 280px;
        height: 370px;
        margin-left: -140px;
        margin-top: -185px;
    }

    .otp-carousel-3d-card {
        padding: 1.5rem 1.75rem;
        gap: 0.6rem;
    }

    .otp-3d-avatar-wrap,
    .otp-3d-avatar-initials,
    .otp-layout-carousel-3d .otp-carousel-3d-card img.otp-3d-avatar-img,
    .otp-3d-avatar-img {
        width: 60px !important;
        height: 60px !important;
    }

    .otp-3d-avatar-initials {
        font-size: 1.15rem;
    }

    .otp-3d-text {
        font-size: 0.95rem;
        -webkit-line-clamp: 4;
    }

    .otp-3d-author-info {
        margin-bottom: 0.25rem;
    }

    .otp-layout-carousel-3d .otp-3d-nav-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 20;
        width: 40px;
        height: 40px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
        margin: 0;
    }
    
    .otp-layout-carousel-3d .otp-3d-nav-btn:hover,
    .otp-layout-carousel-3d .otp-3d-nav-btn:focus:hover,
    .otp-layout-carousel-3d .otp-3d-nav-btn:active,
    .otp-layout-carousel-3d .otp-3d-nav-btn:focus {
        transform: translateY(-50%) !important;
    }

    .otp-layout-carousel-3d .otp-3d-prev {
        left: 0.5rem;
    }

    .otp-layout-carousel-3d .otp-3d-next {
        right: 0.5rem;
    }
}

/* ── Resilience: force transitions even if theme overrides them ──────────── */
.otp-layout-carousel-3d .otp-3d-nav-btn {
    transition: background 0.3s, transform 0.3s, color 0.3s, box-shadow 0.3s !important;
}

.otp-carousel-3d-track {
    transition: transform var(--ot-transition-speed) cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.otp-carousel-3d-slide {
    transition: transform var(--ot-transition-speed) cubic-bezier(0.25, 1, 0.5, 1), opacity var(--ot-transition-speed) ease, z-index var(--ot-transition-speed) step-end !important;
}

.otp-layout-carousel-3d .otp-3d-bullet {
    transition: all 0.3s ease !important;
}

.otp-layout-carousel-3d .otp-3d-star {
    transition: color 0.2s ease !important;
}

.otp-3d-company-logo {
    transition: opacity 0.3s ease, filter 0.3s ease !important;
}