/**
 * Frontend styles for Zetpy Product Review Plugin
 * Version: 1.0.0 (Development)
 */

/* Reset and Base Styles */
.zetpy-reviews-tab * {
    box-sizing: border-box;
}

.zetpy-reviews-tab {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Filter Container */
.zetpy-filter-container {
    margin-bottom: 30px;
    padding: 20px;
    background: #faf8f5;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    display: flex;
    justify-content: center;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: #ff9800;
    color: #ff9800;
}

.filter-btn.active {
    background: #9b9a9a;
    border-color: #9b9a9a;
    color: white;
}

.filter-btn.active:hover {
    background: #9b9a9a;
    border-color: #9b9a9a;
}

/* Review Form */
.zetpy-review-form-container {
    background: #fff;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.zetpy-review-form-container h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
}

.form-intro {
    margin: 0 0 30px 0;
    color: #666;
    font-size: 16px;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.form-label.required::after {
    content: ' *';
    color: #dc3545;
    font-weight: bold;
}

/* Rating Input */
.rating-group {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.rating-input {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 15px 0;
}

.rating-input input[type="radio"] {
    display: none;
}

.rating-input label {
    font-size: 40px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin: 0;
}

.rating-input label:hover,
.rating-input label.hover,
.rating-input label.active {
    color: #ffc107;
    transform: scale(1.1);
}

.rating-labels {
    margin-top: 15px;
    height: 24px;
}

.rating-text {
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.rating-text.rating-1 { color: #dc3545; }
.rating-text.rating-2 { color: #fd7e14; }
.rating-text.rating-3 { color: #ffc107; }
.rating-text.rating-4 { color: #20c997; }
.rating-text.rating-5 { color: #28a745; }

/* Form Fields */
.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #fff;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

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

.char-count {
    margin-top: 8px;
    font-size: 14px;
    color: #666;
    text-align: right;
}

.char-count .current {
    font-weight: 600;
}

.char-count .current.insufficient {
    color: #dc3545;
}

/* Media Upload */
.media-upload-area {
    border: 2px dashed #e1e8ed;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.media-upload-area:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.upload-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.upload-button:hover {
    background: rgba(0, 115, 170, 0.05);
}

.upload-icon {
    font-size: 32px;
}

.upload-text {
    font-size: 16px;
    font-weight: 600;
    color: #0073aa;
}

.upload-description {
    margin: 15px 0 0 0;
    font-size: 14px;
    color: #666;
}

.media-preview {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.media-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e1e8ed;
    background: #f8f9fa;
}

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

.media-preview-item .remove-media {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form Actions */
.form-actions {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
}

.submit-review-btn {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.submit-review-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
}

.submit-review-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.submit-note {
    margin: 15px 0 0 0;
    font-size: 14px;
    color: #666;
}

/* Review Notice */
.zetpy-review-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
}

.notice-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notice-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.notice-text h3,
.notice-text strong {
    margin: 0 0 8px 0;
    color: #856404;
    font-size: 18px;
}

.notice-text p {
    margin: 0 0 15px 0;
    color: #856404;
}

.login-btn {
    background: #856404;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease;
}

.login-btn:hover {
    background: #6c5200;
    color: white;
}

/* User Review */
.zetpy-user-review {
    background: #e8f5e8;
    border: 2px solid #28a745;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 40px;
}

.zetpy-user-review h3 {
    margin: 0 0 20px 0;
    color: #155724;
    font-size: 20px;
}

.review-status-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 12px 16px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 14px;
}

.status-icon {
    font-size: 16px;
}

/* Single Review */
.zetpy-single-review {
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    position: relative;
}

.zetpy-single-review:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.zetpy-single-review.featured-review {
    background: #fff !important;
    border: 1px solid #e1e8ed !important;
    /* No special styling for featured reviews, only show featured badge */
}

.featured-badge {
    position: absolute;
    top: -1px;
    right: 20px;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #212529;
    padding: 6px 12px;
    border-radius: 0 0 8px 8px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.reviewer-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.reviewer-avatar {
    flex-shrink: 0;
}

.avatar-img {
    border-radius: 50%;
    border: 2px solid #e1e8ed;
}

.reviewer-name {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.reviewer-name strong {
    font-size: 16px;
    color: #1a1a1a;
}

.verified-badge {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
}

.review-meta {
    font-size: 14px;
    color: #666;
}

.review-content {
    margin-bottom: 20px;
}

.review-text {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Media Gallery */
.review-media {
    margin-bottom: 20px;
}

.media-gallery {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.media-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #e1e8ed;
    transition: all 0.2s ease;
}

.media-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.media-item.media-image:hover {
    cursor: pointer;
}

.media-item.media-image:hover img {
    filter: brightness(1.1);
}

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

.image-container {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    display: block;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-overlay,
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: white;
    font-size: 20px;
    pointer-events: none;
    cursor: pointer;
}

.media-item.media-image .media-overlay {
    pointer-events: auto;
}

.media-item.media-video .video-overlay {
    pointer-events: auto;
}

.media-item.media-video:hover .video-overlay {
    opacity: 1;
}

.media-item.media-video video {
    position: relative;
    z-index: 2;
}

.video-duration {
    position: absolute !important;
    bottom: 4px !important;
    right: 4px !important;
    left: auto !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    z-index: 10 !important;
    pointer-events: none !important;
}

.media-item:hover .media-overlay,
.media-item:hover .video-overlay {
    opacity: 1;
}

/* Admin Reply */
.admin-reply {
    background: #f8f9fa;
    border-left: 4px solid #999999;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 0 8px 8px 0;
}

.admin-reply-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.admin-avatar {
    width: 32px;
    height: 32px;
    background: #0073aa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.admin-name {
    color: #525252;
    font-weight: bold;
    font-size: 14px;
}

.reply-date {
    font-size: 12px;
    color: #666;
    margin-left: auto;
}

.admin-reply-content {
    color: #555;
    line-height: 1.6;
    font-size: 15px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Review Actions */
.review-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e1e8ed;
}

.helpful-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 2px solid #e1e8ed;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s ease;
    font-weight: 500;
}

.helpful-button:hover:not(:disabled) {
    border-color: #0073aa;
    color: #0073aa;
    background: rgba(0, 115, 170, 0.05);
}

.helpful-button.voted {
    background: #0073aa;
    border-color: #0073aa;
    color: white;
}

.helpful-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.share-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.share-button:hover {
    background: rgba(0,0,0,0.05);
    color: #333;
}

/* Reviews List */
.zetpy-reviews-list {
    margin-top: 40px;
}


/* Reviews Pagination */
.reviews-pagination {
    text-align: center;
    margin: 30px 0;
    padding: 20px 0;
}

.zetpy-pagination {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    position: relative;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #6b7280;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.pagination-btn:hover {
    background: #f3f4f6;
    color: #374151;
    transform: translateY(-1px);
}

.pagination-btn.active {
    background: #0073aa;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.3);
    cursor: default;
}

.pagination-btn.active:hover {
    transform: none;
    background: #0073aa;
}

.pagination-btn.pagination-prev,
.pagination-btn.pagination-next {
    width: 40px;
    font-size: 18px;
    font-weight: bold;
}

.pagination-btn.pagination-prev:hover,
.pagination-btn.pagination-next:hover {
    background: #0073aa;
    color: white;
}

.pagination-dots {
    color: #9ca3af;
    font-weight: bold;
    padding: 0 4px;
    user-select: none;
}

.zetpy-pagination.loading {
    opacity: 0.6;
    pointer-events: none;
}

.zetpy-pagination.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: zetpy-spin 1s linear infinite;
}

@keyframes zetpy-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Legacy load more button styles (for backwards compatibility) */
.load-more-reviews {
    background: white;
    border: 2px solid #0073aa;
    color: #0073aa;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-more-reviews:hover {
    background: #0073aa;
    color: white;
}

.load-more-reviews:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .zetpy-pagination {
        gap: 4px;
        padding: 6px;
    }
    
    .pagination-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
    
    .pagination-btn.pagination-prev,
    .pagination-btn.pagination-next {
        width: 36px;
        font-size: 16px;
    }
}

/* No Reviews */
.zetpy-no-reviews {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e1e8ed;
}

.no-reviews-content {
    max-width: 400px;
    margin: 0 auto;
}

.no-reviews-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
}

.zetpy-no-reviews h3 {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: #1a1a1a;
}

.zetpy-no-reviews p {
    margin: 0 0 25px 0;
    color: #666;
    font-size: 16px;
}

.write-first-review-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.write-first-review-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Media Modal */
.media-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.media-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    z-index: 10000;
}

.media-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 10001;
}

.media-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 1;
    transition: background 0.2s ease;
}

.media-modal-close:hover {
    background: rgba(0,0,0,0.9);
}

.media-modal-body img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
}

.media-modal-body video {
    max-width: 100%;
    max-height: 90vh;
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .zetpy-filter-container {
        padding: 15px;
    }
    
    .filter-buttons {
        gap: 6px;
        justify-content: center;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .review-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .reviewer-info {
        flex-direction: row;
        width: 100%;
    }
    
    .media-gallery {
        justify-content: center;
    }
    
    .media-item {
        width: 80px;
        height: 80px;
    }
    
    .zetpy-review-form-container {
        padding: 20px;
    }
    
    .rating-input label {
        font-size: 32px;
    }
    
    .notice-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .zetpy-reviews-tab {
        padding: 0;
    }
    
    .zetpy-filter-container {
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 8px;
        padding: 12px;
    }
    
    .zetpy-single-review {
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 8px;
    }
    
    .rating-number {
        font-size: 48px;
    }
    
    .media-gallery {
        gap: 8px;
    }
    
    .media-item {
        width: 60px;
        height: 60px;
    }
}
