/* ===========================================
   pagePartials/reviewsModal.css - Reviews Modal
   =========================================== */

.page-modal-reviews {
    position: relative;
}

.page-modal-reviews.review-form-open > .page-modal-body {
    display: none;
}

.page-modal-reviews.review-form-open > .page-modal-header {
    display: none;
}

/* ===========================================
   Empty State
   =========================================== */

.reviews-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 24px;
}

.reviews-empty-icon {
    margin-bottom: 14px;
}

.reviews-empty-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--page-text-primary, #1f2937);
    margin: 0 0 6px;
}

.reviews-empty-subtitle {
    font-size: 14px;
    color: var(--page-text-muted, #9ca3af);
    margin: 0 0 24px;
    line-height: 1.5;
}

/* ===========================================
   Star Icons (shared)
   =========================================== */

.reviews-star-icon {
    fill: #e5e7eb;
    stroke: #e5e7eb;
}

.reviews-star-icon.filled {
    fill: #f59e0b;
    stroke: #f59e0b;
}

/* ===========================================
   Summary Section
   =========================================== */

.reviews-summary {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding-bottom: 18px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f0f1f3;
}

.reviews-summary-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 68px;
    flex-shrink: 0;
}

.reviews-summary-number {
    font-size: 34px;
    font-weight: 700;
    color: var(--page-text-primary, #1f2937);
    line-height: 1;
    letter-spacing: -0.02em;
}

.reviews-summary-stars {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
}

.reviews-summary-count {
    font-size: 13px;
    color: var(--page-text-muted, #9ca3af);
    white-space: nowrap;
    margin-top: 2px;
}

/* Distribution Bars */
.reviews-distribution {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.reviews-dist-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reviews-dist-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--page-text-secondary, #6b7280);
    width: 10px;
    text-align: right;
    flex-shrink: 0;
}

.reviews-dist-star {
    flex-shrink: 0;
}

.reviews-dist-bar-bg {
    flex: 1;
    height: 7px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    min-width: 0;
}

.reviews-dist-bar-fill {
    height: 100%;
    background: #f59e0b;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.reviews-dist-count {
    font-size: 11px;
    color: var(--page-text-muted, #9ca3af);
    width: 20px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Actions Bar */
.reviews-actions-bar {
    margin-bottom: 18px;
}

/* Leave a Review Button */
.reviews-leave-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--page-accent, #2563eb);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, transform 0.1s ease;
    width: 100%;
}

.reviews-leave-btn:hover {
    opacity: 0.92;
}

.reviews-leave-btn:active {
    transform: scale(0.98);
}

.reviews-leave-btn-empty {
    max-width: 200px;
}

/* ===========================================
   Review Cards
   =========================================== */

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.review-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.review-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.review-card-author {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.review-card-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--page-text-secondary, #6b7280);
    flex-shrink: 0;
}

.review-card-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.review-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--page-text-primary, #1f2937);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-card-date {
    font-size: 12px;
    color: var(--page-text-muted, #9ca3af);
}

.review-card-stars {
    display: flex;
    gap: 1px;
    flex-shrink: 0;
    margin-top: 2px;
}

.review-card-text {
    font-size: 14px;
    line-height: 1.65;
    color: var(--page-text-secondary, #4b5563);
    margin: 0 0 8px;
    white-space: pre-line;
    word-break: break-word;
}

/* Review Images */
.review-card-images {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.review-card-img-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}

.review-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.review-card-img-wrapper:hover .review-card-img {
    transform: scale(1.06);
}

/* Contact Reviewer */
.review-card-contact {
    margin-bottom: 8px;
}

.review-contact-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    background: none;
    border: none;
    font-size: 13px;
    color: var(--page-accent, #2563eb);
    cursor: pointer;
    font-family: inherit;
}

.review-contact-toggle:hover {
    text-decoration: underline;
}

.review-contact-email {
    font-size: 13px;
    color: var(--page-accent, #2563eb);
    text-decoration: none;
}

.review-contact-email:hover {
    text-decoration: underline;
}

/* SP Response */
.review-card-response {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 4px;
    border-left: 3px solid var(--page-accent, #2563eb);
}

.review-response-header {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--page-text-secondary, #6b7280);
    margin-bottom: 4px;
}

.review-response-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--page-text-secondary, #4b5563);
    margin: 0;
    white-space: pre-line;
    word-break: break-word;
}

/* ===========================================
   Form Panel (replaces modal content when open)
   =========================================== */

.review-form-overlay {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.review-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}

.review-form-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--page-text-primary, #1f2937);
    margin: 0;
}

.review-form-subtitle {
    font-size: 14px;
    color: var(--page-text-muted, #9ca3af);
    margin: 0;
}

.review-form-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.review-form-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.review-form-row {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.review-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.review-form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--page-text-primary, #1f2937);
}

.review-required {
    color: #ef4444;
}

.review-optional {
    font-weight: 400;
    color: var(--page-text-muted, #9ca3af);
}

.review-form-input {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--page-text-primary, #1f2937);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
}

.review-form-input:focus {
    outline: none;
    border-color: var(--page-accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.review-form-hint {
    font-size: 12px;
    color: var(--page-text-muted, #9ca3af);
    line-height: 1.4;
}

.review-form-textarea {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--page-text-primary, #1f2937);
    background: #fff;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
}

.review-form-textarea:focus {
    outline: none;
    border-color: var(--page-accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.review-form-char-count {
    font-size: 11px;
    color: var(--page-text-muted, #9ca3af);
    text-align: right;
}

.review-form-error {
    font-size: 13px;
    color: #ef4444;
}

.review-form-submit-error {
    padding: 10px 14px;
    margin: 0 20px 12px;
    border-radius: 8px;
    font-size: 13px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    line-height: 1.4;
    flex-shrink: 0;
}

/* Star rating in form */
.review-form-stars {
    display: flex;
    gap: 6px;
}

.review-form-star {
    fill: #e5e7eb;
    stroke: #d1d5db;
    cursor: pointer;
    transition: fill 0.1s ease, stroke 0.1s ease, transform 0.1s ease;
}

.review-form-star.filled {
    fill: #f59e0b;
    stroke: #f59e0b;
}

.review-form-star:hover {
    transform: scale(1.12);
}

/* Upload */
.review-form-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.review-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--page-text-secondary, #6b7280);
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.review-upload-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.review-upload-hint {
    font-size: 12px;
    color: var(--page-text-muted, #9ca3af);
}

.review-form-previews {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.review-preview-item {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

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

.review-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.review-preview-remove:hover {
    background: rgba(0, 0, 0, 0.75);
}

/* Checkbox */
.review-form-checkbox-group {
    gap: 4px;
}

.review-form-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    color: var(--page-text-primary, #1f2937);
    cursor: pointer;
    line-height: 1.4;
}

.review-form-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--page-accent, #2563eb);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Footer */
.review-form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

.review-form-cancel {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--page-text-secondary, #6b7280);
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
}

.review-form-cancel:hover {
    background: #f3f4f6;
}

.review-form-submit {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--page-accent, #2563eb);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s ease;
}

.review-form-submit:hover {
    opacity: 0.92;
}

.review-form-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ===========================================
   Success Overlay
   =========================================== */

.review-success-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}

.review-success-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 24px;
    max-width: 360px;
}

.review-success-icon {
    margin-bottom: 14px;
}

.review-success-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--page-text-primary, #1f2937);
    margin: 0 0 8px;
}

.review-success-text {
    font-size: 14px;
    color: var(--page-text-secondary, #6b7280);
    line-height: 1.6;
    margin: 0 0 18px;
}

.review-success-hints {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 22px;
}

.review-success-hint {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--page-text-secondary, #6b7280);
}

.review-success-hint svg {
    flex-shrink: 0;
}

.review-success-close {
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--page-accent, #2563eb);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s ease;
}

.review-success-close:hover {
    opacity: 0.92;
}

/* ===========================================
   Review Image Lightbox
   =========================================== */

.review-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.review-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 2;
}

.review-lightbox-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.review-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 6px;
}

/* ===========================================
   Mobile-specific tweaks
   =========================================== */

@media screen and (max-width: 479px) {
    .reviews-summary {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .reviews-summary-left {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .reviews-summary-number {
        font-size: 32px;
    }

    .reviews-summary-stars {
        align-items: flex-start;
    }

    .review-card {
        padding: 14px;
    }

    .review-card-top {
        flex-direction: column;
        gap: 6px;
    }

    .review-card-stars {
        margin-top: 0;
    }

    .review-card-img-wrapper {
        width: 56px;
        height: 56px;
    }

    .review-form-footer {
        flex-direction: column;
    }

    .review-form-cancel,
    .review-form-submit {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ===========================================
   Desktop (768px+)
   =========================================== */

@media screen and (min-width: 768px) {
    .page-modal-reviews {
        max-width: 620px;
        max-height: none;
    }

    .reviews-summary-number {
        font-size: 38px;
    }

    .reviews-summary-left {
        min-width: 80px;
    }

    .reviews-leave-btn {
        width: auto;
    }

    .review-card {
        padding: 18px;
    }

    .review-card-img-wrapper {
        width: 72px;
        height: 72px;
    }

    .review-form-header {
        padding: 20px 24px;
    }

    .review-form-body {
        padding: 18px 24px;
    }

    .review-form-row {
        flex-direction: row;
        gap: 14px;
    }

    .review-form-row > .review-form-group {
        flex: 1;
        min-width: 0;
    }

    .review-form-footer {
        padding: 14px 24px;
    }
}
