/**
 * Aha Orbit Testimonials — Carousel Layout CSS.
 *
 * Loaded ONLY when the Carousel layout is active.
 * Orbit layout styles are in orbit-testimonials.css.
 * Grid layout styles are in grid-testimonials.css.
 *
 * @package Aha_Orbit_Testimonials
 * @since   1.1.0
 */

/* ── CSS custom property defaults (overridable via per-orbit meta) ──────── */
.ot-layout-carousel {
    --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: 600ms;
    --ot-carousel-cols: 1;
    --ot-carousel-gap: 24px;

    position: relative;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    color: var(--ot-text-primary);
}

/* ── Container ───────────────────────────────────────────────────────────── */
.ot-carousel-container {
    display: flex;
    align-items: center;
    width: 100%;
    gap: var(--ot-carousel-gap, 24px);
    position: relative;
}

.ot-layout-carousel *,
.ot-layout-carousel *::before,
.ot-layout-carousel *::after {
    box-sizing: border-box;
}

/* ── Track ───────────────────────────────────────────────────────────────── */
.ot-carousel-track-wrapper {
    flex-grow: 1;
    overflow: hidden;
    cursor: grab;
}

.ot-carousel-track-wrapper.ot-is-dragging {
    cursor: grabbing;
}

.ot-carousel-track {
    display: flex;
    gap: var(--ot-carousel-gap, 24px);
    transition: transform var(--ot-transition-speed) cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
    transform: translateX(calc(-1 * var(--ot-carousel-index, 0) * (100% + var(--ot-carousel-gap, 24px)) / var(--ot-carousel-cols, 1) + var(--ot-carousel-drag-offset, 0px)));
}

.ot-carousel-track-wrapper.ot-is-dragging .ot-carousel-track {
    transition: none !important;
}

/* ── Slides ──────────────────────────────────────────────────────────────── */
.ot-carousel-slide {
    flex: 0 0 calc((100% - (var(--ot-carousel-cols, 1) - 1) * var(--ot-carousel-gap, 24px)) / var(--ot-carousel-cols, 1));
    min-width: calc((100% - (var(--ot-carousel-cols, 1) - 1) * var(--ot-carousel-gap, 24px)) / var(--ot-carousel-cols, 1));
    padding: 0;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ot-carousel-slide.is-active {
    pointer-events: auto;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.ot-carousel-card {
    background: var(--ot-card-bg);
    border-radius: 20px;
    padding: 2.5rem 1.2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.ot-carousel-card .ot-quote-icon {
    color: var(--ot-quote-color);
    opacity: 0.2;
    display: flex;
}

.ot-carousel-card .ot-star-rating {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 0;
}

/* ── Stars ───────────────────────────────────────────────────────────────── */
.ot-layout-carousel .ot-star {
    font-size: 1.6rem;
    color: #d1d5db;
    transition: color 0.2s ease;
    user-select: none;
}

.ot-layout-carousel .ot-star--filled {
    color: #f59e0b;
}

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

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

/* ── Testimonial text ────────────────────────────────────────────────────── */
.ot-carousel-text {
    font-size: 1.1rem;
    line-height: 1.75;
    font-style: italic;
    font-weight: 500;
    color: var(--ot-text-primary);
    margin: 0;
    max-width: 680px;
}

/* ── Author block ────────────────────────────────────────────────────────── */
.ot-carousel-author {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

.ot-carousel-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
}

.ot-layout-carousel .ot-carousel-card img.ot-carousel-avatar-img,
.ot-carousel-avatar-img {
    width: 64px !important;
    height: 64px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    border: 3px solid var(--ot-card-bg) !important;
    max-width: none !important;
}

.ot-carousel-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--ot-card-bg) !important;
    background: linear-gradient(135deg, #4776e6, #8e54e9); /* fallback */
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    user-select: none;
}

/* Cycling gradients per slide */
.ot-layout-carousel .ot-carousel-slide:nth-child(6n+1) .ot-carousel-avatar-initials { background: linear-gradient(135deg, #4776e6, #8e54e9); }
.ot-layout-carousel .ot-carousel-slide:nth-child(6n+2) .ot-carousel-avatar-initials { background: linear-gradient(135deg, #0ba360, #3cba92); }
.ot-layout-carousel .ot-carousel-slide:nth-child(6n+3) .ot-carousel-avatar-initials { background: linear-gradient(135deg, #f7971e, #ffd200); }
.ot-layout-carousel .ot-carousel-slide:nth-child(6n+4) .ot-carousel-avatar-initials { background: linear-gradient(135deg, #f953c6, #b91d73); }
.ot-layout-carousel .ot-carousel-slide:nth-child(6n+5) .ot-carousel-avatar-initials { background: linear-gradient(135deg, #1a85ff, #00c6fb); }
.ot-layout-carousel .ot-carousel-slide:nth-child(6n+6) .ot-carousel-avatar-initials { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }

/* Social badge sizing inside carousel avatar */
.ot-carousel-avatar-wrap .ot-social-badge {
    width: 24px;
    height: 24px;
}

.ot-carousel-avatar-wrap .ot-social-badge svg {
    width: 15px;
    height: 15px;
}

.ot-carousel-author-info {
    text-align: left;
}

.ot-carousel-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ot-name-color);
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.ot-carousel-role {
    font-size: 0.9rem;
    color: var(--ot-role-color);
    margin: 0;
    font-weight: 500;
}

.ot-layout-carousel .ot-carousel-card img.ot-carousel-logo,
.ot-carousel-logo {
    display: block !important;
    max-height: 24px !important;
    width: auto !important;
    max-width: 100px !important;
    margin-top: 0.4rem !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;
}

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

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

.ot-layout-carousel .ot-social-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #555;
    color: #fff;
    border: 2px solid #fff;
    z-index: 3;
    transition: transform 0.2s ease;
    pointer-events: auto;
}

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

.ot-layout-carousel .ot-social-badge--facebook {
    background: #1877f2;
}

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

.ot-layout-carousel .ot-social-badge--linkedin {
    background: #0a66c2;
}

.ot-layout-carousel .ot-social-badge--twitter {
    background: #000;
}

.ot-layout-carousel .ot-social-badge--youtube {
    background: #ff0000;
}

.ot-layout-carousel .ot-social-badge--tiktok {
    background: #010101;
}

.ot-layout-carousel .ot-social-badge--google {
    background: #fff;
}

.ot-layout-carousel .ot-social-badge--trustpilot {
    background: #00b67a;
}

/* ── Navigation Buttons ──────────────────────────────────────────────────── */
.ot-layout-carousel .ot-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: all 0.25s ease;
    flex-shrink: 0;
}

.ot-layout-carousel .ot-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(-2px);
}

/* ── Pagination dots ─────────────────────────────────────────────────────── */
.ot-layout-carousel .ot-pagination-bullets {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0;
}

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

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

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .ot-layout-carousel {
        --ot-carousel-cols: 1 !important;
    }

    .ot-carousel-container {
        gap: 0;
    }

    .ot-layout-carousel .ot-nav-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        width: 40px;
        height: 40px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
        background: var(--ot-card-bg);
    }

    .ot-layout-carousel .ot-nav-btn:hover,
    .ot-layout-carousel .ot-nav-btn:focus:hover,
    .ot-layout-carousel .ot-nav-btn:active,
    .ot-layout-carousel .ot-nav-btn:focus {
        transform: translateY(-50%) !important;
    }

    .ot-layout-carousel .ot-carousel-prev {
        left: 0.5rem;
    }

    .ot-layout-carousel .ot-carousel-next {
        right: 0.5rem;
    }

    .ot-carousel-card {
        padding: 2rem 1.5rem;
        width: 90% !important;
        margin: 0 auto !important;
    }

    .ot-carousel-text {
        font-size: 1rem;
    }

    .ot-carousel-author {
        flex-direction: column;
        text-align: center;
    }

    .ot-carousel-author-info {
        text-align: center;
    }
}

/* ── Resilience: force transitions even if theme resets them ─────────────── */
.ot-layout-carousel .ot-nav-btn {
    transition: all 0.25s ease !important;
    transition-duration: 0.25s !important;
    transition-delay: 0s !important;
}

.ot-carousel-track {
    transition: transform var(--ot-transition-speed) cubic-bezier(0.25, 1, 0.5, 1) !important;
    transition-duration: var(--ot-transition-speed) !important;
    transition-delay: 0s !important;
}

.ot-carousel-slide {
    transition: opacity 0.3s ease !important;
    transition-duration: 0.3s !important;
    transition-delay: 0s !important;
}

.ot-layout-carousel .ot-bullet {
    transition: all 0.3s ease !important;
    transition-duration: 0.3s !important;
    transition-delay: 0s !important;
}

.ot-layout-carousel .ot-star {
    transition: color 0.2s ease !important;
    transition-duration: 0.2s !important;
    transition-delay: 0s !important;
}

.ot-carousel-logo {
    transition: opacity 0.3s ease, filter 0.3s ease !important;
    transition-duration: 0.3s, 0.3s !important;
    transition-delay: 0s !important;
}