/* Starter Testimonials - Frontend Styles */
/* Version: 1.0.1 - Fixed layout/theme combinations */

.st-testimonials {
    --st-primary-color: #1a1a1a;
    --st-accent-color: #2563eb;
    --st-text-color: #374151;
    --st-background-color: #ffffff;
    --st-star-color: #fbbf24;
    --st-font-family: inherit;
    
    font-family: var(--st-font-family);
    color: var(--st-text-color);
}

.st-testimonials *,
.st-testimonials *::before,
.st-testimonials *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   GRID LAYOUT
   ========================================================================== */

.st-layout-grid .st-grid {
    display: grid;
    gap: 24px;
}

.st-layout-grid.st-columns-1 .st-grid { grid-template-columns: 1fr; }
.st-layout-grid.st-columns-2 .st-grid { grid-template-columns: repeat(2, 1fr); }
.st-layout-grid.st-columns-3 .st-grid { grid-template-columns: repeat(3, 1fr); }
.st-layout-grid.st-columns-4 .st-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .st-layout-grid.st-columns-4 .st-grid,
    .st-layout-grid.st-columns-3 .st-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .st-layout-grid .st-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   LIST LAYOUT - with dividers
   ========================================================================== */

.st-layout-list .st-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 700px;
    margin: 0 auto;
}

.st-layout-list .st-testimonial {
    padding: 24px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.st-layout-list .st-testimonial:first-child {
    padding-top: 0;
}

.st-layout-list .st-testimonial:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* List layout theme adjustments */
.st-layout-list.st-theme-card .st-testimonial {
    padding: 0;
    border-bottom: none;
    margin-bottom: 20px;
}

.st-layout-list.st-theme-card .st-testimonial:last-child {
    margin-bottom: 0;
}

.st-layout-list.st-theme-bubble .st-testimonial {
    padding: 0;
    border-bottom: none;
    margin-bottom: 24px;
}

.st-layout-list.st-theme-bubble .st-testimonial:last-child {
    margin-bottom: 0;
}

.st-layout-list.st-theme-bordered .st-testimonial {
    padding: 0;
    border-bottom: none;
    margin-bottom: 20px;
}

.st-layout-list.st-theme-bordered .st-testimonial:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   SINGLE LAYOUT - Large, centered, one at a time display
   ========================================================================== */

.st-layout-single .st-grid {
    display: flex;
    flex-direction: column;
    gap: 48px;
    max-width: 800px;
    margin: 0 auto;
}

.st-layout-single .st-testimonial {
    text-align: center;
}

.st-layout-single .st-quote-text {
    font-size: 1.5em;
    line-height: 1.6;
}

.st-layout-single .st-author {
    justify-content: center;
}

.st-layout-single .st-author-image img {
    width: 80px;
    height: 80px;
}

.st-layout-single .st-rating {
    justify-content: center;
}

/* Single layout with card theme */
.st-layout-single.st-theme-card .st-testimonial-inner {
    text-align: center;
}

.st-layout-single.st-theme-card .st-author {
    justify-content: center;
}

.st-layout-single.st-theme-card .st-rating {
    justify-content: center;
}

/* Single layout with bubble theme */
.st-layout-single.st-theme-bubble .st-author {
    justify-content: center;
}

.st-layout-single.st-theme-bubble .st-rating {
    justify-content: center;
}

/* Single layout with bordered theme */
.st-layout-single.st-theme-bordered .st-testimonial-inner {
    border-left: none;
    border-top: 3px solid var(--st-accent-color);
    padding-left: 0;
    padding-top: 28px;
    text-align: center;
}

.st-layout-single.st-theme-bordered .st-author {
    justify-content: center;
}

.st-layout-single.st-theme-bordered .st-rating {
    justify-content: center;
}

/* ==========================================================================
   SLIDER & CAROUSEL LAYOUT
   ========================================================================== */

.st-slider-container {
    position: relative;
    overflow: hidden;
}

.st-slider-track {
    display: flex;
    transition: transform 0.4s ease;
}

/* Slider: visar X kolumner per slide */
.st-layout-slider .st-testimonial {
    flex-shrink: 0;
    padding: 0 12px;
}

.st-layout-slider.st-columns-1 .st-testimonial { flex-basis: 100%; }
.st-layout-slider.st-columns-2 .st-testimonial { flex-basis: 50%; }
.st-layout-slider.st-columns-3 .st-testimonial { flex-basis: 33.333%; }
.st-layout-slider.st-columns-4 .st-testimonial { flex-basis: 25%; }

/* Carousel: alltid en åt gången vid scroll */
.st-layout-carousel .st-testimonial {
    flex-shrink: 0;
    padding: 0 12px;
}

.st-layout-carousel.st-columns-1 .st-testimonial { flex-basis: 100%; }
.st-layout-carousel.st-columns-2 .st-testimonial { flex-basis: 50%; }
.st-layout-carousel.st-columns-3 .st-testimonial { flex-basis: 33.333%; }
.st-layout-carousel.st-columns-4 .st-testimonial { flex-basis: 25%; }

/* Centrerat innehåll i slider */
.st-layout-slider .st-testimonial-inner,
.st-layout-carousel .st-testimonial-inner {
    text-align: center;
}

.st-layout-slider .st-author,
.st-layout-carousel .st-author {
    justify-content: center;
}

.st-layout-slider .st-rating,
.st-layout-carousel .st-rating {
    justify-content: center;
}

/* Slider/carousel theme adjustments */
.st-layout-slider.st-theme-card .st-testimonial-inner,
.st-layout-carousel.st-theme-card .st-testimonial-inner {
    height: 100%;
    text-align: center;
}

.st-layout-slider.st-theme-bubble .st-author,
.st-layout-carousel.st-theme-bubble .st-author {
    justify-content: center;
}

.st-layout-slider.st-theme-bordered .st-testimonial-inner,
.st-layout-carousel.st-theme-bordered .st-testimonial-inner {
    border-left: none;
    border-top: 3px solid var(--st-accent-color);
    padding-left: 0;
    padding-top: 28px;
}

@media (max-width: 900px) {
    .st-layout-slider.st-columns-4 .st-testimonial,
    .st-layout-slider.st-columns-3 .st-testimonial,
    .st-layout-carousel.st-columns-4 .st-testimonial,
    .st-layout-carousel.st-columns-3 .st-testimonial {
        flex-basis: 50%;
    }
}

@media (max-width: 600px) {
    .st-layout-slider .st-testimonial,
    .st-layout-carousel .st-testimonial {
        flex-basis: 100% !important;
    }
}

/* ==========================================================================
   NAVIGATION - Fixed visibility handling
   ========================================================================== */

.st-slider-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

/* Hidden via PHP setting */
.st-slider-nav.st-nav-hidden {
    display: none !important;
}

/* Hidden via JS when only one page */
.st-slider-nav.st-nav-single {
    display: none;
}

.st-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    background: var(--st-background-color);
    color: var(--st-text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.st-nav-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
}

.st-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.st-nav-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ==========================================================================
   DOTS NAVIGATION - Fixed visibility handling
   ========================================================================== */

.st-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

/* Hidden via PHP setting */
.st-slider-dots.st-dots-hidden {
    display: none !important;
}

/* Hidden via JS when only one page */
.st-slider-dots.st-dots-single {
    display: none;
}

.st-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--st-text-color);
    opacity: 0.2;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.st-slider-dot:hover {
    opacity: 0.4;
}

.st-slider-dot.active {
    opacity: 0.8;
    transform: scale(1.2);
}

/* ==========================================================================
   BASE TESTIMONIAL STYLES
   ========================================================================== */

.st-testimonial-inner {
    height: 100%;
}

.st-quote-text {
    font-size: 1.05em;
    line-height: 1.7;
    color: var(--st-text-color);
    margin-bottom: 20px;
}

.st-quote-text p:last-child {
    margin-bottom: 0;
}

.st-quote-mark {
    font-size: 4em;
    line-height: 1;
    color: var(--st-accent-color);
    font-family: Georgia, serif;
    margin-bottom: -10px;
    opacity: 0.3;
}

/* Rating */
.st-rating {
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
}

.st-star {
    font-size: 1.1em;
    color: #e5e5e5;
}

.st-star-filled {
    color: var(--st-star-color);
}

/* Author */
.st-author {
    display: flex;
    align-items: center;
    gap: 14px;
}

.st-author-image {
    flex-shrink: 0;
}

.st-author-image img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.st-author-name {
    font-weight: 600;
    font-size: 1em;
    color: var(--st-primary-color);
}

.st-author-title {
    font-size: 0.9em;
    color: var(--st-text-color);
    opacity: 0.7;
    margin-top: 2px;
}

/* ==========================================================================
   THEME: MINIMAL
   ========================================================================== */

.st-theme-minimal .st-testimonial-inner {
    padding: 0;
}

.st-theme-minimal .st-quote-text {
    font-style: italic;
}

.st-theme-minimal .st-quote-text::before {
    content: '"';
}

.st-theme-minimal .st-quote-text::after {
    content: '"';
}

/* ==========================================================================
   THEME: CARD
   ========================================================================== */

.st-theme-card .st-testimonial-inner {
    background: var(--st-background-color);
    padding: 32px;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.st-theme-card .st-quote-text {
    flex-grow: 1;
}

.st-theme-card .st-quote-mark {
    margin-bottom: 8px;
}

/* ==========================================================================
   THEME: BUBBLE
   ========================================================================== */

.st-theme-bubble .st-testimonial-inner {
    display: flex;
    flex-direction: column;
}

.st-theme-bubble .st-bubble-content {
    background: var(--st-background-color);
    padding: 28px;
    border-radius: 12px;
    border: 1px solid #e5e5e5;
    position: relative;
}

.st-theme-bubble .st-bubble-arrow {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #e5e5e5;
    margin-left: 32px;
    position: relative;
}

/* Center bubble arrow in centered layouts */
.st-layout-slider.st-theme-bubble .st-bubble-arrow,
.st-layout-carousel.st-theme-bubble .st-bubble-arrow,
.st-layout-single.st-theme-bubble .st-bubble-arrow {
    margin-left: auto;
    margin-right: auto;
}

.st-theme-bubble .st-bubble-arrow::after {
    content: '';
    position: absolute;
    top: -13px;
    left: -11px;
    width: 0;
    height: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-top: 11px solid var(--st-background-color);
}

.st-theme-bubble .st-quote-text {
    margin-bottom: 0;
}

.st-theme-bubble .st-rating {
    margin-top: 16px;
    margin-bottom: 0;
}

.st-theme-bubble .st-author {
    margin-top: 20px;
}

/* ==========================================================================
   THEME: BORDERED
   ========================================================================== */

.st-theme-bordered .st-testimonial-inner {
    padding: 28px;
    padding-left: 32px;
    border-left: 3px solid var(--st-accent-color);
}

.st-theme-bordered .st-quote-text {
    font-size: 1.1em;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

.st-animated .st-testimonial {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.st-animated .st-testimonial.st-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation delays */
.st-animated.st-layout-grid .st-testimonial:nth-child(1) { transition-delay: 0s; }
.st-animated.st-layout-grid .st-testimonial:nth-child(2) { transition-delay: 0.1s; }
.st-animated.st-layout-grid .st-testimonial:nth-child(3) { transition-delay: 0.2s; }
.st-animated.st-layout-grid .st-testimonial:nth-child(4) { transition-delay: 0.3s; }
.st-animated.st-layout-grid .st-testimonial:nth-child(5) { transition-delay: 0.4s; }
.st-animated.st-layout-grid .st-testimonial:nth-child(6) { transition-delay: 0.5s; }

.st-animated.st-layout-list .st-testimonial:nth-child(1) { transition-delay: 0s; }
.st-animated.st-layout-list .st-testimonial:nth-child(2) { transition-delay: 0.1s; }
.st-animated.st-layout-list .st-testimonial:nth-child(3) { transition-delay: 0.2s; }
.st-animated.st-layout-list .st-testimonial:nth-child(4) { transition-delay: 0.3s; }
.st-animated.st-layout-list .st-testimonial:nth-child(5) { transition-delay: 0.4s; }

.st-animated.st-layout-single .st-testimonial:nth-child(1) { transition-delay: 0s; }
.st-animated.st-layout-single .st-testimonial:nth-child(2) { transition-delay: 0.15s; }
.st-animated.st-layout-single .st-testimonial:nth-child(3) { transition-delay: 0.3s; }

/* Disable animation in slider/carousel - handled by JS */
.st-animated.st-layout-slider .st-testimonial,
.st-animated.st-layout-carousel .st-testimonial {
    opacity: 1;
    transform: none;
    transition-delay: 0s;
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 600px) {
    .st-layout-single .st-quote-text {
        font-size: 1.2em;
    }
    
    .st-layout-single .st-author-image img {
        width: 64px;
        height: 64px;
    }
    
    .st-theme-card .st-testimonial-inner {
        padding: 24px;
    }
    
    .st-theme-bubble .st-bubble-content {
        padding: 20px;
    }
    
    .st-theme-bordered .st-testimonial-inner {
        padding: 20px;
        padding-left: 24px;
    }
}
