/* Custom Testimonials Styles */
.ct-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, 300px);
    gap: 1.5rem;
}

/* --- ADDED: This centers the grid items --- */
.ct-container--centered {
    justify-content: center;
}

.ct-card {
    background-color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}
.ct-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}
.ct-card-thumbnail {
    position: relative;
}
.ct-card-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.ct-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: background-color 0.2s;
}
.ct-card:hover .ct-play-icon {
    background-color: rgba(255, 255, 255, 1);
}
.ct-play-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #333;
    margin-left: 5px;
}
.ct-card-content {
    padding: 1.25rem;
    flex-grow: 1;
}
.ct-card-stars {
    color: #ddd;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}
.ct-card-stars .star.filled {
    color: #f5b327;
}
.ct-card-title {
    margin-top: 0;
    margin-bottom: 0.25rem;
    font-size: 1.25rem;
}
.ct-card-byline {
    font-style: italic;
    color: #6A7585;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.ct-card-excerpt {
    color: #4A5568;
    font-size: 0.9rem;
    line-height: 1.6;
}
.ct-card-read-more {
    margin-top: 1rem;
}
.ct-card-read-more a {
    font-weight: 600;
    color: #a987c2;
    text-decoration: none;
}
.ct-card-read-more a:hover {
    text-decoration: underline;
}

/* Modal Styles */
body.ct-modal-open {
    overflow: hidden;
}
.ct-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999 !important;
}
.ct-modal-overlay.active {
    display: flex;
}
.ct-modal-content {
    position: relative;
    width: 90%;
    max-width: 700px;
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    max-height: 80vh;
    overflow-y: auto;
}
.ct-modal-close {
    position: absolute;
    top: 10px;
    right: 20px;
    background: transparent;
    border: none;
    color: #333;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}
#ct-video-modal-overlay .ct-modal-content {
    padding: 0;
    overflow: visible;
}
#ct-video-modal-overlay .ct-modal-close {
    color: white;
    top: -35px;
}
.ct-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}
.ct-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
#ct-text-modal-body .ct-modal-image {
    float: left;
    width: 35%;
    margin: 0 1.5rem 1rem 0;
    border-radius: 0.75rem;
    overflow: hidden;
}
#ct-text-modal-body .ct-modal-image img {
    width: 100%;
    height: auto;
    display: block;
}
#ct-text-modal-body .ct-modal-text p {
    line-height: 1.7;
    color: #333;
    margin-bottom: 1rem;
}
#ct-text-modal-body .ct-modal-byline {
    clear: both;
    text-align: right;
    margin-top: 2rem;
    font-size: 1.1rem;
    color: #4A5568;
}
#ct-text-modal-body .ct-modal-byline p {
    margin: 0;
}

/* Star Rating Input */
.ct-star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}
.ct-star-rating input[type="radio"] {
    display: none;
}
.ct-star-rating label {
    font-size: 2rem;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0 0.1em;
}
.ct-star-rating label::before {
    content: '\2605';
}
.ct-star-rating input[type="radio"]:checked ~ label,
.ct-star-rating label:hover,
.ct-star-rating label:hover ~ label {
    color: #f5b327;
}

/* Frontend Submission Form Styles */
#ct-submission-form {
    margin: 2rem auto;
    padding: 2rem;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 1rem;
}
.ct-form-row {
    margin-bottom: 1.5rem;
}
#ct-submission-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
#ct-submission-form input[type="text"],
#ct-submission-form input[type="url"],
#ct-submission-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    font-size: 1rem;
}
#ct-submission-form button {
    background-color: #a987c2;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}
#ct-submission-form button:hover {
    background-color: #936eb1;
}
.ct-success-message {
    color: #2E7D32;
    background: #E8F5E9;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #A5D6A7;
}
.ct-error-message {
    color: #C62828;
    background: #FFEBEE;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #EF9A9A;
}

/* --- ADDED: Full-Width Layout Styles --- */
.ct-container-full {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}
.ct-full-item {
    padding: 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    position: relative;
}
.ct-full-item[data-video-url] {
    cursor: pointer;
}
/* Make the .ct-full-item .ct-play-icon visible */
.ct-full-item .ct-play-icon {
    display: none;
}
.ct-full-item[data-video-url] .ct-play-icon {
    display: flex;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.ct-full-item[data-video-url]:hover .ct-play-icon {
    opacity: 1;
}
.ct-full-content {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #333;
}
.ct-full-content p {
    margin-bottom: 1em;
}
.ct-full-byline {
    text-align: right;
    margin-top: 1.5rem;
    font-size: 1.1rem;
    color: #4A5568;
    font-style: italic;
}
.ct-full-byline p {
    margin: 0;
}

/* --- ADDED: Category Badge Styles --- */
.ct-card-categories {
    margin-top: 0.75rem; /* Adds a little space above the badges */
    margin-bottom: 0.25rem;
}
.form-table th {
    padding-left: 0;
}
.form-table input.small-text {
    width: 60px;
}
/* --- UPDATED: Category Badge Styles --- */
.ct-card-categories {
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}
.ct-category-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    color: #6B4F8D; /* Dark pastel purple for text */
    background-color: #EAE4F2; /* Light pastel purple background */
    padding: 0.3em 0.6em;
    border: 1px solid #C9B8DA; /* Subtle darker border */
    border-radius: 99px;
    margin-right: 0.3rem;
    margin-bottom: 0.3rem;
}

/* Ensure placeholder images fit the card */
.ct-card-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* Testimonials pagination */
.ct-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0 4px;
    margin-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, .08);
}
.ct-pagination a {
    color: #a987c2;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 8px;
}
.ct-pagination a:hover,
.ct-pagination a:focus {
    text-decoration: underline;
    outline: none;
}
.ct-pagination a:first-child {
    margin-right: auto;
}
.ct-pagination a:last-child {
    margin-left: auto;
    text-align: right;
}
.ct-pagination a:only-child {
    margin-left: 0;
    margin-right: 0;
}

/* Keep Read More at consistent bottom of card */
.ct-full-item__content,
.ct-card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.ct-read-more {
    margin-top: auto;
    display: inline-block;
}

/* Keep "Read More" aligned at the card bottom */
.ct-card-content,
.ct-full-item__content {
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensures the content area fills the card's height */
}
.ct-card-read-more {
    margin-top: auto; /* This is the magic that pushes it to the bottom */
    padding-top: 1rem; /* Adds a little breathing room above the link */
}

/* Hide images when show_image="false" is used */
.ct-hide-images .ct-testimonial-image,
.ct-hide-images .testimonial-image,    /* Covers generic classes */
.ct-hide-images img.attachment-thumbnail {
    display: none !important;
}

/* Optional: Center the text content when the image is removed */
.ct-hide-images .ct-testimonial-card,
.ct-hide-images .testimonial-item {
    text-align: center;
    justify-content: center;
}

/* Ensure header content centers nicely */
.ct-hide-images .ct-testimonial-header {
    justify-content: center;
    flex-direction: column;
}

/* Center content when images are hidden */
.ct-hide-images .ct-card-content {
    text-align: center;
}

.ct-hide-images .ct-card-stars {
    justify-content: center;
    display: flex;
}

/* --- Modal CTA Buttons --- */
.ct-modal-buttons {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center; /* Center buttons */
}

.ct-modal-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 99px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    flex: 1 1 auto; /* Allow items to grow/shrink nicely */
    min-width: 200px;
    max-width: 300px;
}

/* Primary Button (Discovery) - Brand Purple */
.ct-btn-discovery {
    background-color: #6a4c89;
    color: #ffffff !important;
    border: 2px solid #6a4c89;
}
.ct-btn-discovery:hover {
    background-color: #553b70;
    border-color: #553b70;
    transform: translateY(-2px);
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(106, 76, 137, 0.3);
}

/* Secondary Button (Consult) - Outline or Lighter */
.ct-btn-consult {
    background-color: transparent;
    color: #6a4c89 !important;
    border: 2px solid #6a4c89;
}
.ct-btn-consult:hover {
    background-color: #6a4c89;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(106, 76, 137, 0.2);
}

/* Update Video Modal to allow button space */
#ct-video-modal-overlay .ct-modal-content {
    /* If buttons are present, we might want to allow scrolling or auto height */
    height: auto; 
    overflow: hidden; /* Keep rounded corners */
}

/* Ensure buttons have padding inside the video modal specifically */
.ct-video-modal-buttons {
    padding: 1.5rem; /* Give the buttons breathing room */
    background: #fff; /* Ensure they sit on white, not transparent */
}

/* --- Source Icons --- */
.ct-source-badge {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-left: 10px;
    opacity: 0.8;
}
.ct-source-badge:hover {
    opacity: 1;
}
.ct-source-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Ensure header row aligns items correctly */
.ct-card-header-row {
    margin-bottom: 0.5rem;
}
.ct-card-stars {
    margin-bottom: 0; /* Reset this so it aligns with icon */
    line-height: 1;
}
/* Fix mobile button centering by including padding in width calculation */
.ct-modal-btn {
    box-sizing: border-box; 
}

/* Optional: Ensure the container centers items vertically in column mode */
@media (max-width: 600px) {
    .ct-modal-buttons {
        align-items: center; /* Ensures items are centered if they aren't full width */
    }
}

/* Responsive adjustment for mobile modals */
@media (max-width: 600px) {
    .ct-modal-buttons {
        flex-direction: column;
    }
    .ct-modal-btn {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    #ct-text-modal-body .ct-modal-image {
        float: none;
        width: 100%;
        margin: 0 0 1.5rem 0;
    }
    #ct-text-modal-body .ct-modal-byline {
        text-align: left;
    }
}

/* --- Card Header Row Layout --- */
.ct-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    position: relative; /* Essential for absolute positioning of icon */
}

/* --- Scroller Specific: Center Everything --- */
.ct-scroller .ct-card-header-row {
    justify-content: center; /* Center the stars */
}

.ct-scroller .ct-card-content {
    text-align: center; /* Center the text */
}

/* If inside a scroller, pin the icon to the right so stars stay true-center */
.ct-scroller .ct-source-badge {
    position: absolute;
    right: 0;
    top: 0;
}

/* Center the byline/excerpt block if needed */
.ct-scroller .ct-card-byline,
.ct-scroller .ct-card-excerpt {
    margin-left: auto;
    margin-right: auto;
}
