/* Trustpilot Reviews Widget - Frontend Styles */

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

/* ============================================================
   Grid Layout
   ============================================================ */

.trw-reviews-container {
    margin: 24px 0;
    box-sizing: border-box;
    width: 100%;
}

.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); }

/* ============================================================
   Carousel Layout
   ============================================================ */

.trw-reviews-container.trw-style-carousel {
    position: relative;
    margin: 32px 0;
    overflow: hidden;
    width: 100%;
}

.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, #00b67a);
    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 {
    filter: brightness(0.85);
    transform: translateY(-50%) scale(1.1);
}

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

/* ============================================================
   Review Card
   ============================================================ */

.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: box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 280px;
    box-sizing: border-box;
}

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

.trw-review-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.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;
}

.trw-review-author-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

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

.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;
}

/* Título de la reseña — usa <p> para no interferir con la jerarquía del tema */
.trw-review-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--trw-text);
    line-height: 1.35;
    margin: 0 0 10px;
    padding: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.trw-review-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--trw-text);
    margin: 0 0 12px;
    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-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.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;
}

/* ============================================================
   Error message
   ============================================================ */

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

/* ============================================================
   Rating Widget — [trustpilot-rating]
   Full-width, matches Trustpilot official look
   ============================================================ */

.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;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    display: flex;
    flex-direction: column;
}

.trw-tp-top {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    flex: 1;
}

.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;
}

.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%;
    width: var(--trw-pct, 0%);
    background: #00b67a;
    border-radius: 4px;
    transition: width .4s ease;
}

/* ============================================================
   Shared Button Styles — used in both rating & profile widgets
   ============================================================ */

.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.2;
    cursor: pointer;
    transition: filter .2s ease, transform .15s ease;
    white-space: normal;          /* permite que el texto salte de línea en mobile */
    word-break: break-word;
    text-align: center;
    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 CTA — Trustpilot green bg, white text */
.trw-tp-btn-write {
    background: #00b67a;
    color: #ffffff !important;
    border-color: #00b67a;
}

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

/* ============================================================
   Profile Card — [trustpilot-profile]
   Full-width
   ============================================================ */

.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;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    display: flex;
    flex-direction: column;
}

.trw-profile-claimed {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    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;
}

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

.trw-profile-inline-score {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    margin-bottom: 6px;
    font-size: 14px;
}

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

.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;
}

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

.trw-profile-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;       /* que ambos botones tengan la misma altura */
    flex-wrap: wrap;            /* permite que bajen a segunda línea en mobile */
    margin-top: auto;
    padding-top: 18px;
}

.trw-profile-actions .trw-tp-btn {
    flex: 1 1 auto;      /* crece desde su tamaño natural */
    min-width: 140px;    /* ancho mínimo para que el texto sea legible */
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
}

/* ============================================================
   Responsive
   ============================================================ */

/* --- Tablet estrecha / móvil landscape (≤ 768px) --- */
@media (max-width: 768px) {
    .trw-reviews-container.trw-style-grid {
        grid-template-columns: 1fr !important;
    }

    .trw-carousel-slide {
        flex: 0 0 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }

    /* Botones del perfil: apilados y full-width en todo mobile */
    .trw-profile-actions {
        flex-direction: column;
        gap: 8px;
    }

    .trw-profile-actions .trw-tp-btn {
        width: 100%;
        flex: none;
        min-width: unset;
        justify-content: center;
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* --- Móviles grandes (≤ 600px) --- */
@media (max-width: 600px) {
    .trw-tp-widget {
        padding: 20px 16px 16px;
    }

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

    /* Rating: score arriba, barras abajo */
    .trw-tp-top {
        flex-direction: column;
        gap: 16px;
    }

    .trw-tp-score-col {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        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%;
    }

    /* Etiquetas de barras más cortas en móvil */
    .trw-tp-bar-label {
        min-width: 54px;
        font-size: 11px;
    }

    .trw-profile-name {
        font-size: 20px;
    }

    .trw-profile-inline-score {
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* --- Móviles pequeños (≤ 480px) --- */
@media (max-width: 480px) {
    .trw-review-header {
        flex-direction: column;
        gap: 8px;
    }

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

    /* Flechas del carrusel más pequeñas y pegadas al borde */
    .trw-carousel-nav {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .trw-carousel-prev { left: 2px; }
    .trw-carousel-next { right: 2px; }

    /* Tarjetas: padding reducido */
    .trw-review-card {
        padding: 12px;
        min-height: 240px;
    }
}

/* ============================================================
   Elementor — altura igual para rating/profile (NO afecta carousel)
   Estrategia:
   1. Forzar align-items: stretch en la fila Elementor para que ambas
      columnas tengan la misma altura (la del widget mas alto).
   2. Propagar esa altura hacia abajo hasta llegar al widget real.
   ============================================================ */

/* Nivel 1: La seccion/fila de Elementor iguala alturas de columnas */
.elementor-section:has(.trw-tp-widget),
.elementor-section:has(.trw-profile-card),
.e-con:has(.trw-tp-widget),
.e-con:has(.trw-profile-card) {
    align-items: stretch !important;
}

/* Nivel 2: Las columnas se estiran */
.elementor-column:has(.trw-tp-widget),
.elementor-column:has(.trw-profile-card) {
    align-self: stretch !important;
}

/* Nivel 3: El widget-wrap dentro de la columna se estira */
.elementor-column:has(.trw-tp-widget) > .elementor-widget-wrap,
.elementor-column:has(.trw-profile-card) > .elementor-widget-wrap {
    height: 100%;
    align-items: stretch !important;
}

/* Nivel 4: El shortcode widget y su container */
.elementor-widget-shortcode:has(.trw-tp-widget),
.elementor-widget-shortcode:has(.trw-profile-card),
.elementor-widget-shortcode:has(.trw-tp-widget) > .elementor-widget-container,
.elementor-widget-shortcode:has(.trw-profile-card) > .elementor-widget-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Nivel 5: Los widgets reales rellenan el espacio disponible */
.elementor-widget-shortcode:has(.trw-tp-widget) > .elementor-widget-container > .trw-tp-widget,
.elementor-widget-shortcode:has(.trw-profile-card) > .elementor-widget-container > .trw-profile-card {
    flex: 1;
}



/* ============================================================
   Trustpilot Logo Footer — dentro del widget de rating
   ============================================================ */

.trw-tp-logo-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid #f0f0f5;
}

.trw-tp-logo-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.trw-tp-logo-link:hover {
    opacity: 1;
    text-decoration: none !important;
}

.trw-tp-logo-link svg {
    flex-shrink: 0;
    border-radius: 4px;
    display: block;
}

.trw-tp-logo-wordmark {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1;
    display: flex;
    align-items: baseline;
}

/* Todo el texto en negro — igual que el logo oficial de Trustpilot */
.trw-tp-logo-trust,
.trw-tp-logo-pilot {
    color: #191919;
}


