﻿/* Trustpilot Reviews Widget - Frontend Styles */

:root {
    --trw-primary: #00a699;
    --trw-text: #242d33;
    --trw-border: #e5e7eb;
    --trw-bg: #ffffff;
    --trw-gray: #64748b;
    --trw-button-color: #00a699;
}

.trw-reviews-container {
    margin: 24px 0;
    gap: 20px;
}

/* Grid Layout */
.trw-reviews-container.trw-style-grid {
    display: grid;
    grid-auto-flow: row;
    gap: 20px;
}

.trw-reviews-container.trw-style-grid.trw-cols-1 {
    grid-template-columns: 1fr;
}

.trw-reviews-container.trw-style-grid.trw-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.trw-reviews-container.trw-style-grid.trw-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.trw-reviews-container.trw-style-grid.trw-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Cards Layout */
.trw-reviews-container.trw-style-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.trw-reviews-container.trw-style-cards.trw-cols-2 {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

/* Rows Layout */
.trw-reviews-container.trw-style-rows {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* List Layout */
.trw-reviews-container.trw-style-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Carousel Layout */
.trw-reviews-container.trw-style-carousel {
    position: relative;
    margin: 32px 0;
    overflow: hidden;
}

.trw-carousel-track {
    display: flex;
    gap: 16px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    padding: 8px 0;
}

.trw-carousel-slide {
    flex: 0 0 calc((100% - ((var(--trw-carousel-slides, 1) - 1) * 16px)) / var(--trw-carousel-slides, 1));
    min-width: calc((100% - ((var(--trw-carousel-slides, 1) - 1) * 16px)) / var(--trw-carousel-slides, 1));
    max-width: calc((100% - ((var(--trw-carousel-slides, 1) - 1) * 16px)) / var(--trw-carousel-slides, 1));
    box-sizing: border-box;
}

.trw-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: var(--trw-button-color, #00a699);
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.25s ease, transform 0.25s ease;
}

.trw-carousel-prev {
    left: 8px;
}

.trw-carousel-next {
    right: 8px;
}

.trw-carousel-nav:hover {
    background: var(--trw-button-color, #00a699);
    filter: brightness(0.85);
    transform: translateY(-50%) scale(1.1);
}

.trw-carousel-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Review Card - Trustpilot Style */
.trw-review-card {
    background: var(--trw-bg);
    border: 1px solid var(--trw-border);
    border-radius: 4px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 280px;
}

.trw-review-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: var(--trw-primary);
}

/* Review Header — Avatar + Name + Stars */
.trw-review-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

/* Avatar wrapper */
.trw-avatar-wrap {
    flex-shrink: 0;
}

.trw-avatar-img,
.trw-avatar-initials {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.trw-avatar-img {
    object-fit: cover;
    border: 1px solid var(--trw-border);
}

.trw-avatar-initials {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
    user-select: none;
}

/* Author name + stars column */
.trw-review-author-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

/* Author Name */
.trw-review-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--trw-text);
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Stars - Trustpilot SVG style */
.trw-review-rating,
.trw-review-rating-inline {
    display: flex;
    gap: 2px;
    align-items: center;
}

.trw-review-rating-inline svg,
.trw-review-rating svg {
    display: block;
    flex-shrink: 0;
    border-radius: 2px;
}

/* Review Title */
.trw-review-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--trw-text);
    line-height: 1.35;
    margin: 0 0 10px 0;
    padding: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Review Body Text */
.trw-review-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--trw-text);
    margin: 0 0 12px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trw-review-text p {
    margin: 0 0 8px 0;
}

.trw-review-text p:last-child {
    margin-bottom: 0;
}

/* Review Footer - Date */
.trw-review-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    font-size: 12px;
}

.trw-review-date {
    color: var(--trw-gray);
    font-size: 12px;
    white-space: nowrap;
}

.trw-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ecfdf5;
    color: var(--trw-primary);
    border-radius: 20px;
    padding: 4px 10px;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
}

/* Rating Box */
.trw-rating-box {
    background: var(--trw-bg);
    border: 1px solid var(--trw-border);
    border-radius: 8px;
    padding: 32px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-align: center;
    margin: 24px 0;
}

.trw-rating-number {
    font-size: 48px;
    font-weight: 800;
    color: var(--trw-text);
    line-height: 1;
}

.trw-rating-stars {
    font-size: 28px;
    margin: 12px 0 8px;
    letter-spacing: 2px;
}

.trw-rating-reviews {
    font-size: 14px;
    color: var(--trw-gray);
    margin-top: 8px;
}

/* Error */
.trw-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 16px 20px;
    border-radius: 8px;
    border-left: 4px solid #dc2626;
    margin: 20px 0;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .trw-reviews-container.trw-style-grid {
        grid-template-columns: 1fr !important;
    }

    .trw-reviews-container.trw-style-cards {
        grid-template-columns: 1fr !important;
    }

    .trw-carousel-slide {
        flex: 0 0 calc((100% - 16px) / 1) !important;
        min-width: 100%;
    }

    .trw-review-card {
        padding: 16px;
    }

    .trw-review-title {
        font-size: 15px;
    }

    .trw-review-text {
        font-size: 13px;
    }

    .trw-rating-number {
        font-size: 40px;
    }
}

@media (max-width: 480px) {
    .trw-review-header {
        flex-direction: column;
    }

    .trw-review-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .trw-carousel-prev {
        left: 4px;
    }

    .trw-carousel-next {
        right: 4px;
    }
}


/* ============================================================
   Trustpilot Rating Widget — trw-tp-widget
   Matches Trustpilot's official look: font, colors, spacing
   ============================================================ */

.trw-tp-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: #ffffff;
    border: 1px solid #e0e0e8;
    border-radius: 8px;
    padding: 24px 28px 20px;
    max-width: 480px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    box-sizing: border-box;
}

/* Top section: score col + bars col */
.trw-tp-top {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e8;
    padding-bottom: 20px;
}

/* Left column */
.trw-tp-score-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 110px;
}

.trw-tp-label {
    font-size: 18px;
    font-weight: 700;
    color: #191919;
    line-height: 1.2;
    margin-bottom: 4px;
    letter-spacing: -.3px;
}

.trw-tp-score {
    font-size: 42px;
    font-weight: 800;
    color: #191919;
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -1.5px;
}

.trw-tp-stars-row {
    display: flex;
    gap: 0;
    margin-bottom: 8px;
}

.trw-tp-stars-svg {
    display: flex;
    gap: 3px;
}

.trw-tp-stars-svg svg {
    border-radius: 2px;
    display: block;
    flex-shrink: 0;
}

.trw-tp-count {
    font-size: 12px;
    color: #6b6b7b;
    white-space: nowrap;
}

/* Right column — star bars */
.trw-tp-bars-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 4px;
}

.trw-tp-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trw-tp-bar-label {
    font-size: 12px;
    color: #6b6b7b;
    white-space: nowrap;
    min-width: 68px;
    text-align: right;
}

.trw-tp-bar-track {
    flex: 1;
    height: 8px;
    background: #e0e0e8;
    border-radius: 4px;
    overflow: hidden;
}

.trw-tp-bar-fill {
    height: 100%;
    background: #00b67a;
    border-radius: 4px;
    transition: width .4s ease;
}

/* Action buttons */
.trw-tp-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.trw-tp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 26px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none !important;
    line-height: 1;
    cursor: pointer;
    transition: filter .2s ease, transform .15s ease;
    white-space: nowrap;
    border: 2px solid transparent;
    box-sizing: border-box;
    letter-spacing: -.1px;
}

.trw-tp-btn:hover {
    filter: brightness(.9);
    transform: translateY(-1px);
    text-decoration: none !important;
}

.trw-tp-btn svg {
    flex-shrink: 0;
}

/* Primary — black bg, white text */
.trw-tp-btn-write {
    background: #000000;
    color: #ffffff !important;
    border: 1.5px solid #000000;
}

/* Secondary — white bg, dark border */
.trw-tp-btn-profile {
    background: #ffffff;
    color: #191919 !important;
    border: 1.5px solid #c0c0c8;
}

/* Responsive */
@media (max-width: 480px) {
    .trw-tp-top {
        flex-direction: column;
        gap: 16px;
    }

    .trw-tp-score-col {
        flex-direction: row;
        align-items: center;
        gap: 14px;
        flex-wrap: wrap;
        min-width: unset;
    }

    .trw-tp-score {
        font-size: 34px;
        margin-bottom: 0;
    }

    .trw-tp-label {
        font-size: 15px;
        margin-bottom: 0;
    }

    .trw-tp-bars-col {
        width: 100%;
    }

    .trw-tp-actions {
        flex-direction: column;
    }

    .trw-tp-btn {
        justify-content: center;
        width: 100%;
    }
}

/* ============================================================
   Trustpilot Profile Card — [trustpilot-profile]
   Replica del header de perfil oficial de Trustpilot
   ============================================================ */

.trw-profile-card {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: #ffffff;
    border: 1px solid #e0e0e8;
    border-radius: 8px;
    padding: 20px 24px 22px;
    max-width: 520px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    box-sizing: border-box;
}

/* "✓ Perfil reclamado" badge */
.trw-profile-claimed {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: #4a4a5a;
    border: 1px solid #d0d0dc;
    border-radius: 20px;
    padding: 4px 10px 4px 8px;
    margin-bottom: 12px;
    line-height: 1;
}

.trw-profile-claimed svg {
    color: #00b67a;
    flex-shrink: 0;
}

/* Business name */
.trw-profile-name {
    font-size: 26px;
    font-weight: 800;
    color: #191919;
    letter-spacing: -.5px;
    line-height: 1.15;
    margin-bottom: 8px;
}

/* Inline score row: "Opiniones 18 · ★★★★½ 4,5" */
.trw-profile-inline-score {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    margin-bottom: 6px;
    font-size: 14px;
}

.trw-profile-opinions a,
.trw-profile-opinions {
    font-size: 14px;
    color: #191919;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.trw-profile-opinions a {
    color: #191919;
}

.trw-profile-opinions a:hover {
    color: #00b67a;
}

.trw-profile-dot {
    color: #6b6b7b;
    font-size: 16px;
    line-height: 1;
}

.trw-profile-stars-wrap {
    display: flex;
    align-items: center;
}

.trw-tp-stars-sm {
    gap: 2px !important;
}

.trw-tp-stars-sm svg {
    border-radius: 2px;
    display: block;
    flex-shrink: 0;
}

.trw-profile-score-val {
    font-size: 14px;
    font-weight: 600;
    color: #191919;
    white-space: nowrap;
}

/* Category */
.trw-profile-category {
    font-size: 14px;
    color: #00b67a;
    font-weight: 500;
    margin-bottom: 18px;
}

/* CTA actions row — ALWAYS side by side, never stacked */
.trw-profile-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
}

/* Shrink buttons to fit side-by-side regardless of container width */
.trw-profile-actions .trw-tp-btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* On very small screens (< 380px) allow wrapping but keep equal width */
@media (max-width: 380px) {
    .trw-profile-actions {
        flex-wrap: wrap;
    }
    .trw-profile-actions .trw-tp-btn {
        flex: 1 1 45%;
    }
}
