/* ==========================================================================
   Reviews Waterfall - Frontend Complete Styles
   兼容 Blocksy 主题 & Elementor 编辑器
   ========================================================================== */

.rwf-wrapper {
    max-width: 100%;
    margin: 30px 0;
    font-family: inherit;
    color: #1a1a1a;
    box-sizing: border-box;
}

.rwf-wrapper *,
.rwf-wrapper *::before,
.rwf-wrapper *::after {
    box-sizing: border-box;
}

/* Elementor 编辑器预览提示 */
.rwf-editor-preview .rwf-editor-notice {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 8px 12px;
    margin-bottom: 15px;
    font-size: 12px;
    color: #78350f;
    border-radius: 3px;
}

/* ========== 汇总评分 (4.9★ / 51 Reviews) ========== */
.rwf-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}

.rwf-summary-stars .rwf-stars {
    font-size: 22px;
    letter-spacing: 2px;
}

.rwf-summary-text {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 16px;
}

.rwf-avg {
    font-size: 22px;
    font-weight: 700;
}

.rwf-sep {
    color: #999;
}

.rwf-count {
    color: #666;
}

.rwf-summary-empty {
    color: #999;
    font-size: 14px;
    padding: 10px 0;
}

/* ========== 星星图标 ========== */
.rwf-stars {
    display: inline-flex;
    color: #fbbf24;
    letter-spacing: 1px;
    line-height: 1;
    font-size: 14px;
}

.rwf-star.empty {
    color: #d4d4d8;
}

.rwf-star.half {
    background: linear-gradient(90deg, #fbbf24 50%, #d4d4d8 50%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ========== 工具栏 (排序菜单) ========== */
.rwf-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

.rwf-count-label {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.rwf-sort-wrap {
    position: relative;
}

.rwf-sort-btn {
    background: #fff;
    border: 1px solid #e5e5e5;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    color: #333;
    transition: all 0.2s;
}

.rwf-sort-btn:hover {
    border-color: #999;
    background: #f9f9f9;
}

.rwf-sort-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    min-width: 220px;
    padding: 16px;
    z-index: 100;
}

.rwf-sort-menu[hidden] {
    display: none;
}

.rwf-sort-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.rwf-sort-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rwf-sort-menu li {
    padding: 10px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.rwf-sort-menu li:hover {
    background: #f5f5f5;
}

.rwf-sort-menu li.active::after {
    content: "✓";
    color: #333;
    font-weight: bold;
}

/* ========== 瀑布流卡片 ========== */
.rwf-waterfall {
    margin: 0 -8px;
    position: relative;
}

.rwf-waterfall::after {
    content: '';
    display: table;
    clear: both;
}

.rwf-card {
    width: calc(25% - 16px);
    margin: 0 8px 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    float: left;
}

.rwf-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.rwf-card-image {
    position: relative;
    width: 100%;
    background: #f5f5f5;
    line-height: 0;
}

.rwf-card-image img {
    width: 100%;
    height: auto;
    display: block;
}

.rwf-image-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.rwf-card-body {
    padding: 12px 14px 14px;
}

.rwf-card-author {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.rwf-verified {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: #22c55e;
    font-weight: 500;
}

.rwf-verified svg {
    display: block;
}

.rwf-card-date {
    font-size: 12px;
    color: #888;
    display: block;
    margin-bottom: 6px;
}

.rwf-card-rating {
    margin-bottom: 8px;
}

.rwf-card-content {
    font-size: 13px;
    color: #333;
    line-height: 1.5;
    margin: 0 0 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.rwf-card-product {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    margin-top: 8px;
}

.rwf-card-product img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.rwf-product-name {
    font-size: 12px;
    color: #555;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rwf-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 15px;
    width: 100%;
}

/* ========== Load More 按钮与分页 ========== */
.rwf-loadmore-wrap {
    text-align: center;
    margin-top: 30px;
    clear: both;
}

.rwf-loadmore-btn {
    background: #fff;
    border: 1px solid #333;
    color: #333;
    padding: 12px 40px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.rwf-loadmore-btn:hover:not(:disabled) {
    background: #333;
    color: #fff;
}

.rwf-loadmore-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rwf-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 30px;
    clear: both;
    flex-wrap: wrap;
}

.rwf-pagination a,
.rwf-pagination .rwf-page {
    padding: 8px 14px;
    border: 1px solid #e5e5e5;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.15s;
}

.rwf-pagination a:hover {
    background: #f5f5f5;
    border-color: #999;
}

.rwf-pagination .current {
    background: #333;
    color: #fff;
    border-color: #333;
}

.rwf-page-dots {
    color: #999;
    padding: 0 4px;
}

/* ========== 弹窗 (Modal Lightbox) ========== */
.rwf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rwf-modal[hidden] {
    display: none;
}

.rwf-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.rwf-modal-inner {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    max-height: 800px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    z-index: 1;
    animation: rwf-modal-in 0.25s ease-out;
}

@keyframes rwf-modal-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.rwf-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.rwf-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.rwf-modal-body {
    display: flex;
    width: 100%;
    height: 100%;
}

.rwf-modal-image {
    flex: 1 1 60%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.rwf-modal-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.rwf-modal-image.no-image {
    background: #fafafa;
    color: #ccc;
    font-size: 14px;
}

.rwf-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.2s;
}

.rwf-modal-nav:hover {
    background: #fff;
}

.rwf-modal-nav.prev { left: 12px; }
.rwf-modal-nav.next { right: 12px; }

.rwf-modal-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.rwf-modal-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.2s;
}

.rwf-modal-dots span.active {
    background: #fff;
}

.rwf-modal-info {
    flex: 1 1 40%;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.rwf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.rwf-modal-author {
    font-size: 20px;
    font-weight: 700;
}

.rwf-modal-meta {
    text-align: right;
    font-size: 13px;
}

.rwf-modal-verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #22c55e;
    font-weight: 500;
    margin-bottom: 4px;
}

.rwf-modal-date {
    color: #888;
    display: block;
}

.rwf-modal-rating {
    margin-bottom: 16px;
}

.rwf-modal-rating .rwf-stars {
    font-size: 24px;
    letter-spacing: 3px;
}

.rwf-modal-content {
    font-size: 15px;
    line-height: 1.6;
    color: #222;
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.rwf-modal-product {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.rwf-modal-product-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.rwf-modal-product img {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.rwf-modal-product-name {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1.3;
}

.rwf-modal-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: #fff;
    color: #333;
    border: 1px solid #333;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    text-transform: uppercase;
}

.rwf-modal-view-btn:hover {
    background: #333;
    color: #fff;
}

/* ========== 前台提交表单 ========== */
.rwf-form-wrap {
    max-width: 700px;
    margin: 30px auto;
    padding: 30px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

.rwf-form-title {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
}

.rwf-form-login-required,
.rwf-form-already {
    text-align: center;
    padding: 40px 20px;
}

.rwf-form-login-required p,
.rwf-form-already p {
    margin-bottom: 15px;
    color: #666;
}

.rwf-form-error {
    padding: 12px 16px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    border: 1px solid #fca5a5;
    font-size: 14px;
}

.rwf-form-field {
    margin-bottom: 20px;
}

.rwf-form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

.rwf-form-field .required {
    color: #dc2626;
}

.rwf-form-field input[type="text"],
.rwf-form-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.rwf-form-field input[type="text"]:focus,
.rwf-form-field textarea:focus {
    outline: none;
    border-color: #333;
}

.rwf-form-field textarea {
    resize: vertical;
    min-height: 100px;
}

.rwf-star-input {
    display: inline-flex;
    gap: 4px;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

.rwf-star-slot {
    color: #d4d4d8;
    transition: color 0.15s;
}

.rwf-star-slot.active,
.rwf-star-slot.hover {
    color: #fbbf24;
}

.rwf-upload-area {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.rwf-uploaded-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rwf-upload-preview {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.rwf-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rwf-upload-preview.uploading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" stroke="%23333" stroke-width="2" fill="none" stroke-dasharray="30 30"><animateTransform attributeName="transform" type="rotate" from="0 12 12" to="360 12 12" dur="1s" repeatCount="indefinite"/></circle></svg>') no-repeat center;
}

.rwf-upload-preview .remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    font-size: 14px;
    padding: 0;
    z-index: 2;
}

.rwf-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 20px 24px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    color: #555;
    font-size: 13px;
    transition: all 0.15s;
    background: #fafafa;
    line-height: 1;
}

.rwf-upload-btn:hover {
    border-color: #333;
    color: #333;
    background: #f5f5f5;
}

.rwf-upload-hint {
    width: 100%;
    font-size: 12px;
    color: #888;
    margin: 8px 0 0;
}

.rwf-upload-locked {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #888;
    font-size: 13px;
    margin: 0;
    padding: 10px 14px;
    background: #f9fafb;
    border: 1px dashed #e5e5e5;
    border-radius: 6px;
}

.rwf-form-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.rwf-form-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.rwf-form-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.rwf-submit-btn {
    background: #1a1a1a;
    color: #fff;
    border: none;
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.rwf-submit-btn:hover:not(:disabled) {
    background: #333;
}

.rwf-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== 响应式：平板 ========== */
@media (max-width: 1024px) {
    .rwf-card {
        width: calc(33.333% - 16px);
    }
}

/* ========== 响应式：移动端 ========== */
@media (max-width: 768px) {
    .rwf-waterfall {
        margin: 0 -6px;
    }
    
    .rwf-card {
        width: calc(50% - 12px);
        margin: 0 6px 12px;
    }
    
    .rwf-card-body {
        padding: 10px 12px 12px;
    }
    
    .rwf-card-author {
        font-size: 13px;
    }
    
    .rwf-card-content {
        font-size: 12px;
    }
    
    .rwf-modal-inner {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .rwf-modal-body {
        flex-direction: column;
        overflow-y: auto;
    }
    
    .rwf-modal-image {
        flex: 0 0 45vh;
        min-height: 300px;
    }
    
    .rwf-modal-info {
        flex: 1 1 auto;
        padding: 20px;
    }
    
    .rwf-modal-close {
        background: rgba(0, 0, 0, 0.6);
    }
    
    .rwf-summary {
        padding: 12px 0;
    }
    
    .rwf-avg {
        font-size: 18px;
    }
    
    .rwf-summary-stars .rwf-stars {
        font-size: 18px;
    }
}

/* ========== 移动端强制 1 列 (data 属性覆盖) ========== */
.rwf-wrapper[data-cols-mobile="1"] .rwf-card {
    width: calc(100% - 12px);
}

@media (max-width: 480px) {
    .rwf-modal-image {
        flex: 0 0 40vh;
        min-height: 250px;
    }
    
    .rwf-modal-author {
        font-size: 17px;
    }
    
    .rwf-modal-content {
        font-size: 14px;
    }
    
    .rwf-form-wrap {
        padding: 20px 15px;
    }
    
    .rwf-star-input {
        font-size: 28px;
    }
}