/* ============================================================================
   TR-HELPFUL — shared "was this helpful?" feedback widget
   ----------------------------------------------------------------------------
   Promoted verbatim from modules/resource/assets/css/resource-helpful.css,
   where it shipped as `.resource-helpful` / `.resource-helpful-modal`. Every
   declaration below is the value that file carried; the class name moves onto
   the `tr-*` shared namespace required by CLAUDE.md 9.4a.

   Two rules that used to live as page-scoped overrides in single-resource.css
   (`.single-resource .tool-content__sidebar .resource-helpful`) are now the
   `--stacked` modifier, so a sidebar consumer asks for the vertical layout by
   name instead of every page re-deriving it from a descendant selector.

   Consumers: single Resource, single AI Tool, single AI Prompt,
   single Glossary Term.
   Enqueued by tiorai_enqueue_unified_helpful() — single views only.
   ========================================================================== */

.content-section--helpful {
    padding: var(--space-4) 0 !important;
    margin-bottom: 0 !important;
    border: none !important;
}

/* Declared for the same reason as `.tr-share-card` — see share-card.css. */
.tr-helpful {
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-default);
    background: var(--surface-card);
    border: 1px solid var(--border-default);
}

/*
 * Sidebar / rail layout. Identical to what the Resource sticky sidebar produced
 * through a descendant override; expressed as a modifier so Prompt and Glossary
 * get the same box without repeating the selector.
 */
.tr-helpful--stacked {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
}

.tr-helpful--stacked .tr-helpful__actions {
    justify-content: center;
}

.tr-helpful__label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.tr-helpful__actions {
    display: flex;
    gap: var(--space-3);
}

.tr-helpful__btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tr-helpful__btn:hover {
    transform: translateY(-1px);
}

.tr-helpful__btn--yes {
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
}

.tr-helpful__btn--yes:hover {
    border-color: var(--color-success);
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.12);
}

.tr-helpful__btn--no {
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.tr-helpful__btn--no:hover {
    border-color: var(--color-danger);
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.12);
}

.tr-helpful__btn--yes.tr-helpful__btn--voted {
    border-color: var(--color-success);
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.18);
}

.tr-helpful__btn--no.tr-helpful__btn--voted {
    border-color: var(--color-danger);
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.18);
}

/*
 * The non-selected button is dimmed once a vote exists. This used to be set
 * from JavaScript as an inline `style.opacity`, which meant the resting state
 * of the component lived in a script rather than in this file and could not be
 * seen or overridden from CSS. The runtime now toggles the class and the value
 * is declared here.
 */
.tr-helpful__btn--muted {
    opacity: 0.5;
}

.tr-helpful__btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tr-helpful__count {
    font-size: 0.75rem;
    min-width: 16px;
    text-align: center;
}

/* ── Feedback Modal (extends .ui-modal) ─────────────────────────────────── */

.tr-helpful-modal__content {
    --ui-modal-width: 560px;
    background: var(--surface-base);
    border: 1px solid var(--border-default);
}

.tr-helpful-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-default);
}

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

.tr-helpful-modal__close {
    width: 32px;
    height: 32px;
    color: var(--color-text-secondary);
    border-radius: 50%;
}

.tr-helpful-modal__close:hover {
    background: var(--surface-card);
    color: var(--color-text-primary);
}

.tr-helpful-modal__body {
    padding: var(--space-6);
}

@media (max-width: 768px) {
    .tr-helpful {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }

    .tr-helpful-modal__body {
        padding: var(--space-4);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tr-helpful__btn {
        transition: none;
    }

    .tr-helpful__btn:hover {
        transform: none;
    }
}
