/**
 * Testimonial Card Widget Styles
 * 
 * Post-like layout with image/video on top, followed by date, name, and text.
 * Includes responsive carousel functionality and hover effects.
 */

/* Base Widget Structure */
.testimonial-card-widget {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding-bottom: 40px; /* Space for pagination at bottom */
    box-sizing: border-box;
}

/* Swiper Slide */
.testimonial-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.testimonial-card:hover {
    transform: translateY(-5px);
}

/* Media Section - Image/Video */
.testimonial-media {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.testimonial-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.testimonial-media iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

.testimonial-card:hover .testimonial-media img {
    transform: scale(1.05);
}

.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #2a2a2a;
    color: white;
}

.video-placeholder i {
    font-size: 3rem;
    opacity: 0.8;
}

/* Card Content */
.testimonial-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Service Name */
.testimonial-service-name {
    font-size: 14px;
    color: #AD8330;
    margin-bottom: 10px;
    font-weight: 500;
}

/* Client Name */
.testimonial-name {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin: 15px 0 0;
    line-height: 1.4;
    font-style: italic;
}

/* Testimonial Text */
.testimonial-text {
    font-size: 16px;
    line-height: 1.6;
    color: #666666;
    margin: 0;
    flex-grow: 1;
}

/* Navigation Arrows */
.testimonial-card-widget .swiper-button-prev,
.testimonial-card-widget .swiper-button-next {
    color: #AD8330;
}

.testimonial-card-widget .swiper-button-prev:after,
.testimonial-card-widget .swiper-button-next:after {
    font-size: 24px;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .testimonial-name {
        font-size: 18px;
    }
    
    .testimonial-text {
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    .testimonial-card-content {
        padding: 15px;
    }
    
    .testimonial-media {
        height: 180px;
    }
    .testimonial-name {
        font-size: 15px;
        margin-top: 12px;
    }
    .testimonial-service-name {
        font-size: 13px;
    }
    
    .testimonial-text {
        font-size: 14px;
    }
    
    .testimonial-card-widget .swiper-button-prev:after,
    .testimonial-card-widget .swiper-button-next:after {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .testimonial-card-content {
        padding: 12px;
    }
    
    .testimonial-media {
        height: 160px;
    }
    .testimonial-name {
        text-align:center;
        font-size: 14px;
        margin-top: 10px;
    }
    .testimonial-service-name {
        text-align:center;
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .testimonial-text {
        font-size: 13px;
        line-height: 1.5;
    }
    
    .testimonial-card-widget .swiper-button-prev:after,
    .testimonial-card-widget .swiper-button-next:after {
        font-size: 18px;
    }
}

/* Grid Layout Styles */
.testimonial-card-grid-layout {
    padding-bottom: 0; /* Remove carousel padding for grid */
}

.testimonial-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

/* Grid cards maintain full height */
.testimonial-card-grid .testimonial-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Ensure content fills available space */
.testimonial-card-grid .testimonial-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.testimonial-card-grid .testimonial-text {
    flex-grow: 1;
}

/* Responsive Grid Layout */
@media (max-width: 1024px) {
    .testimonial-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .testimonial-card-grid {
        grid-template-columns: 1fr;
    }
}

/* Popup Styles */
.testimonial-card.has-popup {
    cursor: pointer;
}

.testimonial-card.has-popup:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.testimonial-click-indicator {
    position: absolute;
    bottom: 15px;
    right: 15px;
    color: #AD8330;
    font-size: 24px;
    transition: transform 0.3s ease, color 0.3s ease;
    opacity: 0.7;
}

.testimonial-card.has-popup:hover .testimonial-click-indicator {
    transform: scale(1.2);
    opacity: 1;
}

/* Popup Modal */
.testimonial-popup-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.testimonial-popup-modal.active {
    display: block;
}

.testimonial-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.testimonial-popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 12px;
    max-width: 580px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popupFadeIn 0.3s ease;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.testimonial-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #AD8330;
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 36px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    outline: none;
}

.testimonial-popup-close:hover {
    background: #8a6627;
    transform: rotate(90deg);
}

.testimonial-popup-close:focus {
    outline: 2px solid #AD8330;
    outline-offset: 2px;
}

.testimonial-popup-inner {
    padding: 40px;
}

.testimonial-popup-image {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 30px;
    border-radius: 8px;
    overflow: hidden;
}

.testimonial-popup-image img {
    width: 100%;
    height: auto;
    display: block;
}

.testimonial-popup-text {
    font-size: 16px;
    line-height: 1.8;
    color: #333333;
}

.testimonial-popup-text p {
    margin-bottom: 15px;
}

.testimonial-popup-text p:last-child {
    margin-bottom: 0;
}

/* Responsive Popup */
@media (max-width: 768px) {
    .testimonial-popup-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .testimonial-popup-inner {
        padding: 30px 20px;
    }
    
    .testimonial-popup-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }
    
    .testimonial-popup-text {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .testimonial-popup-inner {
        padding: 25px 15px;
    }
    
    .testimonial-popup-image {
        margin-bottom: 20px;
    }
    
    .testimonial-popup-text {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .testimonial-click-indicator {
        font-size: 20px;
        bottom: 10px;
        right: 10px;
    }
}

/* Prevent body scroll when popup is open */
body.testimonial-popup-open {
    overflow: hidden;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .testimonial-card,
    .testimonial-media img {
        transition: none;
    }
    
    .testimonial-card:hover {
        transform: none;
    }
    
    .testimonial-card:hover .testimonial-media img {
        transform: none;
    }
    
    .testimonial-popup-content {
        animation: none;
    }
    
    .testimonial-popup-close:hover {
        transform: none;
    }
}
