.testimonial-media-container {
    margin: 10px auto; /* Center block element if it has a max-width */
    background-color: #e9e9e9; /* Fallback background, e.g. while loading or if media fails */
    direction: ltr; /* Ensure media elements behave as expected regardless of site direction */
}

/* Image Specific - Instagram Story Style */
.testimonial-media-container.testimonial-image-aspect-ratio {
    position: relative;
    width: 100%; /* Takes full width of its parent by default */
    /* max-width can be set via shortcode 'width' attribute (inline style) or theme's CSS */
    /* Example: max-width: 400px; */
    padding-top: 100%; /* 1:1 Aspect Ratio (height is 100% of width) */
    overflow: hidden; /* Crucial for the scaled background and aspect ratio */
    border-radius: 8px; /* Optional: for softer edges */
}

.testimonial-media-container .testimonial-media-background {
    position: absolute;
    top: -5%; /* Overscan to prevent seeing edges of the blur */
    left: -5%;
    width: 110%;
    height: 110%;
    background-size: cover; /* Ensure the image covers the area, might be cropped */
    background-position: center center;
    filter: blur(15px) brightness(0.85); /* Adjust blur and brightness as needed */
    z-index: 1;
    transform: scale(1.05); /* Alternative/additional overscan */
}

.testimonial-media-container .testimonial-media-foreground {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensures the whole image is visible, letterboxed if necessary */
    object-position: center center;
    z-index: 2;
    /* Optional: if you want padding around the foreground image within the square */
    /* padding: 5%; box-sizing: border-box; */
}

/* Video Specific - Responsive Wrapper */
.testimonial-media-container.testimonial-video-responsive-wrapper {
    width: 100%; /* Takes full available width up to its max-width */
    /* max-width will be set inline by the shortcode based on 'width' attribute */
    /* Example: max-width: 560px; */
    background-color: #000; /* Common for video players */
    border-radius: 4px; /* Optional */
}

.testimonial-video-aspect-ratio-inner {
    position: relative;
    width: 100%;
    height: 0; /* Height is controlled by padding-bottom */
    overflow: hidden;
}

.testimonial-video-responsive-wrapper iframe,
.testimonial-video-responsive-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0; /* For iframes */
}

/* Fallback text styling for missing media or errors */
.testimonial-media-container p[style*="text-align:center"] {
    /* Styles for error messages are mostly inline in the PHP for now */
    color: #555;
    font-size: 0.9em;
    line-height: 1.4;
}
/* Form */
.testimonial-form-wrapper {
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 5px;
    background-color: #f9f9f9;
    margin-top: 20px;
}
.testimonial-form-wrapper h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
}
.testimonial-submission-form .form-group {
    margin-bottom: 15px;
}
.testimonial-submission-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.testimonial-submission-form input[type='text'],
.testimonial-submission-form input[type='url'],
.testimonial-submission-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.testimonial-submission-form input[type='file'] {
    padding: 5px 0;
}
.testimonial-submission-form textarea {
    min-height: 120px;
    resize: vertical;
}
.testimonial-submission-form .rating-select .rating-star {
    font-size: 28px;
    color: #ddd;
    cursor: pointer;
    transition: color .2s;
    margin-left: 2px; /* Farsi: margin-right */
}
.testimonial-submission-form .rating-select .rating-star.selected,
.testimonial-submission-form .rating-select .rating-star:hover {
    color: #ffc107;
}
.testimonial-submission-form button[type='submit'] {
    background-color: #0073aa;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color .2s;
}
.testimonial-submission-form button[type='submit']:hover {
    background-color: #005a87;
}
.testimonial-form-message {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: .95em;
}
.testimonial-form-message.testimonial-form-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.testimonial-form-message.testimonial-form-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
/* Rating Stars */
.testimonial-rating .star,
.average-rating-stars .star {
    font-size: 1.2em;
    color: #ccc;
    margin-right: 1px; /* Farsi: margin-left */
}
.testimonial-rating .star.filled,
.average-rating-stars .star.filled {
    color: #ffc107;
}
.average-rating-stars .star.half {
    position: relative;
    display: inline-block;
    color: #ccc;
}
.average-rating-stars .star.half::before {
    content: '★';
    color: #ffc107;
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
}
/* User ID */
.testimonial-user-id {
    font-family: monospace;
    font-size: 0.9em;
    color: #555;
    background-color: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Styles specific to admin meta boxes if any were implicitly used by inline styles */
#testimonial-relations-container .relation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    border: 1px solid #eee;
    margin-bottom: 5px;
    background-color: #fff;
}
#testimonial-relations-container .relation-item span {
    flex-grow: 1;
}
#testimonial-relations-container .remove-relation {
    margin-left: 10px; /* Farsi: margin-right */
}
#testimonial-relations-selector {
    display: flex;
    margin-top: 10px;
}
#testimonial-relations-selector select,
#testimonial-relations-selector button {
    padding: 5px;
}