/* ============================================================================
   PC Kompas Reviews — Professional review section
   Inspired by bol.com: clean, data-forward, trustworthy.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. Custom Properties
   ---------------------------------------------------------------------------- */

.pkrv-reviews,
.pkrv-modal {
    --pkrv-star: #F2A900;
    --pkrv-star-empty: var(--border);
    --pkrv-pro: #22c55e;
    --pkrv-con: #ef4444;
}

/* ----------------------------------------------------------------------------
   2. Star Summary (inline next to brand name)
   ---------------------------------------------------------------------------- */

.pkrv-star-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 2px;
    vertical-align: middle;
}

.pkrv-star-summary__sep {
    color: var(--text-muted);
    font-size: 0.875rem;
    user-select: none;
    line-height: 1;
}

.pkrv-star-summary__stars {
    display: inline-flex;
    gap: 1px;
    color: #F2A900;
    line-height: 0;
}

.pkrv-star-summary__stars svg {
    vertical-align: middle;
}

.pkrv-star-summary__rating {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.pkrv-star-summary__link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color 150ms ease;
}

.pkrv-star-summary__link:hover {
    text-decoration: underline;
}

/* ----------------------------------------------------------------------------
   3. Reviews Section Container
   ---------------------------------------------------------------------------- */

.pkrv-reviews {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
}

.pkrv-reviews__title {
    font-size: clamp(1.25rem, 2vw + 0.5rem, 1.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-lg);
}

/* ----------------------------------------------------------------------------
   4. Overview: Aggregate Score + Write Review Button
   ---------------------------------------------------------------------------- */

.pkrv-reviews__overview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.pkrv-reviews__score {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.pkrv-reviews__score-value {
    font-size: clamp(2.5rem, 4vw + 0.5rem, 3.5rem);
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.pkrv-reviews__score-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pkrv-reviews__score-stars {
    display: flex;
    gap: 2px;
    color: var(--pkrv-star);
}

.pkrv-reviews__score-stars svg {
    width: 20px;
    height: 20px;
}

.pkrv-reviews__score-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Write Review Button */
.pkrv-reviews__write-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background-color 150ms ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.pkrv-reviews__write-btn:hover {
    background: var(--accent-hover);
}

.pkrv-reviews__write-btn svg {
    flex-shrink: 0;
}

.pkrv-reviews__write-btn--outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.pkrv-reviews__write-btn--outline:hover {
    background: var(--accent-light);
}

/* ----------------------------------------------------------------------------
   5. Rating Breakdown Bars
   ---------------------------------------------------------------------------- */

.pkrv-reviews__breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 400px;
    margin-bottom: var(--space-lg);
}

.pkrv-reviews__breakdown-row {
    display: grid;
    grid-template-columns: 28px 1fr 28px;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.pkrv-reviews__breakdown-label {
    text-align: right;
    white-space: nowrap;
}

.pkrv-reviews__bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.pkrv-reviews__bar-fill {
    height: 100%;
    background: var(--pkrv-star);
    border-radius: 4px;
    transition: width 300ms ease;
}

.pkrv-reviews__breakdown-count {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------------------
   6. Toolbar: Review Count + Sort Dropdown
   ---------------------------------------------------------------------------- */

.pkrv-reviews__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-md);
}

.pkrv-reviews__toolbar-count {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pkrv-reviews__sort {
    position: relative;
}

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

.pkrv-reviews__sort-select {
    padding: 8px 36px 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 150ms ease;
}

.pkrv-reviews__sort-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ----------------------------------------------------------------------------
   7. Review Cards
   ---------------------------------------------------------------------------- */

.pkrv-card {
    padding: var(--space-lg) 0;
    border-bottom: 1px solid var(--border);
}

.pkrv-card:last-of-type {
    border-bottom: none;
}

/* Card Header — Avatar + Meta */
.pkrv-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.pkrv-card__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.pkrv-card__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pkrv-card__author {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.pkrv-card__date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Edit Button (own review) */
.pkrv-card__edit-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
    flex-shrink: 0;
}

.pkrv-card__edit-btn svg {
    width: 14px;
    height: 14px;
}

.pkrv-card__edit-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* Admin Delete Button */
.pkrv-card__delete-btn {
    margin-left: 0;
}

.pkrv-card__delete-btn:hover {
    border-color: var(--error);
    color: var(--error);
    background: var(--error-bg);
}

/* Stars Row */
.pkrv-card__stars {
    display: flex;
    align-items: center;
    gap: 1px;
    color: var(--pkrv-star);
    margin-bottom: var(--space-xs);
}

.pkrv-card__stars svg {
    width: 14px;
    height: 14px;
}

.pkrv-card__rating-text {
    margin-left: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Title + Content */
.pkrv-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 var(--space-xs);
    color: var(--text-primary);
}

.pkrv-card__content {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* ----------------------------------------------------------------------------
   8. Pros / Cons
   ---------------------------------------------------------------------------- */

.pkrv-card__proscons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.pkrv-card__proscons-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-xs);
}

.pkrv-card__pros .pkrv-card__proscons-label {
    color: var(--pkrv-pro);
}

.pkrv-card__cons .pkrv-card__proscons-label {
    color: var(--pkrv-con);
}

.pkrv-card__proscons ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pkrv-card__proscons-item {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 2px 0 2px 20px;
    position: relative;
}

.pkrv-card__proscons-item--pro::before {
    content: "+";
    position: absolute;
    left: 0;
    font-weight: 700;
    color: var(--pkrv-pro);
}

.pkrv-card__proscons-item--con::before {
    content: "\2212";
    position: absolute;
    left: 2px;
    font-weight: 700;
    color: var(--pkrv-con);
}

/* ----------------------------------------------------------------------------
   9. Vote Buttons (helpful / not helpful)
   ---------------------------------------------------------------------------- */

.pkrv-card__footer {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.pkrv-card__votes-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.pkrv-card__votes {
    display: flex;
    gap: var(--space-xs);
}

.pkrv-card__vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.pkrv-card__vote-btn svg {
    width: 14px;
    height: 14px;
}

.pkrv-card__vote-btn.is-active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.pkrv-card__vote-btn:hover:not(:disabled):not(.is-active) {
    border-color: var(--text-muted);
}

.pkrv-card__vote-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ----------------------------------------------------------------------------
   10. Pagination
   ---------------------------------------------------------------------------- */

.pkrv-reviews__pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg) 0;
}

.pkrv-reviews__page-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.pkrv-reviews__page-btn svg {
    width: 16px;
    height: 16px;
}

.pkrv-reviews__page-btn:hover:not(:disabled) {
    background: var(--bg-hover);
}

.pkrv-reviews__page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.pkrv-reviews__page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ----------------------------------------------------------------------------
   11. Loading, Empty & Notice States
   ---------------------------------------------------------------------------- */

.pkrv-reviews__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-2xl);
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.pkrv-reviews__spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pkrv-spin 0.6s linear infinite;
}

@keyframes pkrv-spin {
    to { transform: rotate(360deg); }
}

.pkrv-reviews__empty {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text-muted);
}

.pkrv-reviews__empty svg {
    margin-bottom: var(--space-md);
    opacity: 0.3;
}

.pkrv-reviews__empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-xs);
}

.pkrv-reviews__empty-text {
    font-size: 0.9375rem;
    margin: 0 0 var(--space-lg);
}

.pkrv-reviews__notice {
    text-align: center;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: var(--space-lg);
}

/* ----------------------------------------------------------------------------
   12. Review Modal — Overlay & Panel
   ---------------------------------------------------------------------------- */

.pkrv-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pkrv-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.pkrv-modal__panel {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    background: var(--bg-modal);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Transition: Fade (backdrop) */
.pkrv-fade-enter { transition: opacity 200ms ease-out; }
.pkrv-fade-start { opacity: 0; }
.pkrv-fade-end { opacity: 1; }
.pkrv-fade-leave { transition: opacity 150ms ease-in; }

/* Transition: Slide (panel) */
.pkrv-slide-enter { transition: all 200ms ease-out; }
.pkrv-slide-start { opacity: 0; transform: scale(0.95) translateY(10px); }
.pkrv-slide-end { opacity: 1; transform: scale(1) translateY(0); }
.pkrv-slide-leave { transition: all 150ms ease-in; }

/* Modal Header */
.pkrv-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--border);
}

.pkrv-modal__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.pkrv-modal__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 150ms ease, color 150ms ease;
    flex-shrink: 0;
}

.pkrv-modal__close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Modal Body (scrollable) */
.pkrv-modal__body {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

/* ----------------------------------------------------------------------------
   13. Modal Form Fields
   ---------------------------------------------------------------------------- */

.pkrv-modal__field {
    margin-bottom: var(--space-lg);
}

.pkrv-modal__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.pkrv-modal__optional {
    font-weight: 400;
    color: var(--text-muted);
}

/* Star Picker */
.pkrv-modal__star-select {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pkrv-modal__star-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--pkrv-star);
    line-height: 0;
    transition: transform 100ms ease;
}

.pkrv-modal__star-btn:hover {
    transform: scale(1.15);
}

.pkrv-modal__star-text {
    margin-left: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Text Inputs */
.pkrv-modal__input,
.pkrv-modal__textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color 150ms ease, box-shadow 150ms ease;
    box-sizing: border-box;
}

.pkrv-modal__input:focus,
.pkrv-modal__textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.pkrv-modal__input::placeholder,
.pkrv-modal__textarea::placeholder {
    color: var(--text-muted);
}

.pkrv-modal__textarea {
    resize: vertical;
    min-height: 100px;
}

.pkrv-modal__char-count {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Inline Field (pros/cons row) */
.pkrv-modal__inline-field {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.pkrv-modal__inline-field .pkrv-modal__input {
    flex: 1;
}

.pkrv-modal__remove-btn {
    width: 38px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 150ms ease, border-color 150ms ease;
}

.pkrv-modal__remove-btn:hover {
    color: var(--error);
    border-color: var(--error);
}

.pkrv-modal__add-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: var(--space-xs) 0;
    transition: color 150ms ease;
}

.pkrv-modal__add-btn:hover {
    text-decoration: underline;
}

/* Form Messages */
.pkrv-modal__msg {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: var(--space-md);
}

.pkrv-modal__msg--error {
    background: var(--error-bg);
    border: 1px solid var(--error);
    color: var(--error);
}

.pkrv-modal__msg--success {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: var(--success);
}

/* Submit Button */
.pkrv-modal__submit {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.pkrv-modal__submit:hover:not(:disabled) {
    background: var(--accent-hover);
}

.pkrv-modal__submit:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ----------------------------------------------------------------------------
   14. Reduced Motion
   ---------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .pkrv-reviews__bar-fill,
    .pkrv-modal__star-btn,
    .pkrv-card__vote-btn,
    .pkrv-reviews__page-btn,
    .pkrv-modal__submit,
    .pkrv-modal__close,
    .pkrv-modal__input,
    .pkrv-modal__textarea,
    .pkrv-modal__remove-btn,
    .pkrv-modal__add-btn,
    .pkrv-reviews__sort-select,
    .pkrv-reviews__write-btn,
    .pkrv-star-summary__link,
    .pkrv-card__edit-btn {
        transition: none;
    }

    .pkrv-reviews__spinner {
        animation: none;
    }

    .pkrv-slide-enter,
    .pkrv-slide-leave,
    .pkrv-fade-enter,
    .pkrv-fade-leave {
        transition: none;
    }
}

/* ----------------------------------------------------------------------------
   15. Responsive — Mobile (< 640px)
   ---------------------------------------------------------------------------- */

@media (max-width: 639px) {
    .pkrv-reviews__overview {
        flex-direction: column;
        align-items: flex-start;
    }

    .pkrv-reviews__write-btn {
        width: 100%;
        justify-content: center;
    }

    .pkrv-reviews__breakdown {
        max-width: 100%;
    }

    .pkrv-reviews__toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .pkrv-card__proscons {
        grid-template-columns: 1fr;
    }

    .pkrv-card__footer {
        flex-wrap: wrap;
    }

    .pkrv-modal {
        padding: 0;
    }

    .pkrv-modal__panel {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .pkrv-modal__body {
        padding: var(--space-md);
    }

    .pkrv-reviews__page-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
}
