/* ============================================================
   reviews.css — Review & Rating System styles
   durianpenang.com — Tailwind-compatible custom layer
   ============================================================ */

/* ── Avatar circle ─────────────────────────────────────────── */
.avatar-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

/* Deterministic color palette keyed by first letter */
.avatar-a, .avatar-b { background-color: #15803d; }
.avatar-c, .avatar-d { background-color: #b45309; }
.avatar-e, .avatar-f { background-color: #0369a1; }
.avatar-g, .avatar-h { background-color: #7c3aed; }
.avatar-i, .avatar-j { background-color: #be185d; }
.avatar-k, .avatar-l { background-color: #0891b2; }
.avatar-m, .avatar-n { background-color: #16a34a; }
.avatar-o, .avatar-p { background-color: #dc2626; }
.avatar-q, .avatar-r { background-color: #d97706; }
.avatar-s, .avatar-t { background-color: #6d28d9; }
.avatar-u, .avatar-v { background-color: #0e7490; }
.avatar-w, .avatar-x { background-color: #b91c1c; }
.avatar-y, .avatar-z { background-color: #047857; }
.avatar-default      { background-color: #4b5563; }

/* ── Review card ───────────────────────────────────────────── */
.review-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s;
}
.review-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* ── Star display (static, read-only) ─────────────────────── */
.star-display {
    display: inline-flex;
    gap: 2px;
}
.star-display svg { width: 1rem; height: 1rem; }

/* ── Interactive star rating input ────────────────────────── */
.star-input-group {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
}
.star-input-group input[type="radio"] {
    display: none;
}
.star-input-group label {
    cursor: pointer;
    font-size: 1.75rem;
    color: #d1d5db;
    line-height: 1;
    transition: color 0.15s;
}
.star-input-group label:hover,
.star-input-group label:hover ~ label,
.star-input-group input:checked ~ label {
    color: #f59e0b;
}

/* ── Metric slider (range input) ──────────────────────────── */
.metric-slider-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    min-width: 0;
    overflow: hidden;
}
.metric-slider-wrap input[type="range"] {
    flex: 1;
    min-width: 0;
    accent-color: #15803d;
    height: 4px;
    cursor: pointer;
}
.metric-slider-wrap input[type="range"]:disabled {
    cursor: default;
    opacity: 0.9;
}
.metric-value-badge {
    min-width: 2rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 9999px;
    padding: 0 0.4rem;
}

/* ── Summary widget ────────────────────────────────────────── */
.review-summary {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.review-summary .avg-score {
    font-size: 3rem;
    font-weight: 800;
    color: #166534;
    line-height: 1;
}
.dist-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
}
.dist-bar-bg {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}
.dist-bar-fill {
    height: 100%;
    background: #f59e0b;
    border-radius: 9999px;
    transition: width 0.6s ease;
}
.dist-pct {
    min-width: 2.5rem;
    text-align: right;
    color: #6b7280;
}

/* ── Expand/collapse toggle ───────────────────────────────── */
.review-body-truncated {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}
.review-body-truncated.expanded {
    -webkit-line-clamp: unset;
    display: block;
}
.expand-toggle {
    background: none;
    border: none;
    color: #15803d;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-top: 0.25rem;
}
.expand-toggle:hover { text-decoration: underline; }

/* ── Helpful buttons ─────────────────────────────────────── */
.helpful-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    padding: 0.2rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    color: #374151;
}
.helpful-btn:hover { border-color: #15803d; color: #15803d; }
.helpful-btn.voted-yes { background: #f0fdf4; border-color: #15803d; color: #166534; }
.helpful-btn.voted-no  { background: #fef2f2; border-color: #dc2626; color: #991b1b; }
.helpful-btn:disabled  { opacity: 0.6; cursor: default; }

/* ── Pros/Cons pills ─────────────────────────────────────── */
.pros-pill {
    display: inline-block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 9999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0.15rem 0.1rem;
}
.cons-pill {
    display: inline-block;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 9999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0.15rem 0.1rem;
}

/* ── Verified badge ─────────────────────────────────────── */
.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 9999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 600;
}

/* ── Submission form ─────────────────────────────────────── */
.review-form-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.review-form-section h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #166534;
    margin-bottom: 1rem;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.35rem;
}
.form-group .required-star { color: #dc2626; }
.form-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.form-input:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
}
.form-textarea {
    resize: vertical;
    min-height: 5rem;
}

/* ── Image upload zone ───────────────────────────────────── */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #f9fafb;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: #16a34a;
    background: #f0fdf4;
}
.upload-zone input[type="file"] { display: none; }
.upload-zone .upload-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.image-preview-item {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    aspect-ratio: 1;
}
.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-preview-item .remove-img {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 9999px;
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Form submit button ──────────────────────────────────── */
.submit-review-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #166534;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.65rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}
.submit-review-btn:hover { background: #15803d; }
.submit-review-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Alert messages ─────────────────────────────────────── */
.review-alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: none;
}
.review-alert.show { display: block; }
.review-alert.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.review-alert.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Review image thumbnails in feed ────────────────────── */
.review-image-thumb {
    width: 4.5rem;
    height: 4.5rem;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    cursor: pointer;
}

/* ── Seed size radio buttons ─────────────────────────────── */
.seed-radio-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.seed-radio-option {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}
.seed-radio-option input[type="radio"] { accent-color: #15803d; }

/* ── Empty state ─────────────────────────────────────────── */
.review-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
}
.review-empty .empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
