/**
 * Grid layout specific styles
 */

/* Grid container - Override common styles */
.glowrev-testimonials {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.glowrev-testimonials-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(var(--glowrev-grid-cols, 3), 1fr);
    padding: 2rem 0;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Grid column variations */
.glowrev-grid-1-cols { --glowrev-grid-cols: 1; }
.glowrev-grid-2-cols { --glowrev-grid-cols: 2; }
.glowrev-grid-3-cols { --glowrev-grid-cols: 3; }
.glowrev-grid-4-cols { --glowrev-grid-cols: 4; }

/* Grid item styling */
.glowrev-testimonial-item,
.glowrev-testimonials-grid .glowrev-testimonial-card {
    background: #ffffff !important;
    padding: 20px !important;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Custom layouts in grid - inherit default grid design and effects */
.glowrev-testimonials-grid .glowrev-testimonials-custom .glowrev-testimonial-card {
    background: #ffffff !important;
    padding: 20px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    position: relative !important;
    overflow: hidden !important;
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
}

/* Custom layouts in grid - inherit quote mark */
.glowrev-testimonials-grid .glowrev-testimonials-custom .glowrev-testimonial-card:before {
    content: '\201C' !important;
    position: absolute !important;
    top: 1.5rem !important;
    left: 1.5rem !important;
    font-size: 8rem !important;
    line-height: 1 !important;
    color: #ffc107 !important;
    font-family: Georgia, serif !important;
    z-index: 1 !important;
    opacity: 1 !important;
}

.glowrev-testimonial-item:before,
.glowrev-testimonials-grid .glowrev-testimonial-card:before {
    content: '\201C';
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    font-size: 8rem;
    line-height: 1;
    color: #ffc107;
    font-family: Georgia, serif;
    z-index: 1;
    opacity: 1;
}

/* Add quote symbol before text in grid layout */
.glowrev-testimonials-grid .glowrev-testimonial-text:before {
    content: '\201C';
    font-size: 2rem;
    color: #ffc107;
    font-family: Georgia, serif;
    margin-right: 0.5rem;
    opacity: 0.7;
    line-height: 1;
}

.glowrev-testimonial-item:hover,
.glowrev-testimonials-grid .glowrev-testimonial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.08);
}

/* Grid item content */
.glowrev-testimonial-content {
    position: relative;
    padding: 0.25rem 0;
    line-height: 1.7;
    font-size: 1rem;
    color: #4a5568;
    text-align: center;
    z-index: 2;
    flex-grow: 1;
    margin: 5px 0;
}

.glowrev-testimonials-grid .glowrev-testimonial-text {
    text-align: -webkit-left;
}

/* Grid header and meta styles */
.glowrev-testimonial-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 0.625rem;
    position: relative;
    z-index: 2;
}

/* Remove default h4 margins from testimonial name in grid layout */
.glowrev-testimonials-grid .glowrev-testimonial-name {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.glowrev-testimonials-grid .glowrev-testimonial-avatar,
.glowrev-testimonials-grid .glowrev-preset-avatar img,
.glowrev-testimonials-grid .glowrev-preset-avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 50% !important;
    object-fit: cover;
    margin-bottom: 1.25rem;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.glowrev-testimonials-grid .glowrev-default-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f6f9fc 0%, #f0f4f8 100%);
    margin-bottom: 1.25rem;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 2.5rem;
    color: #4a5568;
    font-weight: 600;
}

.glowrev-testimonials-grid .glowrev-testimonial-meta {
    text-align: center;
    margin-top: 0.5rem;
}

.glowrev-testimonials-grid .glowrev-testimonial-author {
    font-size: 1.3rem;
    color: #2d3748;
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.glowrev-testimonials-grid .glowrev-testimonial-company {
    display: block;
    font-size: 0.95rem;
    color: #4a5568;
    font-weight: 500;
    text-align: center;
    margin: 5px 0;
}

/* Center rating in grid layout */
.glowrev-testimonials-grid .glowrev-testimonial-rating {
    text-align: center;
    margin: 0.25rem 0;
    font-size: 2.2rem;
    letter-spacing: 3px;
}

/* Read more link */
.glowrev-read-more,
.glowrev-read-more.read-less {
    display: inline-block;
    margin-top: 1rem;
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color 0.3s ease;
}

.glowrev-read-more:hover,
.glowrev-read-more.read-less:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .glowrev-grid-4-cols { --glowrev-grid-cols: 3; }
}

@media (max-width: 992px) {
    .glowrev-grid-3-cols,
    .glowrev-grid-4-cols { 
        --glowrev-grid-cols: 2;
    }
    
    .glowrev-testimonials-grid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 768px) {
    .glowrev-testimonials-grid {
        grid-template-columns: 1fr;
        padding: 1.5rem 1rem !important;
        margin: 0 !important;
    }
    
    .glowrev-testimonial-item,
    .glowrev-testimonials-grid .glowrev-testimonial-card {
        margin-bottom: 1.5rem;
    }
    
    .glowrev-testimonials-grid .glowrev-testimonial-author {
        margin-top: 10px !important;
        margin-bottom: 5px !important;
    }
}

@media (max-width: 480px) {
    .glowrev-testimonials-grid {
        padding: 1rem 0.5rem !important;
    }
    
    .glowrev-testimonial-item,
    .glowrev-testimonials-grid .glowrev-testimonial-card {
        margin-bottom: 1rem;
        padding: 1rem;
    }
    
    .glowrev-testimonials-grid .glowrev-testimonial-rating {
        text-align: center;
        margin: 0.5rem 0;
        font-size: 1.6rem;
        letter-spacing: 1px;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 10 !important;
        width: 100%;
        overflow: visible;
        white-space: nowrap;
    }
}

/* Entrance Animation for Grid Items */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glowrev-testimonial-item,
.glowrev-testimonials-grid .glowrev-testimonial-card {
    animation: fadeInUp 0.6s ease-out forwards;
}

.glowrev-testimonials-grid .glowrev-testimonial-item:nth-child(1),
.glowrev-testimonials-grid .glowrev-testimonial-card:nth-child(1) { animation-delay: 0s; }
.glowrev-testimonials-grid .glowrev-testimonial-item:nth-child(2),
.glowrev-testimonials-grid .glowrev-testimonial-card:nth-child(2) { animation-delay: 0.1s; }
.glowrev-testimonials-grid .glowrev-testimonial-item:nth-child(3),
.glowrev-testimonials-grid .glowrev-testimonial-card:nth-child(3) { animation-delay: 0.2s; }
.glowrev-testimonials-grid .glowrev-testimonial-item:nth-child(4),
.glowrev-testimonials-grid .glowrev-testimonial-card:nth-child(4) { animation-delay: 0.3s; }
.glowrev-testimonials-grid .glowrev-testimonial-item:nth-child(5),
.glowrev-testimonials-grid .glowrev-testimonial-card:nth-child(5) { animation-delay: 0.4s; }
.glowrev-testimonials-grid .glowrev-testimonial-item:nth-child(6),
.glowrev-testimonials-grid .glowrev-testimonial-card:nth-child(6) { animation-delay: 0.5s; }

/* Hover Glow Effect */
.glowrev-testimonial-item:hover,
.glowrev-testimonials-grid .glowrev-testimonial-card:hover {
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(99, 102, 241, 0.1);
}

/* Avatar Pulse on Hover */
.glowrev-testimonials-grid .glowrev-testimonial-item:hover .glowrev-testimonial-avatar,
.glowrev-testimonials-grid .glowrev-testimonial-card:hover .glowrev-preset-avatar img {
    animation: avatarPulse 0.6s ease-in-out;
}

@keyframes avatarPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Shine Effect on Hover */
.glowrev-testimonial-item::after,
.glowrev-testimonials-grid .glowrev-testimonial-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    transform: translateX(-100%) rotate(45deg);
    transition: transform 0.6s;
    pointer-events: none;
}

.glowrev-testimonial-item:hover::after,
.glowrev-testimonials-grid .glowrev-testimonial-card:hover::after {
    transform: translateX(100%) rotate(45deg);
}

/* Preset: Full - Fixed Width */
article.glowrev-testimonial-card.glowrev-preset-full,
.glowrev-testimonials-grid article.glowrev-testimonial-card.glowrev-preset-full {
    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;
}

/* Prevent width changes when expanded */
article.glowrev-testimonial-card.glowrev-preset-full.glowrev-content-expanded,
.glowrev-testimonials-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;
}
