/* ==========================================================================
   M4H Custom Product Reviews System - Frontend Stylesheet
   ========================================================================== */

:root {
    --m4h-primary: #ef683a;
    --m4h-primary-hover: #dc5526;
    --m4h-star-color: #f59e0b;
    --m4h-star-bg: #e5e7eb;
    --m4h-verified-green: #059669;
    --m4h-verified-bg: #ecfdf5;
    --m4h-text-main: #1f2937;
    --m4h-text-muted: #6b7280;
    --m4h-border-color: #e5e7eb;
    --m4h-bg-light: #f9fafb;
    --m4h-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --m4h-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --m4h-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --m4h-radius: 8px;
}

.m4h-reviews-container {
    margin: 40px 0;
    font-family: inherit;
    color: var(--m4h-text-main);
    background: #fff;
    border-top: 2px solid #f3f4f6;
    padding-top: 30px;
}

/* Section Title H2 */
.m4h-section-title {
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--m4h-text-main);
    margin: 0 0 20px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--m4h-primary);
    display: inline-block;
    letter-spacing: 0.5px;
}

/* 1. Summary Card */

.m4h-review-summary-card {
    display: flex;
    flex-wrap: wrap;
    background: var(--m4h-bg-light);
    border: 1px solid var(--m4h-border-color);
    border-radius: var(--m4h-radius);
    padding: 24px;
    margin-bottom: 24px;
    gap: 30px;
    align-items: center;
}

.m4h-summary-overview {
    flex: 0 0 220px;
    text-align: center;
    border-right: 1px solid var(--m4h-border-color);
    padding-right: 20px;
}

@media (max-width: 768px) {
    .m4h-summary-overview {
        flex: 1 1 100%;
        border-right: none;
        border-bottom: 1px solid var(--m4h-border-color);
        padding-right: 0;
        padding-bottom: 20px;
    }
}

.m4h-rating-big-score {
    font-size: 44px;
    font-weight: 800;
    color: var(--m4h-text-main);
    line-height: 1;
}

.m4h-rating-big-score span {
    font-size: 20px;
    color: var(--m4h-text-muted);
    font-weight: 500;
}

.m4h-stars-outer {
    display: inline-block;
    position: relative;
    font-size: 20px;
    color: var(--m4h-star-bg);
    margin: 8px 0;
    line-height: 1;
}

.m4h-stars-outer::before {
    content: "★★★★★";
}

.m4h-stars-inner {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
    color: var(--m4h-star-color);
}

.m4h-stars-inner::before {
    content: "★★★★★";
}

.m4h-total-reviews-count {
    font-size: 14px;
    color: var(--m4h-text-muted);
    margin-bottom: 12px;
}

.m4h-btn-write-review {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--m4h-primary);
    color: #fff !important;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(239, 104, 58, 0.3);
}

.m4h-btn-write-review:hover {
    background: var(--m4h-primary-hover);
    transform: translateY(-1px);
}

.m4h-review-cant-msg {
    font-size: 13px;
    color: #d97706;
    background: #fef3c7;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
}

.m4h-summary-bars {
    flex: 1 1 300px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.m4h-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.m4h-star-label {
    width: 40px;
    font-weight: 600;
    color: var(--m4h-text-main);
}

.m4h-progress-bg {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.m4h-progress-fill {
    height: 100%;
    background: var(--m4h-star-color);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.m4h-star-count {
    width: 30px;
    text-align: right;
    color: var(--m4h-text-muted);
}

/* 2. Filter Pills */
.m4h-review-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.m4h-filter-btn {
    background: #f3f4f6;
    border: 1px solid var(--m4h-border-color);
    color: var(--m4h-text-main);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.m4h-filter-btn:hover,
.m4h-filter-btn.active {
    background: var(--m4h-primary);
    color: #fff;
    border-color: var(--m4h-primary);
}

/* 3. Review Popup Modal (Gọn gàng & Hiện đại) */
.m4h-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.m4h-modal-box {
    background: #fff;
    width: 100%;
    max-width: 580px;
    border-radius: 12px;
    box-shadow: var(--m4h-shadow-lg);
    overflow: hidden;
    animation: popupScale 0.25s ease-out;
}

@keyframes popupScale {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

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

.m4h-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--m4h-border-color);
    background: #fafafa;
}

.m4h-modal-header .m4h-form-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    padding: 0;
    border: none;
    color: var(--m4h-text-main);
}

.m4h-modal-close {
    font-size: 26px;
    color: var(--m4h-text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}

.m4h-modal-close:hover {
    color: #ef4444;
}

.m4h-modal-body {
    padding: 24px;
    max-height: 80vh;
    overflow-y: auto;
}

.m4h-form-group {
    margin-bottom: 16px;
}

.m4h-form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.m4h-form-group label .required {
    color: #dc2626;
}

.m4h-form-row {
    display: flex;
    gap: 16px;
}

.col-half {
    flex: 1;
}

@media (max-width: 600px) {
    .m4h-form-row {
        flex-direction: column;
        gap: 0;
    }
}

.m4h-form-group input[type="text"],
.m4h-form-group input[type="email"],
.m4h-form-group input[type="number"],
.m4h-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--m4h-border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.m4h-form-group input:focus,
.m4h-form-group textarea:focus {
    border-color: var(--m4h-primary);
}

/* Captcha Anti-Spam Styling */
.m4h-captcha-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.m4h-captcha-label {
    font-size: 13px;
    color: #166534;
    margin: 0 !important;
}

.m4h-captcha-input {
    width: 110px !important;
    padding: 6px 10px !important;
    text-align: center;
    font-weight: 700;
}

/* Star Rating Radio Picker */
.m4h-star-rating-input {
    display: inline-flex;
    flex-direction: row-reverse;
    font-size: 32px;
    line-height: 1;
    align-items: center;
}

.m4h-star-rating-input input[type="radio"],
.m4h-star-rating-input input {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    display: none !important;
}

.m4h-star-rating-input label {
    color: var(--m4h-star-bg);
    cursor: pointer;
    transition: color 0.15s ease, transform 0.1s ease;
    margin-bottom: 0;
    padding: 0 4px;
    font-size: 32px;
    line-height: 1;
    user-select: none;
    display: inline-block;
}

.m4h-star-rating-input label:hover,
.m4h-star-rating-input label:hover~label,
.m4h-star-rating-input input[type="radio"]:checked~label {
    color: var(--m4h-star-color) !important;
}

.m4h-rating-hint {
    margin-left: 12px;
    font-weight: 600;
    color: var(--m4h-star-color);
    font-size: 14px;
}

.m4h-user-logged-info {
    background: #eff6ff;
    color: #1e40af;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
}

/* Drag & Drop Upload Zone */
.m4h-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.m4h-drop-zone:hover,
.m4h-drop-zone.dragover {
    border-color: var(--m4h-primary);
    background: #fff5f2;
}

.m4h-drop-zone svg {
    color: var(--m4h-primary);
    margin-bottom: 6px;
}

.m4h-drop-zone p {
    margin: 0;
    font-size: 13px;
    color: var(--m4h-text-muted);
}

.m4h-image-preview-grid {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.m4h-preview-item {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--m4h-border-color);
}

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

.m4h-remove-img {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
}

.m4h-form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
}

.m4h-btn-submit {
    background: var(--m4h-primary);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.m4h-btn-submit:hover {
    background: var(--m4h-primary-hover);
}

.m4h-btn-cancel {
    background: transparent;
    color: var(--m4h-text-muted);
    border: 1px solid var(--m4h-border-color);
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.m4h-response-msg {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
}

.m4h-response-msg.success {
    background: #d1fae5;
    color: #065f46;
}

.m4h-response-msg.error {
    background: #fee2e2;
    color: #991b1b;
}

/* 4. Review List & Single Items */
.m4h-reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.m4h-review-item {
    display: flex;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--m4h-border-color);
}

.m4h-review-item.m4h-pending-item {
    background: #fffbe6;
    padding: 16px;
    border: 1px dashed #ffe58f;
    border-radius: 8px;
}

/* Avatar + Overlay Verified SVG Icon */
.m4h-review-author-avatar {
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
}

.m4h-avatar-letter {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.m4h-avatar-verified-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.m4h-avatar-verified-icon img {
    width: 14px;
    height: 14px;
    display: block;
}

.m4h-review-body {
    flex: 1;
}

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

.m4h-author-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

/* Nhãn Đã mua hàng phía TRÊN TÊN chữ nhỏ nhắn tinh tế */
.m4h-verified-top-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #059669;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 1px 6px;
    border-radius: 4px;
    line-height: 1.3;
    letter-spacing: 0.2px;
}

.m4h-author-name {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--m4h-text-main);
    line-height: 1.2;
}

.m4h-badge-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fef3c7;
    color: #d97706;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #fde68a;
    margin-top: 2px;
}

.m4h-review-date {
    font-size: 12px;
    color: var(--m4h-text-muted);
}

.m4h-review-rating-stars {
    margin-bottom: 8px;
}

.m4h-review-text {
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
    margin-bottom: 12px;
}

.m4h-review-images-grid {
    display: flex;
    gap: 8px;
}

.m4h-review-images-grid img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--m4h-border-color);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.m4h-review-images-grid img:hover {
    transform: scale(1.05);
}

/* Thao tác Admin trực tiếp */
.m4h-admin-review-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}

.m4h-btn-admin-approve {
    background: #059669;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.m4h-btn-admin-approve:hover {
    background: #047857;
}

.m4h-btn-admin-delete {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.m4h-btn-admin-delete:hover {
    background: #dc2626;
}

.m4h-no-reviews-msg {
    text-align: center;
    padding: 40px;
    color: var(--m4h-text-muted);
}

.m4h-btn-load-more {
    display: block;
    margin: 24px auto 0;
    background: #f3f4f6;
    border: 1px solid var(--m4h-border-color);
    color: var(--m4h-text-main);
    padding: 10px 24px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.m4h-btn-load-more:hover {
    background: var(--m4h-primary);
    color: #fff;
}

/* 5. Lightbox Modal */
.m4h-lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.m4h-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 36px;
    color: #fff;
    cursor: pointer;
}

.m4h-lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}