/**
 * Photo Reviews Public Styles
 *
 * @link       https://xfinitysoft.com
 * @since      1.0.0
 *
 * @package    WC_Review_Discounts
 * @subpackage WC_Review_Discounts/public/css
 */

/* -------------------------------
   Photo Upload Field Styles
--------------------------------- */
.comment-form-photo-upload {
    margin-bottom: 1rem;
}

.xswcrd-upload-container {
    margin-top: 10px;
}

.xswcrd-upload-input {
    display: none;
}

.xswcrd-upload-label {
    display: inline-block;
    background-color: #0073aa;
    color: white;
    padding: 12px 20px;
    text-align: center;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    font-size: 14px;
    border: none;
}

.xswcrd-upload-label:hover {
    background-color: #005a87;
}

/* -------------------------------
   Media Thumbnails Styles
--------------------------------- */
.media-thumbnails {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.media-thumbnail {
    position: relative;
    width: 80px;
    height: 80px;
    border: 2px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.media-thumbnail img,
.media-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumbnail .remove-thumb {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 255, 255, 0.9);
    color: #d63638;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.media-thumbnail .remove-thumb:hover {
    background: #d63638;
    color: white;
}

/* -------------------------------
   Review Media Display Styles
--------------------------------- */
.xswcrd-review-media {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.xswcrd-media-item {
    position: relative;
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.xswcrd-media-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.xswcrd-media-item img,
.xswcrd-media-item video {
    width: 200px;
    height: 100px;
    object-fit: cover;
    display: block;
}

.xswcrd-zoom-icon,
.xswcrd-play-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
}

.xswcrd-zoom-icon:before {
    content: "🔍";
}

.xswcrd-play-icon {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.xswcrd-play-icon:before {
    content: "▶";
}

/* -------------------------------
   Edit Review Modal Styles
--------------------------------- */

/* ✅ FIXED: Use aria-hidden for true invisibility and avoid Playwright conflict */
.xswcrd-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

/* When modal is hidden */
.xswcrd-edit-modal[aria-hidden="true"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* When modal is visible */
.xswcrd-edit-modal[aria-hidden="false"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.xswcrd-modal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.55);
}

/* Modal content centered */
.xswcrd-modal-content {
    position: relative;
    background: #fff;
    padding: 25px 30px;
    border-radius: 10px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 2;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.xswcrd-modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.xswcrd-form-group {
    margin-bottom: 20px;
}

.xswcrd-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.xswcrd-form-group select,
.xswcrd-form-group textarea,
.xswcrd-form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.xswcrd-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.xswcrd-current-media {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.xswcrd-media-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.xswcrd-media-thumb img,
.xswcrd-media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.xswcrd-remove-media {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(214, 54, 56, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.xswcrd-remove-media:hover {
    background: #d63638;
}

/* -------------------------------
   Form Buttons
--------------------------------- */
.xswcrd-form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 10px;
}

.xswcrd-cancel-btn,
.xswcrd-submit-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.xswcrd-cancel-btn {
    background: #6c757d;
    color: white;
}

.xswcrd-cancel-btn:hover {
    background: #5a6268;
}

.xswcrd-submit-btn {
    background: #4CAF50;
    color: white;
}

.xswcrd-submit-btn:hover {
    background: #45a049;
}

/* -------------------------------
   Edit Review Button
--------------------------------- */
.xswcrd-edit-review-btn {
    background: none;
    border: none;
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    margin-top: 10px;
}

.xswcrd-edit-review-btn:hover {
    color: #005a87;
}

/* -------------------------------
   Review Voting Styles
--------------------------------- */
.xswcrd-vote-buttons {
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.xswcrd-vote-buttons span {
    font-size: 13px;
    color: #666;
}

.xswcrd-vote-button {
    cursor: pointer;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.xswcrd-vote-button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.xswcrd-vote-button.voted {
    background: #fff;
    color: #000;
    border-color: #fff;
    font-weight: 600;
}

/* -------------------------------
   Rating Summary + Filters
--------------------------------- */
.xswcrd-rating-summary {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafafa;
}

.xswcrd-rating-overview {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.xswcrd-rating-score {
    font-size: 48px;
    font-weight: bold;
    margin-right: 20px;
    color: #333;
}

.xswcrd-rating-stars {
    flex: 1;
}

.xswcrd-star-display {
    position: relative;
    display: inline-block;
    font-size: 20px;
    line-height: 1;
    margin-bottom: 5px;
}

.xswcrd-star-fill {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    white-space: nowrap;
}

.xswcrd-star-empty {
    color: #ccc;
}

.xswcrd-rating-bars {
    margin-top: 10px;
}

.xswcrd-rating-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.xswcrd-rating-bar:hover {
    background: rgba(0, 0, 0, 0.05);
}

.xswcrd-rating-bar span {
    font-size: 14px;
    min-width: 30px;
}

.xswcrd-progress-bg {
    flex: 1;
    background: #eee;
    margin: 0 10px;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.xswcrd-progress-fill {
    height: 100%;
    transition: width 0.5s ease;
}

/* -------------------------------
   Review Filter Styles
--------------------------------- */
.xswcrd-review-filter-wrapper {
    margin: 20px 0;
}

.xswcrd-review-filter {
    appearance: none;
    /* Remove browser default arrow */
    -moz-appearance: none;
    -webkit-appearance: none;
    background-color: #fff !important;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 36px 8px 12px;
    /* space for arrow */
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.2s ease-in-out;

    /* Custom dropdown arrow (light gray) */
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23999' height='12' viewBox='0 0 20 20' width='12' xmlns='http://www.w3.org/2000/svg'><path d='M5.516 7.548l4.484 4.484 4.484-4.484a.75.75 0 011.06 1.06l-5.014 5.015a.75.75 0 01-1.06 0L4.456 8.608a.75.75 0 011.06-1.06z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.xswcrd-review-filter:hover {
    border-color: #999;
}

.xswcrd-review-filter:focus {
    outline: none;
    border-color: #2271b1;
    /* WooCommerce blue */
    box-shadow: 0 0 0 1px #2271b1;
}

/* Blur effect during filtering */
.xswcrd-blur {
    filter: blur(4px);
    transition: filter 0.3s ease;
    pointer-events: none;
    user-select: none;
}

/* -------------------------------
   Responsive Design
--------------------------------- */
@media (max-width: 768px) {

    .xswcrd-media-item img,
    .xswcrd-media-item video {
        width: 150px;
        height: 75px;
    }

    .xswcrd-modal-content {
        padding: 20px;
        width: 95%;
    }

    .xswcrd-form-actions {
        flex-direction: column;
    }

    .xswcrd-rating-overview {
        flex-direction: column;
        text-align: center;
    }

    .xswcrd-rating-score {
        margin-right: 0;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {

    .xswcrd-media-item img,
    .xswcrd-media-item video {
        width: 120px;
        height: 60px;
    }

    .media-thumbnail {
        width: 60px;
        height: 60px;
    }

    .xswcrd-review-media {
        gap: 8px;
    }
}