/* ============================================
   RSL Testimonial/Quote Component
   Version: 1.0.0

   A premium, accessible testimonial component
   with multiple variants, star rating integration,
   and FilterBus support.

   WCAG 2.1 AA Compliant
   ============================================ */

/* ============================================
   CSS Custom Properties (Theming)
   ============================================ */
:root {
    /* Colors */
    --rsl-testimonial-bg: #ffffff;
    --rsl-testimonial-border: #e2e8f0;
    --rsl-testimonial-text: #334155;
    --rsl-testimonial-quote: #1e293b;
    --rsl-testimonial-cite: #64748b;
    --rsl-testimonial-accent: #6E7BFF;
    --rsl-testimonial-quote-mark: rgba(110, 123, 255, 0.15);

    /* Avatar */
    --rsl-testimonial-avatar-bg: #6E7BFF;
    --rsl-testimonial-avatar-text: #ffffff;
    --rsl-testimonial-avatar-size: 56px;

    /* Spacing */
    --rsl-testimonial-padding: 1.5rem;
    --rsl-testimonial-gap: 1rem;
    --rsl-testimonial-radius: 12px;

    /* Shadow */
    --rsl-testimonial-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --rsl-testimonial-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Animation */
    --rsl-testimonial-transition: 0.3s ease;
}

/* ============================================
   Base Testimonial Styles
   ============================================ */
.rsl-testimonial {
    position: relative;
    font-family: inherit;
}

/* Remove default blockquote margins */
.rsl-testimonial blockquote {
    margin: 0;
    padding: 0;
}

.rsl-testimonial cite {
    font-style: normal;
}

/* Hidden for FilterBus filtering */
.rsl-testimonial.filterbus-hidden,
.slot-item.filterbus-hidden {
    display: none !important;
}

/* ============================================
   Card Variant (Default)
   ============================================ */
.rsl-testimonial-card {
    background: var(--rsl-testimonial-bg);
    border: 1px solid var(--rsl-testimonial-border);
    border-radius: var(--rsl-testimonial-radius);
    padding: var(--rsl-testimonial-padding);
    box-shadow: var(--rsl-testimonial-shadow);
    transition: box-shadow var(--rsl-testimonial-transition),
                transform var(--rsl-testimonial-transition);
}

.rsl-testimonial-card:hover {
    box-shadow: var(--rsl-testimonial-shadow-hover);
    transform: translateY(-2px);
}

/* Quote mark decoration */
.rsl-testimonial-card::before {
    content: '\201C'; /* Left double quotation mark */
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    font-size: 4rem;
    font-family: Georgia, serif;
    color: var(--rsl-testimonial-quote-mark);
    line-height: 1;
    pointer-events: none;
    z-index: 0;
}

/* Quote content */
.rsl-testimonial-quote {
    position: relative;
    z-index: 1;
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--rsl-testimonial-quote);
    margin-bottom: var(--rsl-testimonial-gap);
    padding-top: 1.5rem;
}

/* Rating container */
.rsl-testimonial-rating {
    margin-bottom: var(--rsl-testimonial-gap);
}

/* Attribution section */
.rsl-testimonial-attribution {
    display: flex;
    align-items: center;
    gap: var(--rsl-testimonial-gap);
    padding-top: var(--rsl-testimonial-gap);
    border-top: 1px solid var(--rsl-testimonial-border);
}

/* Avatar */
.rsl-testimonial-avatar {
    flex-shrink: 0;
    width: var(--rsl-testimonial-avatar-size);
    height: var(--rsl-testimonial-avatar-size);
    border-radius: 50%;
    overflow: hidden;
    background: var(--rsl-testimonial-avatar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rsl-testimonial-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rsl-testimonial-avatar-fallback {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--rsl-testimonial-avatar-text);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Author info */
.rsl-testimonial-author {
    flex: 1;
    min-width: 0;
}

.rsl-testimonial-name {
    font-weight: 600;
    color: var(--rsl-testimonial-quote);
    margin: 0 0 0.125rem 0;
    font-size: 1rem;
}

.rsl-testimonial-title {
    font-size: 0.875rem;
    color: var(--rsl-testimonial-cite);
    margin: 0;
}

.rsl-testimonial-company {
    font-size: 0.875rem;
    color: var(--rsl-testimonial-cite);
    margin: 0;
}

/* Company logo */
.rsl-testimonial-logo {
    flex-shrink: 0;
    max-height: 32px;
    width: auto;
    opacity: 0.7;
    transition: opacity var(--rsl-testimonial-transition);
}

.rsl-testimonial-card:hover .rsl-testimonial-logo {
    opacity: 1;
}

/* ============================================
   Minimal Variant
   ============================================ */
.rsl-testimonial-minimal {
    padding: 1rem 0;
}

.rsl-testimonial-minimal .rsl-testimonial-quote {
    font-size: 1rem;
    font-style: italic;
    color: var(--rsl-testimonial-text);
    padding-top: 0;
    margin-bottom: 0.5rem;
}

.rsl-testimonial-minimal .rsl-testimonial-quote::before {
    content: '\201C';
    color: var(--rsl-testimonial-accent);
}

.rsl-testimonial-minimal .rsl-testimonial-quote::after {
    content: '\201D';
    color: var(--rsl-testimonial-accent);
}

.rsl-testimonial-minimal .rsl-testimonial-attribution {
    border-top: none;
    padding-top: 0;
    display: inline;
}

.rsl-testimonial-minimal .rsl-testimonial-attribution::before {
    content: '\2014\00a0'; /* Em dash + space */
    color: var(--rsl-testimonial-cite);
}

.rsl-testimonial-minimal .rsl-testimonial-name,
.rsl-testimonial-minimal .rsl-testimonial-title,
.rsl-testimonial-minimal .rsl-testimonial-company {
    display: inline;
    font-size: 0.9375rem;
}

.rsl-testimonial-minimal .rsl-testimonial-name {
    font-weight: 600;
}

.rsl-testimonial-minimal .rsl-testimonial-title::before {
    content: ', ';
}

.rsl-testimonial-minimal .rsl-testimonial-company::before {
    content: ' at ';
}

.rsl-testimonial-minimal .rsl-testimonial-avatar,
.rsl-testimonial-minimal .rsl-testimonial-logo,
.rsl-testimonial-minimal .rsl-testimonial-rating {
    display: none;
}

/* ============================================
   Featured Variant (Large/Hero)
   ============================================ */
.rsl-testimonial-featured {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg,
        var(--rsl-testimonial-bg) 0%,
        rgba(110, 123, 255, 0.03) 100%);
    border-radius: var(--rsl-testimonial-radius);
    border: 1px solid var(--rsl-testimonial-border);
}

.rsl-testimonial-featured::before {
    content: '\201C';
    position: static;
    display: block;
    font-size: 5rem;
    font-family: Georgia, serif;
    color: var(--rsl-testimonial-accent);
    line-height: 0.5;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.rsl-testimonial-featured .rsl-testimonial-avatar {
    --rsl-testimonial-avatar-size: 80px;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 14px rgba(110, 123, 255, 0.25);
}

.rsl-testimonial-featured .rsl-testimonial-quote {
    font-size: 1.375rem;
    max-width: 700px;
    margin: 0 auto 1.5rem;
    padding-top: 0;
}

.rsl-testimonial-featured .rsl-testimonial-rating {
    justify-content: center;
    display: flex;
}

.rsl-testimonial-featured .rsl-testimonial-attribution {
    flex-direction: column;
    border-top: none;
    padding-top: 0;
}

.rsl-testimonial-featured .rsl-testimonial-author {
    text-align: center;
}

.rsl-testimonial-featured .rsl-testimonial-name {
    font-size: 1.125rem;
}

.rsl-testimonial-featured .rsl-testimonial-logo {
    margin-top: 1rem;
    max-height: 40px;
}

/* ============================================
   Bubble Variant (Chat-style)
   ============================================ */
.rsl-testimonial-bubble {
    position: relative;
}

.rsl-testimonial-bubble .rsl-testimonial-quote {
    background: var(--rsl-testimonial-bg);
    border: 1px solid var(--rsl-testimonial-border);
    border-radius: var(--rsl-testimonial-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    box-shadow: var(--rsl-testimonial-shadow);
}

/* Bubble tail */
.rsl-testimonial-bubble .rsl-testimonial-quote::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 30px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--rsl-testimonial-bg);
    filter: drop-shadow(0 2px 1px rgba(0,0,0,0.05));
}

/* Border for bubble tail */
.rsl-testimonial-bubble .rsl-testimonial-quote::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 29px;
    width: 0;
    height: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-top: 11px solid var(--rsl-testimonial-border);
}

.rsl-testimonial-bubble .rsl-testimonial-attribution {
    border-top: none;
    padding-top: 0;
    padding-left: 0.5rem;
}

.rsl-testimonial-bubble .rsl-testimonial-avatar {
    --rsl-testimonial-avatar-size: 48px;
}

/* ============================================
   Slideshow/Carousel Mode
   ============================================ */
.rsl-testimonial-slideshow {
    position: relative;
    overflow: hidden;
}

.rsl-testimonial-slides {
    display: flex;
    transition: transform 0.5s ease;
}

.rsl-testimonial-slide {
    flex: 0 0 100%;
    min-width: 100%;
}

/* Navigation buttons */
.rsl-testimonial-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--rsl-testimonial-bg);
    border: 1px solid var(--rsl-testimonial-border);
    box-shadow: var(--rsl-testimonial-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rsl-testimonial-text);
    transition: all var(--rsl-testimonial-transition);
    z-index: 10;
}

.rsl-testimonial-nav:hover {
    background: var(--rsl-testimonial-accent);
    border-color: var(--rsl-testimonial-accent);
    color: #fff;
}

.rsl-testimonial-nav:focus-visible {
    outline: 2px solid var(--rsl-testimonial-accent);
    outline-offset: 2px;
}

.rsl-testimonial-nav-prev {
    left: 0.5rem;
}

.rsl-testimonial-nav-next {
    right: 0.5rem;
}

.rsl-testimonial-nav svg {
    width: 20px;
    height: 20px;
}

/* Pagination dots */
.rsl-testimonial-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.rsl-testimonial-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--rsl-testimonial-border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all var(--rsl-testimonial-transition);
}

.rsl-testimonial-dot:hover {
    background: var(--rsl-testimonial-cite);
}

.rsl-testimonial-dot:focus-visible {
    outline: 2px solid var(--rsl-testimonial-accent);
    outline-offset: 2px;
}

.rsl-testimonial-dot.active {
    background: var(--rsl-testimonial-accent);
    transform: scale(1.2);
}

/* Screen reader live region */
.rsl-testimonial-live {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Size Variants
   ============================================ */
.rsl-testimonial-sm {
    --rsl-testimonial-padding: 1rem;
    --rsl-testimonial-avatar-size: 40px;
}

.rsl-testimonial-sm .rsl-testimonial-quote {
    font-size: 0.9375rem;
}

.rsl-testimonial-sm .rsl-testimonial-name {
    font-size: 0.875rem;
}

.rsl-testimonial-sm .rsl-testimonial-title,
.rsl-testimonial-sm .rsl-testimonial-company {
    font-size: 0.8125rem;
}

.rsl-testimonial-lg {
    --rsl-testimonial-padding: 2rem;
    --rsl-testimonial-avatar-size: 72px;
}

.rsl-testimonial-lg .rsl-testimonial-quote {
    font-size: 1.25rem;
}

.rsl-testimonial-lg .rsl-testimonial-name {
    font-size: 1.125rem;
}

/* ============================================
   Color Variants
   ============================================ */
.rsl-testimonial-accent-purple {
    --rsl-testimonial-accent: #8B5CF6;
    --rsl-testimonial-avatar-bg: #8B5CF6;
    --rsl-testimonial-quote-mark: rgba(139, 92, 246, 0.15);
}

.rsl-testimonial-accent-green {
    --rsl-testimonial-accent: #10B981;
    --rsl-testimonial-avatar-bg: #10B981;
    --rsl-testimonial-quote-mark: rgba(16, 185, 129, 0.15);
}

.rsl-testimonial-accent-orange {
    --rsl-testimonial-accent: #F59E0B;
    --rsl-testimonial-avatar-bg: #F59E0B;
    --rsl-testimonial-quote-mark: rgba(245, 158, 11, 0.15);
}

.rsl-testimonial-accent-red {
    --rsl-testimonial-accent: #EF4444;
    --rsl-testimonial-avatar-bg: #EF4444;
    --rsl-testimonial-quote-mark: rgba(239, 68, 68, 0.15);
}

.rsl-testimonial-accent-teal {
    --rsl-testimonial-accent: #14B8A6;
    --rsl-testimonial-avatar-bg: #14B8A6;
    --rsl-testimonial-quote-mark: rgba(20, 184, 166, 0.15);
}

/* ============================================
   Verified Badge
   ============================================ */
.rsl-testimonial-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #10B981;
    margin-left: 0.5rem;
}

.rsl-testimonial-verified svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   Date Display
   ============================================ */
.rsl-testimonial-date {
    font-size: 0.75rem;
    color: var(--rsl-testimonial-cite);
    margin-top: 0.25rem;
}

/* ============================================
   Category Tag
   ============================================ */
.rsl-testimonial-category {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: rgba(110, 123, 255, 0.1);
    color: var(--rsl-testimonial-accent);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* ============================================
   Animation Classes
   ============================================ */
.rsl-testimonial-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.rsl-testimonial-animate.rsl-testimonial-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Dark Mode Support
   ============================================ */
[data-theme="dark"] .rsl-testimonial,
[data-theme="dark"].rsl-testimonial {
    --rsl-testimonial-bg: #1e293b;
    --rsl-testimonial-border: #334155;
    --rsl-testimonial-text: #cbd5e1;
    --rsl-testimonial-quote: #f1f5f9;
    --rsl-testimonial-cite: #94a3b8;
    --rsl-testimonial-quote-mark: rgba(110, 123, 255, 0.2);
    --rsl-testimonial-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --rsl-testimonial-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .rsl-testimonial-featured {
    background: linear-gradient(135deg,
        var(--rsl-testimonial-bg) 0%,
        rgba(110, 123, 255, 0.08) 100%);
}

[data-theme="dark"] .rsl-testimonial-bubble .rsl-testimonial-quote::after {
    border-top-color: var(--rsl-testimonial-bg);
}

[data-theme="dark"] .rsl-testimonial-bubble .rsl-testimonial-quote::before {
    border-top-color: var(--rsl-testimonial-border);
}

[data-theme="dark"] .rsl-testimonial-category {
    background: rgba(110, 123, 255, 0.2);
}

[data-theme="dark"] .rsl-testimonial-nav {
    background: var(--rsl-testimonial-bg);
    border-color: var(--rsl-testimonial-border);
    color: var(--rsl-testimonial-text);
}

[data-theme="dark"] .rsl-testimonial-dot {
    background: var(--rsl-testimonial-border);
}

[data-theme="dark"] .rsl-testimonial-logo {
    filter: brightness(0.9);
}

/* ============================================
   Reduced Motion Support
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .rsl-testimonial-card,
    .rsl-testimonial-animate,
    .rsl-testimonial-slides,
    .rsl-testimonial-nav,
    .rsl-testimonial-dot,
    .rsl-testimonial-logo {
        transition: none !important;
        animation: none !important;
    }

    .rsl-testimonial-card:hover {
        transform: none;
    }

    .rsl-testimonial-animate {
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   Focus Styles (Accessibility)
   ============================================ */
.rsl-testimonial:focus-visible {
    outline: 2px solid var(--rsl-testimonial-accent);
    outline-offset: 4px;
    border-radius: var(--rsl-testimonial-radius);
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .rsl-testimonial-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .rsl-testimonial-nav,
    .rsl-testimonial-dots {
        display: none;
    }

    .rsl-testimonial-slides {
        flex-wrap: wrap;
    }

    .rsl-testimonial-slide {
        page-break-inside: avoid;
    }
}

/* ============================================
   Responsive Breakpoints
   ============================================ */
@media (max-width: 768px) {
    .rsl-testimonial-featured {
        padding: 2rem 1.5rem;
    }

    .rsl-testimonial-featured .rsl-testimonial-quote {
        font-size: 1.125rem;
    }

    .rsl-testimonial-featured .rsl-testimonial-avatar {
        --rsl-testimonial-avatar-size: 64px;
    }

    .rsl-testimonial-nav {
        width: 36px;
        height: 36px;
    }

    .rsl-testimonial-nav svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .rsl-testimonial-card {
        --rsl-testimonial-padding: 1.25rem;
    }

    .rsl-testimonial-card::before {
        font-size: 3rem;
    }

    .rsl-testimonial-attribution {
        flex-wrap: wrap;
    }

    .rsl-testimonial-logo {
        width: 100%;
        max-height: 28px;
        margin-top: 0.75rem;
    }
}
