/* ============================================================
   Wiselogix — Testimonials Widget
   tm-widget.css  v1.0
   ============================================================ */

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
    --tm-accent:         #3b82f6;
    --tm-card-bg:        #ffffff;
    --tm-card-radius:    14px;
    --tm-shadow:         0 2px 18px rgba(0, 0, 0, .07);
    --tm-shadow-hover:   0 10px 36px rgba(0, 0, 0, .13);
    --tm-ease:           0.28s ease;
    --tm-name-color:     #0f172a;
    --tm-desg-color:     #64748b;
    --tm-text-color:     #475569;
    --tm-title-color:    #1e293b;
    --tm-star-filled:    #f59e0b;
    --tm-star-empty:     #d1d5db;
}

/* ── Wrap ────────────────────────────────────────────────────────────────── */
.tm-wrap {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* ── Card (shared) ───────────────────────────────────────────────────────── */
.tm-card {
    background: var(--tm-card-bg);
    border-radius: var(--tm-card-radius);
    box-shadow: var(--tm-shadow);
    padding: 28px 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--tm-ease), transform var(--tm-ease);
    text-align: left;
    position: relative;
    overflow: hidden;
}
.tm-card:hover {
    box-shadow: var(--tm-shadow-hover);
    transform: translateY(-3px);
}

/* ── Quote Icon ─────────────────────────────────────────────────────────── */
.tm-quote-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--tm-accent);
    font-size: 54px;
    line-height: 1;
    opacity: 0.12;
    transition: color var(--tm-ease), transform var(--tm-ease), opacity var(--tm-ease);
    pointer-events: none;
    user-select: none;
    z-index: 0;
}
.tm-card:hover .tm-quote-icon {
    opacity: 0.22;
    transform: scale(1.08) rotate(-4deg);
}
.tm-quote-icon i {
    font-size: inherit;
    line-height: 1;
    color: inherit;
}
.tm-quote-icon svg {
    width: 1em !important;
    height: 1em !important;
    max-width: 100% !important;
    max-height: 100% !important;
    fill: currentColor;
    display: block;
}
.tm-quote-pos-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 0;
}
.tm-quote-pos-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 0;
}
.tm-quote-pos-bottom-right {
    position: absolute;
    bottom: 16px;
    right: 20px;
    z-index: 0;
}
.tm-quote-pos-inline-top {
    position: static;
    margin-bottom: 12px;
    display: inline-flex;
    align-self: flex-start;
    opacity: 0.35;
    font-size: 32px;
    z-index: 1;
}

/* ── Card Content Layers (above watermark quote) ────────────────────────── */
.tm-avatar,
.tm-person-name,
.tm-designation,
.tm-stars,
.tm-rating-image,
.tm-review-title,
.tm-review-text {
    position: relative;
    z-index: 1;
}

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.tm-avatar {
    margin-bottom: 14px;
    display: flex;
}
.tm-avatar img {
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* ── Person Name ─────────────────────────────────────────────────────────── */
.tm-person-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--tm-name-color);
    margin: 0 0 4px;
    line-height: 1.3;
}

/* ── Designation ─────────────────────────────────────────────────────────── */
.tm-designation {
    font-size: .82rem;
    color: var(--tm-desg-color);
    margin: 0 0 12px;
    line-height: 1.4;
}

/* ── Star Rating ─────────────────────────────────────────────────────────── */
.tm-stars {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.tm-star {
    font-size: 18px;
    line-height: 1;
    display: inline-block;
}
.tm-star-filled { color: var(--tm-star-filled); }
.tm-star-empty  { color: var(--tm-star-empty);  }

/* ── Rating Image ────────────────────────────────────────────────────────── */
.tm-rating-image {
    margin-bottom: 12px;
}
.tm-rating-image img {
    display: block;
    width: 100px;
    height: auto;
}

/* ── Review Title ────────────────────────────────────────────────────────── */
.tm-review-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--tm-title-color);
    margin: 0 0 8px;
    line-height: 1.4;
}

/* ── Review Text ─────────────────────────────────────────────────────────── */
.tm-review-text {
    font-size: .88rem;
    line-height: 1.7;
    color: var(--tm-text-color);
    margin: 0;
    flex: 1;
}
.tm-review-text p {
    margin: 0 0 12px;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}
.tm-review-text p:last-child {
    margin-bottom: 0;
}
.tm-review-text a {
    color: var(--tm-accent);
    text-decoration: underline;
}
.tm-review-text a:hover {
    opacity: 0.85;
}
.tm-review-text strong,
.tm-review-text b {
    font-weight: 700;
}
.tm-review-text ul,
.tm-review-text ol {
    margin: 8px 0 12px 20px;
    padding: 0;
}
.tm-review-text li {
    margin-bottom: 4px;
}

/* ── No Results ──────────────────────────────────────────────────────────── */
.tm-no-results {
    color: var(--tm-desg-color);
    font-style: italic;
}

/* ── GRID LAYOUT ─────────────────────────────────────────────────────────── */
.tm-mode-grid .tm-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
}

/* ── MASONRY LAYOUT (CSS columns) ────────────────────────────────────────── */
.tm-has-masonry .tm-masonry {
    column-count: 3;
    column-gap: 24px;
    width: 100%;
    box-sizing: border-box;
}
.tm-masonry-item {
    break-inside: avoid;
    page-break-inside: avoid;       /* Firefox fallback */
    -webkit-column-break-inside: avoid;
    margin-bottom: 24px;
    display: block;
}
/* Prevents card hover transform from clipping in column layout */
.tm-has-masonry .tm-card {
    overflow: visible;
}

/* ── LIST LAYOUT ─────────────────────────────────────────────────────────── */
.tm-mode-list .tm-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}
.tm-list-item {
    width: 100%;
}

/* ── SLIDER LAYOUT ───────────────────────────────────────────────────────── */
.tm-mode-slider {
    overflow: visible;
}
.tm-mode-slider .tm-swiper {
    width: 100%;
    overflow: hidden;
}
.tm-mode-slider .swiper-slide {
    height: auto !important;
    display: flex;
}
.tm-mode-slider .tm-card {
    height: 100%;
    width: 100%;
    margin: 0;
}

/* ── Swiper custom arrows ────────────────────────────────────────────────── */
.tm-swiper-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #fff;
    color: #1e293b;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
    cursor: pointer;
    transition: background var(--tm-ease), color var(--tm-ease), transform .2s;
    line-height: 1;
}
.tm-swiper-btn:hover {
    background: var(--tm-accent);
    color: #fff;
    transform: translateY(-50%) scale(1.08);
}
.tm-swiper-prev { left: -22px; }
.tm-swiper-next { right: -22px; }
@media (max-width: 480px) {
    .tm-swiper-prev { left: 4px; }
    .tm-swiper-next { right: 4px; }
}

/* ── Swiper pagination dots ──────────────────────────────────────────────── */
.tm-wrap .swiper-pagination {
    position: relative;
    bottom: auto;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 6px;
}
.tm-wrap .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    opacity: 1;
    transition: background var(--tm-ease), transform var(--tm-ease);
    cursor: pointer;
}
.tm-wrap .swiper-pagination-bullet-active {
    background: var(--tm-accent);
    transform: scale(1.35);
}

/* ── Card entrance animation ─────────────────────────────────────────────── */
.tm-grid .tm-card,
.tm-masonry-item .tm-card,
.tm-list .tm-list-item {
    opacity: 0;
    transform: translateY(14px);
    animation: tmFadeUp 0.4s ease forwards;
}
@keyframes tmFadeUp { to { opacity: 1; transform: translateY(0); } }

.tm-grid .tm-card:nth-child(1),  .tm-masonry-item:nth-child(1) .tm-card { animation-delay: .05s; }
.tm-grid .tm-card:nth-child(2),  .tm-masonry-item:nth-child(2) .tm-card { animation-delay: .10s; }
.tm-grid .tm-card:nth-child(3),  .tm-masonry-item:nth-child(3) .tm-card { animation-delay: .15s; }
.tm-grid .tm-card:nth-child(4),  .tm-masonry-item:nth-child(4) .tm-card { animation-delay: .20s; }
.tm-grid .tm-card:nth-child(5),  .tm-masonry-item:nth-child(5) .tm-card { animation-delay: .25s; }
.tm-grid .tm-card:nth-child(6),  .tm-masonry-item:nth-child(6) .tm-card { animation-delay: .30s; }

.tm-list .tm-list-item:nth-child(1) { animation-delay: .05s; }
.tm-list .tm-list-item:nth-child(2) { animation-delay: .10s; }
.tm-list .tm-list-item:nth-child(3) { animation-delay: .15s; }

/* Slider cards skip entrance animation — Swiper controls visibility */
.tm-mode-slider .tm-card { opacity: 1; transform: none; animation: none; }

/* ── Elementor container compatibility ───────────────────────────────────── */
.elementor-widget-tm_testimonials,
.elementor-widget-tm_testimonials > .elementor-widget-container {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
    align-self: stretch !important;
    box-sizing: border-box !important;
}
.elementor-widget-tm_testimonials .tm-grid {
    display: grid !important;
    width: 100% !important;
}

/* ── Responsive grid fallbacks ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .tm-mode-grid .tm-grid   { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .tm-has-masonry .tm-masonry { column-count: 2; }
}
@media (max-width: 767px) {
    .tm-mode-grid .tm-grid   { grid-template-columns: repeat(1, minmax(0,1fr)); }
    .tm-has-masonry .tm-masonry { column-count: 1; }
}
