/*
 * Kanata AI Surveys — Feedback survey (front end).
 *
 * Builds on assets/css/kanata-ai-surveys-base.css and its --kas-* custom
 * properties. The default accent (--kas-accent, Sovereign Red #E23838) is
 * used only as an accent: the submit button, the active/hover star, the
 * required mark, and a 3px top border on the slide-in panel. Everything else
 * defaults to Inuksuk Grey on Off-White so the widget reads as part of the
 * site — all of it overridable per install. See base.css and README.md
 * "Theming".
 */

/* screen-reader-only utility (WP core also ships this; safe to redefine) */
.kanata-ai-feedback-form .screen-reader-text,
.kanata-ai-feedback-panel .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Slide-in panel ===== */
.kanata-ai-feedback-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 340px;
    max-width: calc(100vw - 40px);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 99999;
    background: var(--kas-bg-subtle, #FBF7F0);
    color: var(--kas-text, #3D3D3D);
    border: 1px solid var(--kas-border, rgba(61, 61, 61, 0.12));
    border-top: 3px solid var(--kas-accent, #E23838);
    border-radius: var(--kas-radius, 12px);
    box-shadow: 0 8px 30px rgba(42, 42, 42, 0.18);
    padding: 20px;
    font-family: var(--kas-font-body, 'Inter', sans-serif);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.32s ease, transform 0.32s ease;
}

.kanata-ai-feedback-panel.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.kanata-ai-feedback-panel[hidden] {
    display: none;
}

.kanata-ai-fb-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    line-height: 30px;
    text-align: center;
    font-size: 20px;
    color: var(--kas-text, #3D3D3D);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.6;
}

.kanata-ai-fb-close:hover {
    opacity: 1;
    background: rgba(61, 61, 61, 0.08);
}

.kanata-ai-fb-panel-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-right: 28px;
}

.kanata-ai-fb-mark {
    flex-shrink: 0;
    display: block;
}

.kanata-ai-fb-panel-title {
    font-family: var(--kas-font-heading, 'Fredoka', sans-serif);
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.25;
    margin: 0;
    color: var(--kas-text, #3D3D3D);
    outline: none;
}

.kanata-ai-fb-panel-sub {
    margin: 2px 0 0;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ===== Shortcode header ===== */
.kanata-ai-fb-shortcode-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.kanata-ai-fb-shortcode-head .kanata-ai-title {
    margin: 0;
}

/* ===== Questions ===== */
.kanata-ai-fb-question {
    margin-bottom: 18px;
}

.kanata-ai-fb-q-label {
    font-weight: 600;
    font-size: 0.92rem;
    margin: 0 0 8px;
    color: var(--kas-text, #3D3D3D);
}

.kanata-ai-fb-req {
    color: var(--kas-accent, #E23838);
    margin-left: 2px;
}

.kanata-ai-fb-textarea {
    min-height: 72px;
    font-family: var(--kas-font-body, 'Inter', sans-serif);
    resize: vertical;
}

/* ===== Star rating ===== */
.kanata-ai-fb-stars {
    border: 0;
    padding: 0;
    margin: 0;
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 4px;
}

.kanata-ai-fb-star-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.kanata-ai-fb-star {
    font-size: 1.7rem;
    line-height: 1;
    color: rgba(61, 61, 61, 0.25);
    cursor: pointer;
    transition: color 0.12s ease;
}

/* fill the hovered star and every star after it (earlier in DOM = to its left visually) */
.kanata-ai-fb-stars.is-hovering .kanata-ai-fb-star:hover,
.kanata-ai-fb-stars.is-hovering .kanata-ai-fb-star:hover ~ .kanata-ai-fb-star,
.kanata-ai-fb-star-input:checked,
.kanata-ai-fb-star-input:checked ~ .kanata-ai-fb-star {
    color: var(--kas-accent, #E23838);
}

.kanata-ai-fb-star-input:checked ~ .kanata-ai-fb-star {
    color: var(--kas-accent, #E23838);
}

.kanata-ai-fb-star-input:focus-visible + .kanata-ai-fb-star {
    outline: 2px solid var(--kas-text, #3D3D3D);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ===== Choice lists ===== */
.kanata-ai-fb-choices {
    border: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kanata-ai-fb-choice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.kanata-ai-fb-choice input {
    margin-top: 3px;
    accent-color: var(--kas-accent, #E23838);
}

.kanata-ai-fb-other-text {
    margin-top: 6px;
}

.kanata-ai-fb-other-text[hidden] {
    display: none;
}

/* ===== Contact block ===== */
.kanata-ai-fb-contact {
    border: 1px solid var(--kas-border, rgba(61, 61, 61, 0.12));
    border-radius: 10px;
    padding: 12px 14px;
    margin: 16px 0;
}

.kanata-ai-fb-contact legend {
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0 4px;
}

.kanata-ai-fb-contact-hint {
    margin: 0 0 8px;
    font-size: 0.78rem;
    opacity: 0.7;
}

.kanata-ai-fb-contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* ===== Honeypot ===== */
.kanata-ai-fb-hp {
    position: absolute !important;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===== Actions / status ===== */
.kanata-ai-fb-actions {
    margin-top: 14px;
}

.kanata-ai-fb-submit {
    width: 100%;
    justify-content: center;
}

.kanata-ai-fb-status {
    margin-top: 10px;
    font-size: 0.85rem;
    min-height: 1.2em;
}

.kanata-ai-fb-status.is-error {
    color: var(--kas-accent, #E23838);
}

.kanata-ai-fb-thanks {
    font-family: var(--kas-font-heading, 'Fredoka', sans-serif);
    font-size: 1rem;
    color: var(--kas-text, #3D3D3D);
    margin: 8px 0;
}

/* ===== Mobile: dock as a bottom sheet ===== */
@media (max-width: 480px) {
    .kanata-ai-feedback-panel {
        right: 0;
        left: 0;
        bottom: 0;
        width: auto;
        max-width: none;
        max-height: 80vh;
        border-radius: 12px 12px 0 0;
        transform: translateY(100%);
    }

    .kanata-ai-feedback-panel.is-visible {
        transform: translateY(0);
    }

    .kanata-ai-fb-contact-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    .kanata-ai-feedback-panel {
        transition: none;
    }
}

/*
 * No @media (prefers-color-scheme: dark) block: the slide-in panel always
 * renders on --kas-bg-subtle (Off-White #FBF7F0 by default) so it matches
 * the site, which is assumed to stay light regardless of the visitor's OS
 * setting — a site with a dark theme should override --kas-bg-subtle (and
 * --kas-text/--kas-surface) via the kanata_ai_surveys_theme filter rather
 * than relying on an OS-level dark-mode media query here. A panel-scoped
 * dark variant was tried in the original (forked-from) plugin and removed
 * because it fired on OS dark mode even while the surrounding page stayed
 * light — kept out here for the same reason.
 */
