/**
 * Custom testimonial layout styles.
 */

.glowrev-testimonials-custom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.glowrev-testimonial-custom-card {
    height: 100%;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.glowrev-testimonial-custom-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.glowrev-layout-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}

.glowrev-layout-section--identity {
    align-items: flex-start;
}

.glowrev-layout-section--content {
    align-items: flex-start;
}

.glowrev-layout-section--rating {
    gap: 6px;
}

.glowrev-layout-section--meta {
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid #e2e8f0;
}

.glowrev-layout-field {
    margin: 0;
}

.glowrev-layout-field--photo {
    margin-right: 4px;
}

.glowrev-layout-avatar {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    object-fit: cover;
    display: block;
}

.glowrev-layout-field--name {
    flex: 1 1 180px;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.2;
    color: #0f172a;
}

.glowrev-layout-field--company,
.glowrev-layout-field--designation,
.glowrev-layout-field--position,
.glowrev-layout-field--date {
    font-size: 0.95rem;
    color: #64748b;
}

.glowrev-layout-field--quote {
    font-family: dashicons;
    font-size: 2.5rem;
    line-height: 1;
    color: #14532d;
    display: inline-block;
}

.glowrev-layout-preview-canvas .glowrev-layout-field--quote,
.glowrev-layout-preview-canvas .glowrev-testimonial-quote,
.glowrev-layout-preview-canvas .glowrev-preset-quote-mark {
    font-size: 1.8rem;
    line-height: 1;
}

.glowrev-testimonial-quote {
    font-family: dashicons;
    font-size: 2.5rem;
    line-height: 1;
    color: #14532d;
    display: inline-block;
    margin-bottom: 4px;
}

.glowrev-layout-field--text {
    width: 100%;
}

.glowrev-layout-field--text .glowrev-testimonial-text {
    color: #334155;
    font-size: 1rem;
    line-height: 1.7;
}

.glowrev-layout-field--rating {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.glowrev-layout-field--rating .rating-star {
    width: 18px;
    height: 18px;
    display: inline-block;
    background: currentColor;
    color: #f59e0b;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    opacity: 0.25;
}

.glowrev-layout-field--rating .rating-star.filled {
    opacity: 1;
}

.glowrev-layout-field--rating .rating-star.empty {
    color: #cbd5e1;
    opacity: 0.7;
}

@media (max-width: 767px) {
    .glowrev-testimonials-custom {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .glowrev-testimonial-custom-card {
        padding: 18px;
    }

    .glowrev-layout-avatar {
        width: 56px;
        height: 56px;
    }

    .glowrev-layout-field--name {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .glowrev-testimonial-custom-card {
        padding: 16px;
    }
    
    .glowrev-testimonial-custom-sections {
        gap: 12px;
    }
    
    .glowrev-layout-section {
        gap: 8px 10px;
    }
}

/* Read More/Less functionality */
.glowrev-read-more-toggle {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #4f46e5;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

.glowrev-read-more-toggle:hover {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.glowrev-read-more-toggle.expanded {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.glowrev-read-more-text,
.glowrev-read-less-text {
    font-size: 14px;
    font-weight: 500;
}

/* Read Less text is hidden by default via the `hidden` attribute (set in HTML) */
/* JS toggles the hidden attribute — no CSS display overrides needed here */

.glowrev-testimonial-text {
    line-height: 1.5;
}

/* Preview/full span visibility is controlled via the `hidden` HTML attribute */
/* When hidden attribute is absent, spans display inline naturally */
.glowrev-testimonial-preview[hidden],
.glowrev-testimonial-full[hidden] {
    display: none !important;
}

.glowrev-read-more-toggle {
    margin-top: 6px;
}

.glowrev-read-more-toggle[aria-expanded="true"] {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

/* Debug styles removed - no highlighting needed */

/* Display Type Variations for Custom Layout */

/* Grid (default) */
.glowrev-testimonials-custom.glowrev-grid {
    display: grid;
    grid-template-columns: repeat(var(--glowrev-custom-cols, 3), minmax(0, 1fr));
    gap: 24px;
}

/* Masonry - mimics masonry behavior with CSS columns */
.glowrev-testimonials-custom.glowrev-masonry {
    display: block;
    column-count: var(--glowrev-custom-cols, 3);
    column-gap: 24px;
}

.glowrev-testimonials-custom.glowrev-masonry .glowrev-testimonial-custom-card {
    break-inside: avoid;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .glowrev-testimonials-custom.glowrev-masonry {
        column-count: 2;
    }
}

@media (max-width: 767px) {
    .glowrev-testimonials-custom.glowrev-masonry {
        column-count: 1;
    }
}

/* List - single column */
.glowrev-testimonials-custom.glowrev-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

/* Slider - horizontal scroll */
.glowrev-testimonials-custom.glowrev-slider {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

.glowrev-testimonials-custom.glowrev-slider .glowrev-testimonial-custom-card {
    flex: 0 0 350px;
    scroll-snap-align: start;
}

@media (max-width: 767px) {
    .glowrev-testimonials-custom.glowrev-slider .glowrev-testimonial-custom-card {
        flex: 0 0 300px;
    }
}

/* Stacked - overlapping cards effect */
.glowrev-testimonials-custom.glowrev-stacked {
    display: flex;
    flex-direction: column;
    gap: -20px;
    max-width: 700px;
    margin: 0 auto;
}

.glowrev-testimonials-custom.glowrev-stacked .glowrev-testimonial-custom-card {
    margin-bottom: -30px;
    position: relative;
    z-index: 1;
}

.glowrev-testimonials-custom.glowrev-stacked .glowrev-testimonial-custom-card:hover {
    z-index: 10;
    transform: translateY(-10px);
}

/* Timeline - vertical timeline layout */
.glowrev-testimonials-custom.glowrev-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.glowrev-testimonials-custom.glowrev-timeline::before {
    content: '';
    position: absolute;
    left: 40px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #667eea, #764ba2);
}

.glowrev-testimonials-custom.glowrev-timeline .glowrev-testimonial-custom-card {
    margin-left: 80px;
    margin-bottom: 30px;
    position: relative;
}

.glowrev-testimonials-custom.glowrev-timeline .glowrev-testimonial-custom-card::before {
    content: '';
    position: absolute;
    left: -50px;
    top: 30px;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Preset Layout Card Styles with Customization Support */
.glowrev-testimonial-card {
    background: var(--glowrev-bg-color, #ffffff);
    border: var(--glowrev-border-width, 1px) solid var(--glowrev-border-color, #e2e8f0);
    border-radius: var(--glowrev-border-radius, 18px);
    padding: var(--glowrev-padding, 24px);
    box-shadow: var(--glowrev-shadow, 0 14px 32px rgba(15, 23, 42, 0.08));
    color: var(--glowrev-text-color, #0f172a);
    font-family: var(--glowrev-font-family, inherit);
    font-size: var(--glowrev-font-size, inherit);
    height: 100%;
}

/* Apply custom colors to text elements */
.glowrev-testimonial-card .glowrev-preset-name,
.glowrev-testimonial-card .glowrev-preset-content {
    color: var(--glowrev-text-color, inherit);
}

/* Apply custom styles to avatars */
.glowrev-testimonial-card .glowrev-preset-avatar img,
.glowrev-testimonial-card .glowrev-preset-avatar-img,
.glowrev-testimonial-card .glowrev-svg-avatar {
    width: var(--glowrev-avatar-size, 50px);
    height: var(--glowrev-avatar-size, 50px);
    border-radius: 50% !important;
    object-fit: cover;
}

/* Apply custom quote styling */
.glowrev-testimonial-card .glowrev-preset-quote-mark,
.glowrev-testimonial-card::before {
    color: var(--glowrev-quote-color, #14532d);
    font-size: 4.75rem;
    line-height: 0.8;
    font-weight: 700;
}

/* Apply custom rating color */
.glowrev-testimonial-card .glowrev-preset-rating .rating-star.filled,
.glowrev-testimonial-card .glowrev_testimonial-rating .rating-star.filled {
    color: var(--glowrev-rating-color, #ffc107);
}

/* Preset: Full */
.glowrev-preset-full {
    width: 350px !important;
    max-width: 400px !important;
}

article.glowrev-testimonial-card.glowrev-preset-full {
    background: white !important;
    padding: 20px !important;
}

/* Override grid stretching for preset-full cards */
.glowrev-testimonials-grid .glowrev-preset-full,
.glowrev-testimonials-custom .glowrev-preset-full,
.glowrev-masonry-grid .glowrev-preset-full {
    width: 350px !important;
    max-width: 350px !important;
    justify-self: start;
}

/* Prevent width changes when expanded */
.glowrev-preset-full.glowrev-content-expanded,
.glowrev-testimonials-grid .glowrev-preset-full.glowrev-content-expanded,
.glowrev-testimonials-custom .glowrev-preset-full.glowrev-content-expanded,
.glowrev-masonry-grid .glowrev-preset-full.glowrev-content-expanded {
    width: 350px !important;
    max-width: 350px !important;
    min-width: 350px !important;
    justify-self: start;
}

/* Ultra-specific rule to override ALL width styles */
article.glowrev-testimonial-card.glowrev-preset-full,
.glowrev-testimonials-grid article.glowrev-testimonial-card.glowrev-preset-full,
.glowrev-testimonials-custom article.glowrev-testimonial-card.glowrev-preset-full,
.glowrev-masonry-grid article.glowrev-testimonial-card.glowrev-preset-full,
article.glowrev-testimonial-card.glowrev-preset-full.glowrev-content-expanded,
.glowrev-testimonials-grid article.glowrev-testimonial-card.glowrev-preset-full.glowrev-content-expanded,
.glowrev-testimonials-custom article.glowrev-testimonial-card.glowrev-preset-full.glowrev-content-expanded,
.glowrev-masonry-grid article.glowrev-testimonial-card.glowrev-preset-full.glowrev-content-expanded {
    width: 360px !important;
    max-width: 360px !important;
    min-width: 360px !important;
    flex: 0 0 360px !important;
    flex-basis: 360px !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    justify-self: start;
    background-color: white;
    padding: 20px;
}

.glowrev-preset-full .glowrev-preset-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

.glowrev-preset-full .glowrev-preset-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.glowrev-preset-full .glowrev-preset-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #0f172a;
}

.glowrev-preset-full .glowrev-preset-company,
.glowrev-preset-full .glowrev-preset-designation,
.glowrev-preset-full .glowrev-preset-position {
    font-size: 0.875rem;
    color: #64748b;
    display: block;
    margin: 2px 0;
}

.glowrev-preset-full .glowrev-preset-content {
    margin-bottom: 16px;
    line-height: 1.7;
    color: #334155;
}

.glowrev-preset-full .glowrev-preset-meta {
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    font-size: 0.875rem;
    color: #94a3b8;
}

/* Preset: Basic */
.glowrev-preset-basic .glowrev-preset-header--compact {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.glowrev-preset-basic .glowrev-preset-avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.glowrev-preset-basic .glowrev-preset-name {
    font-weight: 600;
    color: #0f172a;
}

/* Preset: Minimal */
.glowrev-preset-minimal .glowrev-preset-content--minimal {
    font-size: 1.125rem;
    line-height: 1.7;
    color: #334155;
    margin-bottom: 16px;
}

.glowrev-preset-minimal .glowrev-preset-footer--minimal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
}

.glowrev-preset-minimal .glowrev-preset-name {
    font-weight: 600;
    color: #0f172a;
}

/* Preset: Professional */
.glowrev-preset-professional .glowrev-preset-header--professional {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.glowrev-preset-professional .glowrev-preset-avatar-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
}

.glowrev-preset-professional .glowrev-preset-name {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #0f172a;
}

.glowrev-preset-professional .glowrev-preset-role {
    font-size: 0.875rem;
    color: #64748b;
    display: block;
}

.glowrev-preset-professional .glowrev-preset-company {
    font-size: 0.875rem;
    color: #6366f1;
    font-weight: 500;
}

/* Preset: Story */
.glowrev-preset-story .glowrev-preset-quote-mark {
    font-size: 4.75rem;
    line-height: 1;
    color: var(--glowrev-quote-color, #14532d);
    margin-bottom: -20px;
}

.glowrev-preset-story .glowrev-preset-content--story {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #334155;
    margin-bottom: 20px;
}

.glowrev-preset-story .glowrev-preset-footer--story {
    display: flex;
    align-items: center;
    gap: 12px;
}

.glowrev-preset-story .glowrev-preset-avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

/* Preset: Trust */
.glowrev-preset-trust .glowrev-preset-header--trust {
    text-align: center;
    margin-bottom: 20px;
}

.glowrev-preset-trust .glowrev-preset-avatar-large img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 12px;
    display: block;
}

.glowrev-preset-trust .glowrev-preset-identity--centered {
    text-align: center;
}

.glowrev-preset-trust .glowrev-preset-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.glowrev-preset-trust .glowrev-preset-content--centered {
    text-align: center;
}

/* Star Rating Base */
.rating-star {
    display: inline-block;
    background: currentColor;
    color: #f59e0b;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    opacity: 0.25;
}

.rating-star.filled {
    opacity: 1;
}

/* Responsive Adjustments */
@media (max-width: 767px) {
    .glowrev-testimonial-card {
        padding: 18px;
    }
    
    .glowrev-preset-full .glowrev-preset-header {
        grid-template-columns: auto 1fr;
    }
    
    .glowrev-preset-full .glowrev-preset-rating {
        grid-column: 1 / -1;
        justify-self: start;
    }
}
