/* reviews/assets/css/reviews.css */

/* ==========================================
   1. LAYOUT & RESPONSIVENESS
   ========================================== */
.reviews-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-top: 40px;
    font-family: var(--font-body);
}

/* Single-column layout on desktop */
@media (min-width: 992px) {
    .reviews-container {
        grid-template-columns: 1fr;
        align-items: start;
    }
}

/* Left panel containing stats and reviews list */
.reviews-main-panel {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Full-width review form panel — aligns with global container */
.reviews-side-panel {
    position: relative;
    max-width: 100%;
    width: 100%;
    margin: 40px 0 0 0;
}

/* ==========================================
   2. STATISTICS DASHBOARD CARD
   ========================================== */
.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    align-items: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stats-card:hover {
    box-shadow: var(--shadow-md);
}

@media (min-width: 600px) {
    .stats-card {
        grid-template-columns: 1fr 1.5fr;
        gap: 40px;
    }
}

/* Total score panel */
.stats-score-panel {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 20px;
}

@media (min-width: 600px) {
    .stats-score-panel {
        padding-bottom: 0;
        border-right: 1px solid var(--border-color);
        padding-right: 40px;
    }
}

.stats-score-num {
    font-size: clamp(3.5rem, 5vw, 4.5rem);
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--brand-green);
    line-height: 1;
    margin-bottom: 8px;
}

[data-theme="dark"] .stats-score-num {
    color: var(--brand-gold);
}

.stats-score-stars {
    display: flex;
    gap: 4px;
    color: var(--brand-gold);
    margin-bottom: 12px;
}

.stats-score-stars svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.stats-score-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Progress bars distribution list */
.stats-bars-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stats-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.stats-bar-label {
    width: 65px;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.stats-bar-label svg {
    width: 14px;
    height: 14px;
    fill: var(--brand-gold);
}

.stats-bar-container {
    flex-content: '';
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-full);
    overflow: hidden;
    position: relative;
}

.stats-bar-fill {
    height: 100%;
    background: var(--gradient-gold);
    border-radius: var(--border-radius-full);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-bar-percent {
    width: 35px;
    text-align: right;
    font-weight: 700;
    color: var(--text-primary);
}

/* ==========================================
   3. SORT & FILTER HEADER
   ========================================== */
.reviews-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-top: 10px;
}

.reviews-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-primary);
}

.sort-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-select-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sort-select {
    padding: 8px 32px 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sort-select:focus {
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 3px rgba(207, 163, 58, 0.15);
}

.sort-select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-secondary);
    pointer-events: none;
}

/* ==========================================
   4. REVIEW CARDS & LIST
   ========================================== */
.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 200px;
}

.review-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    animation: fadeInUp 0.5s ease-out;
}

.review-card:hover {
    transform: translateY(-4px);
    border-color: rgba(207, 163, 58, 0.3);
    box-shadow: var(--shadow-md);
}

/* Review card header elements */
.review-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.review-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Circular Avatar styles */
.review-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-light) 100%);
    color: var(--brand-cream);
    font-weight: 700;
    font-size: 1.1rem;
    font-family: var(--font-heading);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.review-avatar.avatar-initials-2 {
    background: linear-gradient(135deg, #1C5836 0%, #153E23 100%);
}
.review-avatar.avatar-initials-3 {
    background: linear-gradient(135deg, #7E5F1E 0%, #B68625 100%);
}
.review-avatar.avatar-initials-4 {
    background: linear-gradient(135deg, #1A4652 0%, #0C2B34 100%);
}

.review-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.review-user-meta {
    display: flex;
    flex-direction: column;
}

.review-user-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.review-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Rating display in card */
.review-rating {
    display: flex;
    gap: 2px;
    color: var(--brand-gold);
}

.review-rating svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.review-rating svg.star-empty {
    color: var(--border-color);
}

/* Review content */
.review-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.review-card-message {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    word-break: break-word;
}

/* Empty review state */
.reviews-empty {
    text-align: center;
    padding: 60px 40px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    color: var(--text-secondary);
}

.reviews-empty svg {
    width: 48px;
    height: 48px;
    fill: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.6;
}

.reviews-empty h3 {
    font-size: 1.08rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.reviews-empty p {
    font-size: 0.9rem;
}

/* ==========================================
   5. REVIEW SUBMISSION FORM CARD
   ========================================== */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast);
}

.form-card:hover {
    box-shadow: var(--shadow-md);
}

.form-card-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.review-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.form-group-full {
    grid-column: span 2;
}

@media (max-width: 767px) {
    .review-form {
        grid-template-columns: 1fr;
    }
    .form-group-full {
        grid-column: span 1;
    }
}

.form-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.form-label span {
    color: var(--accent-red);
}

.form-control {
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: var(--font-body);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.form-control:focus {
    border-color: var(--brand-gold);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(207, 163, 58, 0.15);
}

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

/* Star Rating Input control */
.star-input-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.star-rating-widget {
    display: flex;
    flex-direction: row-reverse; /* Reversing handles hover-preceding logic cleanly in CSS */
    justify-content: flex-end;
    gap: 6px;
}

.star-radio {
    display: none;
}

.star-label {
    cursor: pointer;
    color: var(--border-color);
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.star-label svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
    display: block;
}

.star-label:hover,
.star-label:hover ~ .star-label,
.star-radio:checked ~ .star-label {
    color: var(--brand-gold);
}

.star-label:hover {
    transform: scale(1.15);
}

.star-rating-hint {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brand-gold-hover);
    min-width: 80px;
}

/* Custom Image Upload Input styles */
.upload-btn-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-file-upload {
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 700;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-file-upload:hover {
    background: var(--border-color);
    border-color: var(--text-muted);
}

.btn-file-upload svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.upload-btn-wrapper input[type=file] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 120px;
    height: 40px;
    cursor: pointer;
}

.file-upload-preview {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    overflow: hidden;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.file-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-upload-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Honeypot field (spam prevention) */
.form-honeypot {
    display: none !important;
}

/* Validation Inline Error */
.invalid-feedback {
    display: none;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-red);
    margin-top: 4px;
    animation: fadeInDown var(--transition-fast) ease-out;
}

.form-group.has-error .form-control {
    border-color: var(--accent-red);
}

.form-group.has-error .invalid-feedback {
    display: block;
}

/* Submit review button */
.btn-submit-review {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--border-radius-sm);
    border: none;
    background: var(--gradient-gold);
    color: var(--brand-charcoal);
    box-shadow: var(--shadow-btn);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.btn-submit-review:hover {
    background: var(--gradient-gold-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(207, 163, 58, 0.4);
}

.btn-submit-review:active {
    transform: translateY(0);
}

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

/* Loading spinner in button */
.btn-submit-review .btn-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(18, 26, 22, 0.15);
    border-radius: 50%;
    border-top-color: var(--brand-charcoal);
    animation: spin 0.8s linear infinite;
    display: none;
}

.btn-submit-review.loading .btn-spinner {
    display: block;
}
.btn-submit-review.loading .btn-text {
    display: none;
}

/* ==========================================
   6. PREMIUM NOTIFICATION TOAST
   ========================================== */
.review-toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.review-toast {
    pointer-events: auto;
    background: var(--bg-card);
    border-left: 4px solid var(--accent-green);
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-sm);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 400px;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    opacity: 0;
}

.review-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.review-toast.toast-error {
    border-left-color: var(--accent-red);
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.review-toast .toast-icon {
    background-color: var(--accent-green-bg);
    color: var(--accent-green);
}

.review-toast.toast-error .toast-icon {
    background-color: rgba(192, 57, 43, 0.1);
    color: var(--accent-red);
}

.toast-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.toast-message {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

/* ==========================================
   7. KEYFRAMES & UTILITIES
   ========================================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skeleton Loading Animation */
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.skeleton-item {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-color) 37%, var(--bg-secondary) 63%);
    background-size: 400% 100%;
    animation: skeleton-glow 1.4s ease infinite;
    border-radius: var(--border-radius-sm);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-text-lg {
    width: 150px;
    height: 18px;
}

.skeleton-text-sm {
    width: 100px;
    height: 12px;
}

.skeleton-title {
    width: 250px;
    height: 20px;
    margin-top: 8px;
}

.skeleton-line {
    width: 100%;
    height: 14px;
}
.skeleton-line-short {
    width: 75%;
    height: 14px;
}

@keyframes skeleton-glow {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==========================================
   8. MOBILE RESPONSIVE ALIGNMENT FIXES
   ========================================== */
@media (max-width: 575px) {
    .reviews-container {
        gap: 24px;
        margin-top: 24px;
    }

    .stats-card {
        padding: 20px 16px;
        gap: 20px;
    }

    .stats-score-panel {
        padding-bottom: 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .stats-bar-row {
        gap: 8px;
        font-size: 0.82rem;
    }

    .stats-bar-label {
        width: 46px;
    }

    .stats-bar-percent {
        width: 32px;
    }

    .reviews-side-panel {
        margin-top: 24px;
    }

    .review-card {
        padding: 18px 14px;
    }

    .review-card-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .form-card {
        padding: 20px 16px;
    }

    .star-input-container {
        flex-wrap: wrap;
        gap: 8px;
    }

    .star-rating-hint {
        min-width: auto;
    }

    .upload-btn-wrapper {
        flex-wrap: wrap;
        gap: 10px;
    }

    .file-upload-name {
        max-width: 140px;
    }

    .reviews-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .reviews-empty {
        padding: 36px 20px;
    }
}
