/**
 * WP ReviewRotatorPro Frontend Styles
 * Professional and responsive testimonial display
 */

/* CSS Variables for Customization */
:root {
    --trp-primary-color: #007cba;
    --trp-background-color: #ffffff;
    --trp-text-color: #333333;
    --trp-border-radius: 8px;
    --trp-rotation-speed: 5s;
    --trp-star-color: #ffc107;
    --trp-star-empty-color: #e0e0e0;
    --trp-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --trp-transition: all 0.3s ease;
}

/* Base Testimonials Container */
.trp-testimonials {
    max-width: 100%;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.trp-testimonials-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

/* Individual Testimonial */
.trp-testimonial {
    background: var(--trp-background-color);
    border-radius: var(--trp-border-radius);
    padding: 20px;
    box-shadow: var(--trp-shadow);
    transition: var(--trp-transition);
    position: relative;
    overflow: hidden;
    color: var(--trp-text-color);
}

.trp-testimonial:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.trp-testimonial-pinned {
    border-left: 4px solid var(--trp-primary-color);
}

/* Avatar Styles */
.trp-testimonial-avatar {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.trp-avatar-image,
.trp-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.trp-avatar-placeholder {
    background: var(--trp-primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
}

/* Rating Stars */
.trp-testimonial-rating {
    text-align: center;
    margin-bottom: 15px;
}

.trp-star {
    color: var(--trp-star-empty-color);
    font-size: 20px;
    transition: var(--trp-transition);
}

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

/* Testimonial Text */
.trp-testimonial-text {
    text-align: center;
    margin-bottom: 15px;
    line-height: 1.6;
}

.trp-testimonial-text p {
    margin: 0;
    font-style: italic;
    position: relative;
}

.trp-testimonial-text p::before {
    content: '"';
    position: absolute;
    left: -10px;
    top: -5px;
    font-size: 24px;
    color: var(--trp-primary-color);
    font-weight: bold;
}

.trp-testimonial-text p::after {
    content: '"';
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 24px;
    color: var(--trp-primary-color);
    font-weight: bold;
}

/* Author Information */
.trp-testimonial-author {
    text-align: center;
    font-weight: 600;
}

.trp-author-link {
    color: var(--trp-primary-color);
    text-decoration: none;
    transition: var(--trp-transition);
}

.trp-author-link:hover {
    text-decoration: underline;
}

.trp-source-badge {
    display: inline-block;
    background: var(--trp-primary-color);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    text-transform: uppercase;
    font-weight: normal;
}

.trp-source-google {
    background: #4285f4;
}

/* Layout Styles */

/* Card Layout (Default) */
.trp-layout-card .trp-testimonial {
    flex: 0 1 300px;
    min-height: 250px;
}

/* List Layout */
.trp-layout-list .trp-testimonials-container {
    flex-direction: column;
    align-items: center;
}

.trp-layout-list .trp-testimonial {
    display: flex;
    align-items: center;
    text-align: left;
    max-width: 600px;
    width: 100%;
}

.trp-layout-list .trp-testimonial-avatar {
    margin-right: 20px;
    margin-bottom: 0;
}

.trp-layout-list .trp-testimonial-content {
    flex: 1;
}

.trp-layout-list .trp-testimonial-rating {
    text-align: left;
    margin-bottom: 10px;
}

.trp-layout-list .trp-testimonial-text {
    text-align: left;
}

.trp-layout-list .trp-testimonial-author {
    text-align: left;
}

/* Fade Layout */
.trp-layout-fade .trp-testimonials-container {
    position: relative;
    height: 300px;
}

.trp-layout-fade .trp-testimonial {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.trp-layout-fade .trp-testimonial:first-child,
.trp-layout-fade .trp-testimonial.active {
    opacity: 1;
}

/* Average Rating */
.trp-average-rating {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 123, 186, 0.1);
    border-radius: var(--trp-border-radius);
}

.trp-average-stars {
    margin-bottom: 5px;
}

.trp-average-text {
    font-size: 14px;
    color: #666;
}

/* Read More Button */
.trp-read-more {
    text-align: center;
    margin-top: 20px;
}

.trp-read-more-button {
    background: var(--trp-primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: var(--trp-border-radius);
    text-decoration: none;
    display: inline-block;
    transition: var(--trp-transition);
    font-weight: 600;
}

.trp-read-more-button:hover {
    background: color-mix(in srgb, var(--trp-primary-color) 80%, black);
    transform: translateY(-1px);
}

/* Floating Testimonials - Completely Redesigned */
.trp-floating-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 350px;
    height: 250px;
    background: var(--trp-background-color);
    border-radius: var(--trp-border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.5s ease;
    overflow: hidden;
}

.trp-floating-popup.show {
    transform: translateX(0);
}

.trp-floating-content {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 15px;
    box-sizing: border-box;
}

.trp-floating-testimonial {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 15px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.trp-floating-testimonial.active {
    opacity: 1;
    visibility: visible;
}

/* Floating testimonial content styling */
.trp-floating-testimonial .trp-testimonial {
    margin: 0;
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.trp-floating-testimonial .trp-testimonial-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

.trp-floating-testimonial .trp-testimonial-text {
    flex: 1;
    margin-bottom: 12px;
    overflow: hidden;
}

.trp-floating-testimonial .trp-testimonial-text p {
    margin: 0;
    line-height: 1.4;
    font-size: 14px;
    max-height: 90px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
}

.trp-floating-testimonial .trp-testimonial-rating {
    margin-bottom: 8px;
    flex-shrink: 0;
}

.trp-floating-testimonial .trp-testimonial-author {
    margin-top: auto;
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1.3;
}

.trp-floating-testimonial .trp-testimonial-avatar {
    width: 35px;
    height: 35px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.trp-close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
    z-index: 10;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trp-close-button:hover {
    color: #333;
}

/* Exit Intent Popup */
.trp-exit-intent-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trp-exit-intent-content {
    background: var(--trp-background-color);
    border-radius: var(--trp-border-radius);
    padding: 30px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.trp-exit-intent-content h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--trp-primary-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideLeft {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.trp-animation-fade-in .trp-testimonial {
    animation: fadeIn 0.6s ease forwards;
}

.trp-animation-slide-up .trp-testimonial {
    animation: slideUp 0.6s ease forwards;
}

.trp-animation-slide-down .trp-testimonial {
    animation: slideDown 0.6s ease forwards;
}

.trp-animation-slide-left .trp-testimonial {
    animation: slideLeft 0.6s ease forwards;
}

.trp-animation-slide-right .trp-testimonial {
    animation: slideRight 0.6s ease forwards;
}

.trp-animation-zoom-in .trp-testimonial {
    animation: zoomIn 0.6s ease forwards;
}

/* Widget Specific Styles */
.trp-testimonials-widget .trp-testimonial {
    margin-bottom: 15px;
}

.trp-widget-content .trp-testimonials-container {
    flex-direction: column;
}

.trp-widget-content .trp-testimonial {
    flex: none;
}

/* Shortcode Container */
.trp-shortcode-container {
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .trp-testimonials-container {
        flex-direction: column;
        align-items: center;
    }
    
    .trp-testimonial {
        max-width: 100%;
        margin-bottom: 20px;
    }
    
    .trp-layout-list .trp-testimonial {
        flex-direction: column;
        text-align: center;
    }
    
    .trp-layout-list .trp-testimonial-avatar {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .trp-layout-list .trp-testimonial-rating,
    .trp-layout-list .trp-testimonial-text,
    .trp-layout-list .trp-testimonial-author {
        text-align: center;
    }
    
    .trp-floating-popup {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .trp-exit-intent-content {
        margin: 20px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .trp-testimonial {
        padding: 15px;
    }
    
    .trp-avatar-image,
    .trp-avatar-placeholder {
        width: 50px;
        height: 50px;
    }
    
    .trp-avatar-placeholder {
        font-size: 20px;
    }
    
    .trp-star {
        font-size: 18px;
    }
    
    .trp-testimonial-text p::before,
    .trp-testimonial-text p::after {
        font-size: 20px;
    }
}

/* Loading State */
.trp-testimonials.loading {
    opacity: 0.5;
    pointer-events: none;
}

.trp-testimonials.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--trp-primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No Testimonials Message */
.trp-no-testimonials {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Print Styles */
@media print {
    .trp-floating-popup,
    .trp-exit-intent-overlay {
        display: none !important;
    }
    
    .trp-testimonial {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
} 