/**
 * A.M TRADERS - Testimonials (Glassmorphism Slider)
 * Section: Section 1.8
 */

.elementor-widget-am_testimonials,
.elementor-widget-am_testimonials .elementor-widget-container,
.elementor-widget-shortcode:has(.am-testi-section),
.elementor-widget-shortcode:has(.am-testi-section) .elementor-widget-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: block !important;
}

.e-con:has(.am-testi-section),
.elementor-section:has(.am-testi-section) {
    padding: 0 !important;
    max-width: 100% !important;
}

.am-testi-section {
    position: relative;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    background-color: var(--am-dark, #151516);
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--am-font-body, 'Raleway', sans-serif);
    color: var(--am-white, #ffffff);
}

body.elementor-editor-active .am-testi-section {
    left: 0 !important;
    right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
}

/* Ambient Blue Gradient Orbs */
.am-testi-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.12; /* Subtle visibility against dark background */
}

.am-testi-orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--am-blue, #3858e9) 0%, rgba(56,88,233,0) 70%);
    top: -100px;
    left: -150px;
}

.am-testi-orb-2 {
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--am-blue, #3858e9) 0%, rgba(56,88,233,0) 70%);
    bottom: -200px;
    right: -200px;
}

/* Header - Perfectly Centered */
.am-testi-header {
    width: 100%;
    text-align: center;
    padding: 0 clamp(20px, 4vw, 40px);
    margin-bottom: clamp(20px, 3.5vh, 45px);
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.am-testi-title {
    font-family: var(--am-font-heading, 'Megante', serif);
    font-size: clamp(32px, 3.8vw, 54px);
    margin: 0;
    line-height: 1.2;
    text-align: center;
}

.am-testi-title span {
    color: var(--am-blue, #3858e9);
}

/* Main Layout */
.am-testi-layout {
    position: relative;
    width: 100%;
    height: 32vw;
    max-height: calc(100vh - 160px);
    min-height: 340px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 1;
}

/* Left Square Image Container - Preserved Exactly */
.am-testi-image-wrapper {
    position: absolute;
    left: 5vw;
    top: 50%;
    transform: translateY(-50%);
    width: 30vw;
    aspect-ratio: 1 / 1;
    border-radius: 24px;
    overflow: hidden;
    z-index: 1;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.am-testi-img-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), transform 1.2s ease;
    transform: scale(1.05);
}

.am-testi-img-slide.is-active {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

/* Carousel Wrapper to sync height and width exactly */
.am-testi-carousel-wrapper {
    position: absolute;
    left: 20vw; /* Overlaps right half of the 30vw image */
    top: 50%;
    transform: translateY(-50%);
    width: 56vw; /* 28vw * 2 */
    display: flex;
    z-index: 2;
}

/* Fixed Glass Station - Exactly 50% width of the wrapper, 100% height */
.am-glass-station {
    position: absolute;
    left: 0;
    top: 0;
    width: 50%; /* Exactly 28vw */
    height: 100%; /* Matches Swiper height perfectly */
    background: rgba(30, 30, 35, 0.45);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
    z-index: 1; /* Behind swiper */
    pointer-events: none;
}

/* Swiper Container */
.am-testi-swiper {
    position: relative;
    width: 100%; /* Matches wrapper width (56vw) */
    height: auto;
    z-index: 2; /* Above glass station */
    overflow: visible !important;
    /* Clips left edge exactly at glass station bounds (x=0) */
    clip-path: polygon(0 -100%, 100vw -100%, 100vw 200%, 0 200%); 
}

/* Enforce precise slide sizing and alignment */
.am-testi-swiper .swiper-slide {
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: flex;
    justify-content: center;
    align-items: center;
    height: auto; /* Allow Swiper to set equal height for all slides */
}

/* Base Card Styling */
.am-testi-card {
    width: 100%;
    /* Let the card take 100% of the slide's height, which is synced to the tallest slide */
    height: 100%;
    min-height: 200px;
    padding: clamp(24px, 2.5vw, 36px) clamp(24px, 2.5vw, 36px);
    border-radius: 20px;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
}

/* Prev Card (Fading out when leaving left) */
.swiper-slide-prev {
    opacity: 0 !important;
    transition: opacity 0.5s ease;
}

/* Content Layout (Icon + Text Row) */
.am-testi-content-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.am-testi-quote-icon {
    font-family: Georgia, serif;
    font-size: clamp(32px, 2.2vw, 42px);
    color: var(--am-blue, #3858e9);
    line-height: 0.9;
    margin-top: -2px;
    flex-shrink: 0;
    user-select: none;
}

.am-testi-text-col {
    flex: 1;
    min-width: 0; /* Prevents text from overflowing */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.am-testi-text {
    font-size: clamp(13px, 0.9vw, 15px);
    line-height: 1.5;
    color: #8b98a5; /* Slightly muted for next slide */
    margin: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    transition: color 0.6s ease;
}

.swiper-slide-active .am-testi-text {
    color: #ffffff; /* Bright white for active slide */
}

/* Author Info */
.am-testi-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.am-testi-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.am-testi-author-info h4 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
}

.am-testi-author-info p {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.2;
}

/* Responsive */
@media (max-width: 992px) {
    .am-testi-section {
        height: auto !important;
        min-height: 100vh !important;
        max-height: none !important;
        padding: 60px 0 !important;
    }
    .am-testi-layout {
        height: auto;
        min-height: 240px;
    }
    .am-testi-image-wrapper {
        display: none; 
    }
    .am-testi-carousel-wrapper {
        position: relative;
        top: 0;
        transform: none;
        left: 5vw;
        width: 90vw;
        height: auto;
        min-height: 200px;
    }
    .am-glass-station {
        width: 100%; /* On mobile, 1 slide is active, cover it entirely */
    }
    .am-testi-swiper {
        clip-path: none;
    }
    .swiper-slide {
        width: 100% !important;
    }
}
