/* ==========================================================================
   Formulaire « Donner mon avis » de la fiche produit
   Markup : views/products/detail.php — logique : js/product-review.js
   (Le bouton d'ouverture, .pd-contact-btn-review, est dans
   product-detail-redesign.css avec les autres boutons de contact.)
   ========================================================================== */

/* Bouton secondaire dans l'onglet « Avis » */
.pd-review-cta {
    margin-top: 1rem;
}

.pd-review-inline-btn {
    padding: 0.55rem 1.1rem;
    border: 2px solid var(--primary-color, #d6336c);
    border-radius: 999px;
    background: transparent;
    color: var(--primary-color, #d6336c);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pd-review-inline-btn:hover {
    background: var(--primary-color, #d6336c);
    color: #fff;
}

.pd-contact-btn-review:hover {
    background: var(--primary-color, #d6336c);
    color: #fff;
}


/* Fenêtre
   -------------------------------------------------------------------------- */
.pr-modal {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pr-modal[hidden] {
    display: none;
}

.pr-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.pr-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.pr-card {
    position: relative;
    width: min(100%, 480px);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    padding: 1.75rem 1.5rem 1.25rem;
    border-radius: 16px;
    background: var(--bg-primary, #fff);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    color: var(--text-primary, #1f2937);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.25s ease;
}

.pr-modal.is-open .pr-card {
    transform: none;
}

.pr-close {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--bg-secondary, #f1f5f9);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pr-close:hover {
    background: var(--primary-color, #d6336c);
    color: #fff;
}

.pr-title {
    margin: 0;
    padding-right: 2rem;
    font-size: 1.35rem;
    line-height: 1.25;
}

.pr-subtitle {
    margin: 0.2rem 0 1.1rem;
    color: var(--text-secondary, #64748b);
    font-size: 0.88rem;
}


/* Champs
   -------------------------------------------------------------------------- */
.pr-field {
    margin: 0 0 0.9rem;
    padding: 0;
    border: none;
}

.pr-label {
    display: block;
    margin: 0 0 0.3rem;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.pr-required {
    color: #dc2626;
}

.pr-optional {
    color: var(--text-secondary, #94a3b8);
    font-weight: 400;
}

.pr-input {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    background: var(--bg-primary, #fff);
    color: inherit;
    font-family: inherit;
    font-size: 0.92rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pr-input:focus {
    border-color: var(--primary-color, #d6336c);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color, #d6336c) 20%, transparent);
    outline: none;
}

.pr-input.has-error {
    border-color: #dc2626;
}

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

.pr-counter {
    margin-top: 0.2rem;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.75rem;
    text-align: right;
}

.pr-error,
.pr-form-error {
    margin: 0.3rem 0 0;
    color: #dc2626;
    font-size: 0.8rem;
}

.pr-error:empty {
    display: none;
}

.pr-form-error {
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background: #fef2f2;
}

/* Champ piège hors de l'écran (pas display:none : certains robots l'ignorent) */
.pr-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.pr-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}


/* Note en étoiles
   Les boutons radio sont rendus de 5 à 1 et affichés en ligne inversée : le
   sélecteur « ~ » remplit alors les étoiles de gauche jusqu'à celle visée.
   -------------------------------------------------------------------------- */
.pr-stars {
    position: relative;   /* les cases cachées restent dans le groupe d'étoiles */
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 0.15rem;
}

.pr-stars input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pr-stars label {
    color: #d1d5db;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
}

.pr-stars label:hover,
.pr-stars label:hover ~ label,
.pr-stars input:checked ~ label {
    color: #f4b400;
}

.pr-stars label:hover {
    transform: scale(1.12);
}

.pr-stars input:focus-visible + label {
    outline: 2px solid var(--primary-color, #d6336c);
    outline-offset: 2px;
    border-radius: 4px;
}


/* Boutons
   -------------------------------------------------------------------------- */
.pr-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.1rem;
}

.pr-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.pr-btn-primary {
    background: var(--primary-color, #d6336c);
    color: #fff;
}

.pr-btn-secondary {
    border-color: var(--border-color, #e2e8f0);
    background: transparent;
    color: var(--text-primary, #374151);
}

.pr-btn:hover:not(:disabled) {
    filter: brightness(0.94);
}

.pr-btn:disabled {
    cursor: wait;
    opacity: 0.65;
}

.pr-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary-color, #d6336c) 45%, transparent);
    outline-offset: 2px;
}

.pr-note {
    margin: 0.8rem 0 0;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.75rem;
    text-align: center;
}


/* Confirmation
   -------------------------------------------------------------------------- */
.pr-success {
    padding: 1rem 0.5rem 0.5rem;
    text-align: center;
}

.pr-success[hidden] {
    display: none;
}

.pr-success .pr-title {
    padding-right: 0;
}

.pr-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin-bottom: 0.7rem;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
}

.pr-success-text {
    margin: 0.5rem 0 1.3rem;
    color: var(--text-secondary, #64748b);
    font-size: 0.95rem;
    line-height: 1.5;
}

.pr-success .pr-btn {
    flex: none;
    min-width: 160px;
}


/* Thème sombre et mouvement réduit
   -------------------------------------------------------------------------- */
[data-theme="dark"] .pr-card {
    background: #1e293b;
    color: #e2e8f0;
}

[data-theme="dark"] .pr-input {
    border-color: #475569;
    background: #0f172a;
}

[data-theme="dark"] .pr-form-error {
    background: rgba(220, 38, 38, 0.15);
}

[data-theme="dark"] .pr-stars label {
    color: #475569;
}

@media (prefers-reduced-motion: reduce) {
    .pr-modal,
    .pr-card,
    .pr-stars label {
        transition: none;
    }
}

@media (max-width: 480px) {
    .pr-actions {
        flex-direction: column-reverse;
    }
}
