/**
 * M2 Med Solutions - Testimonials Showcase Styles
 *
 * Unified card architecture: Avatar, Name & Credentials, Practice Name, then Quote or Video.
 * Responsive Layout:
 *  - Row 1: 16:9 Video Cards side by side
 *  - Below: Uniform 3-column grid of Written Reviews
 *  - Mobile: Clean single-column stack
 */

:root {
    --m2-navy: #011828;
    --m2-navy-deep: #000f1c;
    --m2-blue: #0097CE;
    --m2-blue-dark: #007ba8;
    --m2-blue-light: #e0f2fe;
    --m2-blue-tint: #f0f9ff;
    --m2-border: #e2e8f0;
    --m2-border-hover: #cbd5e1;
    --m2-card-bg: #ffffff;
    --m2-text-title: #011828;
    --m2-text-heading: #0f172a;
    --m2-text-body: #334155;
    --m2-text-muted: #64748b;
    --m2-radius: 14px;
    --m2-shadow: 0 4px 16px rgba(1, 24, 40, 0.04);
    --m2-shadow-hover: 0 12px 28px rgba(1, 24, 40, 0.08);
}

.m2-testimonials-container {
    width: 100% !important;
    max-width: 1240px !important;
    margin: 0 auto !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    color: var(--m2-text-heading) !important;
    box-sizing: border-box !important;
}

/* ========================================================
   1. STATS BAR (Room for 3 to 4 stats total)
   ======================================================== */
.m2-testi-trust-bar {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid var(--m2-border) !important;
    border-radius: var(--m2-radius) !important;
    padding: 20px 24px !important;
    margin-bottom: 28px !important;
    box-shadow: var(--m2-shadow) !important;
}

.m2-testi-trust-item {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
}

.m2-testi-trust-icon {
    font-size: 24px !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    background: var(--m2-blue-tint) !important;
    background-color: var(--m2-blue-tint) !important;
    color: var(--m2-blue) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    border: 1px solid var(--m2-blue-light) !important;
}

.m2-testi-trust-info {
    display: flex !important;
    flex-direction: column !important;
}

.m2-testi-trust-val {
    font-weight: 800 !important;
    font-size: 17px !important;
    color: var(--m2-text-title) !important;
    line-height: 1.2 !important;
}

.m2-testi-trust-lbl {
    font-size: 12.5px !important;
    color: var(--m2-text-muted) !important;
    margin-top: 3px !important;
    line-height: 1.2 !important;
}

@media (max-width: 900px) {
    .m2-testi-trust-bar {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
}

@media (max-width: 560px) {
    .m2-testi-trust-bar {
        grid-template-columns: 1fr !important;
        padding: 16px !important;
    }
}

/* ========================================================
   2. FILTER TABS (All / Video / Written, no emojis or badges)
   ======================================================== */
.m2-testi-nav-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 14px !important;
    margin-bottom: 28px !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid var(--m2-border) !important;
    border-radius: var(--m2-radius) !important;
    padding: 12px 16px !important;
    box-shadow: 0 2px 8px rgba(1, 24, 40, 0.03) !important;
}

.m2-testi-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.m2-testi-tab {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 18px !important;
    background: #f8fafc !important;
    background-color: #f8fafc !important;
    border: 1px solid var(--m2-border) !important;
    border-radius: 20px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: #475569 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.m2-testi-tab:hover {
    color: var(--m2-blue) !important;
    background: var(--m2-blue-tint) !important;
    background-color: var(--m2-blue-tint) !important;
    border-color: #bae6fd !important;
}

.m2-testi-tab.is-active {
    background: var(--m2-blue) !important;
    background-color: var(--m2-blue) !important;
    color: #ffffff !important;
    border-color: var(--m2-blue) !important;
    box-shadow: 0 3px 10px rgba(0, 151, 206, 0.3) !important;
}

.m2-testi-badge {
    display: inline-block !important;
    padding: 2px 7px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    background: #e2e8f0 !important;
    background-color: #e2e8f0 !important;
    color: #334155 !important;
    line-height: 1 !important;
}

.m2-testi-tab.is-active .m2-testi-badge {
    background: rgba(255, 255, 255, 0.28) !important;
    background-color: rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
}

/* ========================================================
   3. CONSISTENT CARD ARCHITECTURE & STYLING
   All cards: Avatar, Name & Credentials, Practice Name, then Quote/Video.
   Consistent borders, shadow, radius, and equal height alignment.
   ======================================================== */
.m2-testi-card {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid var(--m2-border) !important;
    border-radius: var(--m2-radius) !important;
    box-shadow: var(--m2-shadow) !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    overflow: hidden !important;
    height: 100% !important;
    box-sizing: border-box !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease !important;
}

.m2-testi-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: var(--m2-shadow-hover) !important;
    border-color: var(--m2-border-hover) !important;
}

/* Remove any stuck blue outline: all card borders remain consistent */
.m2-testi-card.is-featured {
    border-color: var(--m2-border) !important;
    box-shadow: var(--m2-shadow) !important;
}

.m2-testi-card.is-featured:hover {
    border-color: var(--m2-border-hover) !important;
    box-shadow: var(--m2-shadow-hover) !important;
}

.m2-testi-card.m2-testi-hidden {
    display: none !important;
}

/* 3.1 CARD HEADER: Avatar, Name & Credentials, Practice Name */
.m2-testi-card-header {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 20px 22px 16px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #f8fafc !important;
}

.m2-testi-avatar-wrap {
    flex-shrink: 0 !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    background: var(--m2-blue-tint) !important;
    border: 2px solid #e0f2fe !important;
    box-shadow: 0 2px 6px rgba(1, 24, 40, 0.08) !important;
}

.m2-testi-avatar-img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    object-position: center 25% !important; /* Centers physician faces cleanly */
    display: block !important;
}

.m2-testi-author-info {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    flex-grow: 1 !important;
}

.m2-testi-author-name {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 14.5px !important;
    color: var(--m2-text-title) !important;
    line-height: 1.3 !important;
}

.m2-testi-author-name strong {
    font-weight: 700 !important;
    color: var(--m2-text-title) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.m2-testi-verified-icon {
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.m2-testi-author-title {
    font-size: 12px !important;
    color: var(--m2-text-muted) !important;
    line-height: 1.3 !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.m2-testi-author-clinic {
    font-size: 11.5px !important;
    color: #0369a1 !important;
    margin-top: 3px !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.m2-testi-author-clinic svg {
    flex-shrink: 0 !important;
}

/* 3.2 CARD BODY */
.m2-testi-card-body {
    padding: 16px 22px 20px !important;
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
}

/* ========================================================
   4. ROW 1: VIDEO TESTIMONIALS (Side by Side 16:9 Cards)
   ======================================================== */
.m2-testi-video-group {
    margin-bottom: 28px !important;
}

.m2-testi-video-row {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 24px !important;
    align-items: stretch !important;
}

.m2-testi-card.format-video .m2-testi-card-body {
    padding: 0 !important; /* Eliminates empty white space */
    display: flex !important;
    flex-direction: column !important;
}

.m2-testi-video-preview {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important; /* True 16:9 cinematic ratio */
    overflow: hidden !important;
    background: var(--m2-navy) !important;
    background-color: var(--m2-navy) !important;
    cursor: pointer !important;
}

.m2-testi-video-poster {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 25% !important; /* Crops thumbnail with faces centered */
    display: block !important;
    transition: transform 0.4s ease !important;
}

.m2-testi-card:hover .m2-testi-video-poster {
    transform: scale(1.04) !important;
}

.m2-testi-video-overlay {
    position: absolute !important;
    inset: 0 !important;
    background: linear-gradient(180deg, rgba(1, 24, 40, 0.15) 0%, rgba(1, 24, 40, 0.55) 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease !important;
}

.m2-testi-video-preview:hover .m2-testi-video-overlay {
    background: rgba(1, 24, 40, 0.3) !important;
    background-color: rgba(1, 24, 40, 0.3) !important;
}

.m2-testi-play-btn {
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: var(--m2-blue) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, background 0.2s !important;
}

.m2-testi-play-btn svg {
    margin-left: 3px !important;
    fill: currentColor !important;
}

.m2-testi-video-preview:hover .m2-testi-play-btn {
    transform: scale(1.1) !important;
    box-shadow: 0 0 0 10px rgba(0, 151, 206, 0.25) !important;
    background: var(--m2-blue) !important;
    background-color: var(--m2-blue) !important;
    color: #ffffff !important;
}

.m2-testi-duration-badge {
    position: absolute !important;
    bottom: 12px !important;
    right: 12px !important;
    background: rgba(1, 24, 40, 0.85) !important;
    background-color: rgba(1, 24, 40, 0.85) !important;
    backdrop-filter: blur(4px) !important;
    color: #ffffff !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    padding: 3px 9px !important;
    border-radius: 4px !important;
    letter-spacing: 0.3px !important;
}

/* One-line quote caption underneath thumbnail removing white space */
.m2-testi-video-caption {
    padding: 14px 20px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important; /* Semi-bold */
    font-style: normal !important; /* Non-italic */
    color: var(--m2-text-heading) !important;
    line-height: 1.45 !important;
    background: #fafbfc !important;
    border-top: 1px solid #f1f5f9 !important;
    margin: 0 !important;
    flex-grow: 1 !important;
    display: flex !important;
    align-items: center !important;
}

/* ========================================================
   5. BELOW: UNIFORM 3-COLUMN GRID OF WRITTEN TESTIMONIALS
   ======================================================== */
.m2-testi-written-group {
    margin-top: 0 !important;
}

.m2-testi-written-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
    align-items: stretch !important;
}

.m2-testi-top-meta {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    margin-bottom: 12px !important;
}

.m2-testi-stars {
    display: flex !important;
    gap: 3px !important;
    color: #0284c7 !important;
    font-size: 15px !important;
    line-height: 1 !important;
}

.m2-star.is-filled {
    color: #0284c7 !important;
}

.m2-star.is-empty {
    color: #cbd5e1 !important;
}

/* Single quote style: Semi-bold, non-italic */
.m2-testi-headline {
    margin: 0 0 14px !important;
    padding: 0 0 0 14px !important;
    border-left: 3px solid var(--m2-blue) !important;
    font-size: 14.5px !important;
    font-weight: 600 !important; /* Semi-bold */
    font-style: normal !important; /* Non-italic */
    color: var(--m2-text-title) !important;
    line-height: 1.48 !important;
    background: transparent !important;
}

/* Supporting detail paragraph: Darkened, higher contrast, slightly larger size */
.m2-testi-text {
    font-size: 14.5px !important; /* Increased size */
    color: var(--m2-text-body) !important; /* Darkened high-contrast slate #334155 */
    line-height: 1.65 !important;
    margin-bottom: 4px !important;
    flex-grow: 1 !important;
}

.m2-testi-text p {
    margin: 0 0 10px !important;
    font-size: 14.5px !important;
    color: var(--m2-text-body) !important; /* Darkened high-contrast slate #334155 */
    line-height: 1.65 !important;
}

.m2-testi-text p:last-child {
    margin-bottom: 0 !important;
}

/* ========================================================
   6. RESPONSIVE LAYOUT (Mobile Single Column Stack)
   ======================================================== */
@media (max-width: 1040px) {
    .m2-testi-written-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .m2-testi-video-row {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .m2-testi-written-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .m2-testi-card-header {
        padding: 16px 18px 14px !important;
    }

    .m2-testi-card-body {
        padding: 14px 18px 18px !important;
    }
}

/* ========================================================
   7. EMPTY & FILTER FALLBACK STATE
   ======================================================== */
.m2-testi-empty {
    text-align: center !important;
    padding: 60px 24px !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px dashed var(--m2-border) !important;
    border-radius: var(--m2-radius) !important;
    margin: 20px 0 !important;
}

.m2-testi-empty-icon {
    font-size: 40px !important;
    margin-bottom: 12px !important;
}

.m2-testi-empty h3 {
    font-size: 18px !important;
    color: var(--m2-text-title) !important;
    margin: 0 0 8px !important;
}

.m2-testi-empty p {
    font-size: 14px !important;
    color: var(--m2-text-muted) !important;
    margin: 0 0 16px !important;
}

.m2-testi-reset-btn {
    padding: 9px 22px !important;
    background: var(--m2-blue) !important;
    background-color: var(--m2-blue) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 20px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
}

.m2-testi-reset-btn:hover {
    background: var(--m2-blue-dark) !important;
    background-color: var(--m2-blue-dark) !important;
    color: #ffffff !important;
}

/* ========================================================
   8. INTERACTIVE VIDEO MODAL DIALOG
   ======================================================== */
.m2-testi-modal-backdrop {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(1, 24, 40, 0.88) !important;
    background-color: rgba(1, 24, 40, 0.88) !important;
    backdrop-filter: blur(6px) !important;
    z-index: 999999 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    opacity: 0 !important;
    transition: opacity 0.25s ease !important;
}

.m2-testi-modal-backdrop.is-open {
    display: flex !important;
    opacity: 1 !important;
}

.m2-testi-modal-dialog {
    background: #0f172a !important;
    background-color: #0f172a !important;
    border-radius: 16px !important;
    width: 100% !important;
    max-width: 860px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5) !important;
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    transform: scale(0.95) !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.m2-testi-modal-backdrop.is-open .m2-testi-modal-dialog {
    transform: scale(1) !important;
}

.m2-testi-modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 22px !important;
    background: #011828 !important;
    background-color: #011828 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.m2-testi-modal-tag {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #38bdf8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: block !important;
    margin-bottom: 2px !important;
}

.m2-testi-modal-title {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
}

.m2-testi-modal-close {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    font-size: 28px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    transition: color 0.2s, background 0.2s !important;
}

.m2-testi-modal-close:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.12) !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
}

.m2-testi-modal-body {
    padding: 0 !important;
    background: #000000 !important;
    background-color: #000000 !important;
}

.m2-testi-video-frame-container {
    position: relative !important;
    width: 100% !important;
    padding-bottom: 56.25% !important;
    height: 0 !important;
}

.m2-testi-video-frame-container iframe,
.m2-testi-video-frame-container video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}
