/**
 * Testimonial Carousel Styles
 */

.carousel-slider__testimonial-item {
    padding: 20px;
    box-sizing: border-box;
}

.testimonial-content-wrapper {
    display: flex;
    align-items: center;
    gap: 30px;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 250px;
}

/* Image on right layout */
.testimonial-image-right .testimonial-content-wrapper {
    flex-direction: row;
}

/* Image on left layout */
.testimonial-image-left .testimonial-content-wrapper {
    flex-direction: row-reverse;
}

.testimonial-text-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.testimonial-text {
    position: relative;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    font-style: italic;
}

.quote-icon {
    color: #e0e0e0;
    margin-bottom: 10px;
    opacity: 0.5;
}

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

.testimonial-author {
    margin-top: 15px;
}

.author-name {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin-bottom: 5px;
}

.author-position {
    font-size: 14px;
    color: #666;
}

.testimonial-rating {
    display: flex;
    gap: 4px;
    margin-top: 10px;
}

.testimonial-rating .star {
    font-size: 20px;
    color: #ddd;
}

.testimonial-rating .star.filled {
    color: #ffc107;
}

.testimonial-image-content {
    flex: 0 0 300px;
    position: relative;
}

.testimonial-image-link {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.testimonial-image-link:hover {
    transform: scale(1.02);
}

.testimonial-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

.testimonial-image-link:hover .image-overlay {
    opacity: 1;
}

.zoom-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-icon svg {
    width: 24px;
    height: 24px;
}

/* Lightbox styles */
.testimonial-lightbox {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s;
}

.testimonial-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.testimonial-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    animation: zoomIn 0.3s;
}

.testimonial-lightbox-content img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 90vh;
    display: block;
    margin: 0 auto;
}

.testimonial-lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1000000;
}

.testimonial-lightbox-close:hover,
.testimonial-lightbox-close:focus {
    color: #bbb;
}

.testimonial-lightbox-caption {
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    margin-top: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Responsive design */
@media (max-width: 768px) {
    .testimonial-content-wrapper {
        flex-direction: column !important;
        padding: 20px;
    }

    /* Force column in list mode on mobile regardless of left/right position */
    .testimonial-list-mode .testimonial-image-right .testimonial-content-wrapper,
    .testimonial-list-mode .testimonial-image-left .testimonial-content-wrapper {
        flex-direction: column !important;
    }

    /* Mobile ordering: text first */
    .carousel-slider-outer[data-mobile-layout="text_first"] .testimonial-text-content { order: 1; width: 100%; }
    .carousel-slider-outer[data-mobile-layout="text_first"] .testimonial-image-content { order: 2; margin-top: 16px; }

    /* Mobile ordering: image first */
    .carousel-slider-outer[data-mobile-layout="image_first"] .testimonial-image-content { order: 1; margin-top: 0; }
    .carousel-slider-outer[data-mobile-layout="image_first"] .testimonial-text-content { order: 2; margin-top: 16px; }

    .testimonial-image-content {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
    }

    .testimonial-text {
        font-size: 14px;
    }

    .author-name {
        font-size: 16px;
    }

    .author-position {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .testimonial-content-wrapper {
        padding: 15px;
    }

    .testimonial-image-content { max-width: 100%; }
}

/* Admin styles for testimonial management */
.testimonial-image-upload {
    margin: 15px 0;
}

.testimonial-image-preview {
    margin-bottom: 10px;
}

.carousel-slider__add-testimonial {
    margin-bottom: 15px;
}

/* Testimonial Text Editor - Make it wider */
.testimonial-text-editor-field {
    margin-bottom: 20px;
}

.testimonial-text-editor-field .wp-editor-container {
    width: 100% !important;
    max-width: 100% !important;
}

.testimonial-text-editor-field .wp-editor-wrap {
    width: 100% !important;
    max-width: 100% !important;
}

.testimonial-text-editor-field iframe {
    width: 100% !important;
    min-height: 200px;
}

.testimonial-text-editor-field .mce-tinymce {
    width: 100% !important;
}

.testimonial-text-editor-field textarea {
    width: 100% !important;
    min-height: 200px;
}

.testimonial-text-editor-field .wp-editor-tools {
    background: #f1f1f1;
    border: 1px solid #ddd;
    border-bottom: none;
}

.testimonial-text-editor-field .mce-toolbar-grp {
    background: #f5f5f5;
}

/* List Display Mode Styles */
.carousel-slider-outer.testimonial-list-mode,
.testimonial-list-mode .testimonial-list-wrapper,
.testimonial-list-mode .swiper-wrapper,
.testimonial-list-mode.owl-carousel {
    display: block !important;
    width: 100% !important;
}

/* Disable Owl Carousel in list mode */
.testimonial-list-mode .owl-stage-outer,
.testimonial-list-mode .owl-stage {
    display: block !important;
    width: 100% !important;
    transform: none !important;
}

.testimonial-list-mode .owl-item,
.testimonial-list-mode .testimonial-list-item,
.testimonial-list-mode .swiper-slide {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 20px !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    float: none !important;
    clear: both !important;
    position: static !important;
}

.testimonial-list-mode .carousel-slider__testimonial-item {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
}

.testimonial-list-mode .testimonial-content-wrapper {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 30px !important;
    width: 100% !important;
}

.testimonial-list-mode .testimonial-image-right .testimonial-content-wrapper {
    flex-direction: row !important;
}

.testimonial-list-mode .testimonial-image-left .testimonial-content-wrapper {
    flex-direction: row-reverse !important;
}

.carousel-slider-outer-testimonial-carousel .testimonial-hidden,
.testimonial-list-mode .owl-item.testimonial-hidden,
.testimonial-list-mode .testimonial-list-item.testimonial-hidden,
.testimonial-list-mode .swiper-slide.testimonial-hidden {
    display: none !important;
    opacity: 0;
    transform: translateY(20px);
}

.testimonial-list-mode .testimonial-showing,
.testimonial-list-mode .owl-item.testimonial-showing,
.carousel-slider-outer-testimonial-carousel .testimonial-showing {
    display: block !important;
    animation: slideInUp 0.5s ease forwards;
}

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

/* Show All Button Styles */
.testimonial-show-all-wrapper {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
    padding: 0 20px;
    clear: both;
    width: 100%;
}

.testimonial-list-mode .testimonial-show-all-wrapper {
    display: block;
    width: 100%;
}

.testimonial-show-all-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    text-transform: none;
    letter-spacing: 0.5px;
}

.testimonial-show-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.testimonial-show-all-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.testimonial-show-all-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* List mode specific spacing */
.carousel-slider-outer-testimonial-carousel.testimonial-list-mode .swiper-slide,
.testimonial-list-mode .testimonial-list-item {
    margin-bottom: 20px;
}

.testimonial-list-mode .testimonial-list-item:last-child {
    margin-bottom: 0;
}

/* Ensure list items are visible */
.testimonial-list-mode .carousel-slider__testimonial-item {
    width: 100%;
    display: block;
}

/* Responsive styles for button */
@media (max-width: 768px) {
    .testimonial-show-all-btn {
        padding: 12px 30px;
        font-size: 14px;
    }
    
    .testimonial-show-all-wrapper {
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .testimonial-show-all-btn {
        padding: 10px 25px;
        font-size: 13px;
        width: 100%;
        max-width: 250px;
    }
}

/* Final mobile overrides placed after list-mode rules to ensure precedence */
@media (max-width: 768px) {
    /* Force column layout in list mode regardless of initial side */
    .carousel-slider-outer.testimonial-list-mode .testimonial-image-right .testimonial-content-wrapper,
    .carousel-slider-outer.testimonial-list-mode .testimonial-image-left .testimonial-content-wrapper {
        flex-direction: column !important;
    }

    /* Apply ordering by mobile layout attribute */
    .carousel-slider-outer.testimonial-list-mode[data-mobile-layout="text_first"] .testimonial-text-content { order: 1 !important; width: 100% !important; }
    .carousel-slider-outer.testimonial-list-mode[data-mobile-layout="text_first"] .testimonial-image-content { order: 2 !important; width: 100% !important; max-width: 100% !important; margin-top: 16px !important; }

    .carousel-slider-outer.testimonial-list-mode[data-mobile-layout="image_first"] .testimonial-image-content { order: 1 !important; width: 100% !important; max-width: 100% !important; margin-top: 0 !important; }
    .carousel-slider-outer.testimonial-list-mode[data-mobile-layout="image_first"] .testimonial-text-content { order: 2 !important; width: 100% !important; margin-top: 16px !important; }
}
