/**
 * TravelBaby Elementor Widgets – frontend styles.
 *
 * @package TravelBaby_Experience
 */

/* ─── Reviews Widget Container ─── */

.tb-reviews-widget {
    --tb-star-active: #f59e0b;
    --tb-star-empty: #d1d5db;
    --tb-card-bg: #ffffff;
    --tb-text: #374151;
    --tb-text-muted: #6b7280;
    --tb-border: #f3f4f6;
    --tb-accent: #e67e22;
}

/* ─── Summary Block ─── */

.tb-reviews-summary {
    display: flex;
    gap: 40px;
    align-items: center;
    padding: 32px;
    background: var(--tb-card-bg);
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 32px;
}

.tb-summary-score {
    text-align: center;
    min-width: 140px;
    flex-shrink: 0;
}

.tb-summary-avg {
    display: block;
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--tb-text);
    letter-spacing: -0.02em;
}

.tb-summary-stars {
    margin: 8px 0 4px;
}

.tb-summary-total {
    font-size: 0.875rem;
    color: var(--tb-text-muted);
}

/* Compact summary: centered, no bars, used when < 3 reviews */
.tb-reviews-summary--compact {
    justify-content: center;
}

.tb-reviews-summary--compact .tb-summary-score {
    min-width: auto;
}

.tb-summary-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tb-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tb-bar-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--tb-text-muted);
    width: 16px;
    text-align: right;
    flex-shrink: 0;
}

.tb-bar-track {
    flex: 1;
    height: 8px;
    background: var(--tb-border);
    border-radius: 4px;
    overflow: hidden;
}

.tb-bar-fill {
    height: 100%;
    background: var(--tb-star-active);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.tb-bar-count {
    font-size: 0.75rem;
    color: var(--tb-text-muted);
    width: 28px;
    flex-shrink: 0;
}

/* ─── Grid Layout ─── */

.tb-reviews-grid {
    display: grid;
    gap: 24px;
}

.tb-reviews-grid.tb-cols-1 { grid-template-columns: 1fr; }
.tb-reviews-grid.tb-cols-2 { grid-template-columns: repeat(2, 1fr); }
.tb-reviews-grid.tb-cols-3 { grid-template-columns: repeat(3, 1fr); }
.tb-reviews-grid.tb-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Swiper Carousel ─── */

.tb-reviews-swiper {
    overflow: hidden;
    position: relative;
    padding-bottom: 48px;
}

.tb-reviews-swiper .swiper-slide {
    height: auto;
}

.tb-reviews-swiper .swiper-slide .tb-review-card {
    height: 100%;
}

.tb-reviews-swiper .swiper-pagination {
    bottom: 8px;
}

.tb-reviews-swiper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: var(--tb-text-muted);
    opacity: 0.35;
    transition: opacity 0.2s, background 0.2s, transform 0.2s;
}

.tb-reviews-swiper .swiper-pagination-bullet-active {
    background: var(--tb-accent);
    opacity: 1;
    transform: scale(1.25);
}

.tb-reviews-swiper .swiper-button-prev,
.tb-reviews-swiper .swiper-button-next {
    width: 40px;
    height: 40px;
    background: var(--tb-card-bg);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s, transform 0.2s;
}

.tb-reviews-swiper .swiper-button-prev::after,
.tb-reviews-swiper .swiper-button-next::after {
    font-size: 16px;
    font-weight: 700;
    color: var(--tb-text);
}

.tb-reviews-swiper .swiper-button-prev:hover,
.tb-reviews-swiper .swiper-button-next:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

/* Legacy carousel fallback (kept for backward compat) */

.tb-reviews-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 24px;
    padding-bottom: 8px;
}

.tb-reviews-carousel::-webkit-scrollbar {
    display: none;
}

.tb-reviews-carousel .tb-review-card {
    scroll-snap-align: start;
    flex: 0 0 calc(33.333% - 16px);
    min-width: 280px;
}

.tb-carousel-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.tb-carousel-prev,
.tb-carousel-next {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--tb-border);
    background: var(--tb-card-bg);
    color: var(--tb-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tb-carousel-prev:hover,
.tb-carousel-next:hover {
    border-color: var(--tb-accent);
    color: var(--tb-accent);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.15);
}

/* ─── Review Card ─── */

.tb-review-card {
    background: var(--tb-card-bg);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.tb-review-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.tb-review-quote {
    position: absolute;
    top: 16px;
    right: 20px;
}

.tb-review-quote svg {
    width: 40px;
    height: 40px;
}

/* ─── Stars ─── */

.tb-stars {
    display: inline-flex;
    gap: 2px;
}

.tb-stars svg {
    width: 18px;
    height: 18px;
}

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

.tb-star--empty {
    color: var(--tb-star-empty);
}

.tb-review-rating {
    margin-bottom: 12px;
}

/* ─── Star Fill Animation ─── */

@keyframes tb-star-pop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.tb-stars svg {
    transform: scale(1);
    opacity: 1;
}

.tb-review-rating .tb-stars:not(.tb-stars--animated) svg {
    transform: scale(0);
    opacity: 0;
}

.tb-review-rating .tb-stars--animated svg {
    animation: tb-star-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.tb-review-rating .tb-stars--animated svg:nth-child(1) { animation-delay: 0ms; }
.tb-review-rating .tb-stars--animated svg:nth-child(2) { animation-delay: 60ms; }
.tb-review-rating .tb-stars--animated svg:nth-child(3) { animation-delay: 120ms; }
.tb-review-rating .tb-stars--animated svg:nth-child(4) { animation-delay: 180ms; }
.tb-review-rating .tb-stars--animated svg:nth-child(5) { animation-delay: 240ms; }

/* ─── Verified Badge ─── */

.tb-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #10b981;
    background: #ecfdf5;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    line-height: 1;
}

.tb-verified-badge svg {
    flex-shrink: 0;
}

/* ─── Avatar Initials ─── */

.tb-avatar-initials {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    line-height: 1;
    letter-spacing: 0.5px;
}

.tb-avatar-initials--lg {
    width: 52px;
    height: 52px;
    font-size: 18px;
}

/* ─── Review Text ─── */

.tb-review-text {
    color: var(--tb-text);
    font-size: 0.95rem;
    line-height: 1.65;
    margin: 0 0 auto;
    padding-bottom: 16px;
}

/* ─── Review Footer ─── */

.tb-review-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--tb-border);
    margin-top: auto;
}

.tb-review-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tb-review-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tb-review-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tb-text);
}

.tb-review-date {
    font-size: 0.8rem;
    color: var(--tb-text-muted);
}

.tb-review-property {
    font-size: 0.75rem;
    color: var(--tb-accent);
    font-weight: 500;
}

/* ─── Card Fade-In Animation ─── */

.tb-review-card--animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.tb-review-card--animate.tb-card--visible {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Skeleton Loading ─── */

@keyframes tb-shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.tb-reviews-skeleton {
    margin-bottom: 0;
}

.tb-skeleton-card {
    background: var(--tb-card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tb-shimmer {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 37%, #f3f4f6 63%);
    background-size: 800px 100%;
    animation: tb-shimmer 1.5s infinite linear;
    border-radius: 6px;
}

.tb-shimmer-quote {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-bottom: 16px;
    margin-left: auto;
}

.tb-shimmer-stars {
    width: 110px;
    height: 18px;
    margin-bottom: 12px;
}

.tb-shimmer-text {
    width: 100%;
    height: 14px;
    margin-bottom: 8px;
}

.tb-shimmer-text--short {
    width: 65%;
}

.tb-shimmer-footer {
    width: 60%;
    height: 40px;
    margin-top: 16px;
    border-radius: 20px;
}

/* ─── Empty State (Elementor editor) ─── */

.tb-reviews-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--tb-text-muted);
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 16px;
}

/* ─── List Layout ─── */

.tb-layout-list .tb-reviews-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tb-layout-list .tb-review-card {
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
}

.tb-layout-list .tb-review-quote {
    display: none;
}

.tb-layout-list .tb-review-footer {
    border-top: none;
    padding-top: 0;
    flex-direction: column;
    min-width: 120px;
    text-align: center;
}

.tb-layout-list .tb-review-text {
    padding-bottom: 0;
}

/* ─── Trust Bar Widget ─── */

.tb-trust-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tb-trust-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.tb-trust-rating strong {
    font-weight: 700;
}

.tb-trust-star {
    flex-shrink: 0;
}

.tb-trust-sep {
    opacity: 0.6;
    user-select: none;
}

.tb-trust-verified svg {
    flex-shrink: 0;
}

.tb-trust-bar--empty {
    color: var(--tb-text-muted, #6b7280);
    font-style: italic;
    padding: 12px 24px;
}

/* ─── Testimonial Highlight Widget ─── */

.tb-testimonial-highlight {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-color: #1e293b;
}

.tb-testimonial-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.tb-testimonial-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
    padding: 48px 32px;
}

.tb-testimonial-quote-icon {
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 16px;
}

.tb-testimonial-stars {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    justify-content: inherit;
}

.tb-testimonial-stars .tb-star--empty {
    color: rgba(255, 255, 255, 0.3);
}

.tb-testimonial-text {
    font-size: 1.5rem;
    line-height: 1.6;
    font-weight: 400;
    margin: 0 0 28px;
    font-style: italic;
}

.tb-testimonial-author {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: inherit;
}

.tb-testimonial-author-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tb-testimonial-name {
    font-size: 1rem;
    font-weight: 600;
}

.tb-testimonial-property {
    font-size: 0.85rem;
    opacity: 0.8;
    color: #fff;
}

.tb-testimonial-verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #34d399;
    font-weight: 500;
}

.tb-testimonial-verified svg {
    color: #34d399;
}

.tb-testimonial--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    color: var(--tb-text-muted, #6b7280);
}

/* ─── Responsive ─── */

@media (max-width: 1024px) {
    .tb-reviews-grid.tb-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .tb-reviews-summary {
        flex-direction: column;
        gap: 24px;
        padding: 24px;
    }

    .tb-reviews-grid.tb-cols-3,
    .tb-reviews-grid.tb-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .tb-reviews-carousel .tb-review-card {
        flex: 0 0 calc(50% - 12px);
    }

    .tb-layout-list .tb-review-card {
        flex-direction: column;
    }

    .tb-layout-list .tb-review-footer {
        flex-direction: row;
        text-align: left;
    }

    .tb-testimonial-text {
        font-size: 1.2rem;
    }

    .tb-testimonial-content {
        padding: 32px 20px;
    }
}

@media (max-width: 480px) {
    .tb-reviews-grid.tb-cols-2,
    .tb-reviews-grid.tb-cols-3,
    .tb-reviews-grid.tb-cols-4 {
        grid-template-columns: 1fr;
    }

    .tb-reviews-carousel .tb-review-card {
        flex: 0 0 calc(100% - 16px);
    }

    .tb-review-card {
        padding: 20px;
    }

    .tb-testimonial-text {
        font-size: 1.05rem;
    }
}
