/**
 * Comments Quick Rating — CSS
 * ----------------------------
 * Self-contained styles for the CQR widget.
 * No framework dependencies (UIkit, Bootstrap, etc.).
 * All selectors are .cqr_* namespaced to avoid collisions.
 *
 * @version 1.0.0
 */

/* === Base wrapper === */
.cqr_wrap {
    max-width: 640px;
    margin: 0 auto 1.5em auto;
    padding: 1.25em 1em;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cqr_wrap,
.cqr_wrap *,
.cqr_wrap *::before,
.cqr_wrap *::after {
    box-sizing: border-box;
}

/* === Headline === */
.cqr_headline {
    font-size: 1.15em;
    font-weight: bold;
    text-align: center;
    margin: 0 0 0.6em 0;
    color: #333;
}

/* === Stars row === */
.cqr_stars {
    display: flex;
    justify-content: center;
    gap: 6px;
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.cqr_star {
    color: #dcdcdc;
    transition: color .15s ease, transform .15s ease;
    padding: 4px 2px;
}

.cqr_star:hover,
.cqr_star.is_hover,
.cqr_star.is_active {
    color: #FCC54C;
}

.cqr_star.is_active {
    animation: cqr_star_pop .45s cubic-bezier(.34, 1.6, .64, 1) both;
}

.cqr_star:nth-child(1).is_active { animation-delay: 0s; }
.cqr_star:nth-child(2).is_active { animation-delay: 0.05s; }
.cqr_star:nth-child(3).is_active { animation-delay: 0.10s; }
.cqr_star:nth-child(4).is_active { animation-delay: 0.15s; }
.cqr_star:nth-child(5).is_active { animation-delay: 0.20s; }

@keyframes cqr_star_pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35) rotate(-6deg); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .cqr_star { transition: color .1s linear; animation: none !important; }
}

/* === Hint below stars === */
.cqr_hint {
    text-align: center;
    color: #888;
    font-size: 0.85em;
    margin: 0.4em 0 0 0;
    min-height: 1.2em;
}

/* === "Oder schreib einen Kommentar" link === */
.cqr_comment_link {
    text-align: center;
    margin: 0.5em 0 0 0;
    font-size: 0.9em;
}

.cqr_comment_link a {
    color: #09AEB3;
    text-decoration: none;
    cursor: pointer;
    transition: color .2s ease;
}

.cqr_comment_link a:hover {
    color: #077b7f;
    text-decoration: underline;
}

.cqr_wrap.cqr_form_visible .cqr_comment_link {
    display: none;
}

/* === Form area (revealed on star click or comment link) === */
.cqr_form_area {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .45s ease, opacity .35s ease, margin .35s ease;
    margin-top: 0;
}

.cqr_form_area.is_open {
    max-height: 2000px;
    opacity: 1;
    margin-top: 1.25em;
}

.cqr_form_inner {
    padding: 1em 0.2em 0 0.2em;
    border-top: 1px solid #eee;
}

.cqr_form_title {
    text-align: center;
    font-weight: bold;
    margin: 0 0 0.8em 0;
    color: #09AEB3;
}

/* === Form fields === */
.cqr_form_fields label {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 0.6em;
}

.cqr_form_fields input[type="text"],
.cqr_form_fields input[type="email"],
.cqr_form_fields textarea {
    width: 100%;
    padding: 0.6em 0.75em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    background: #fafafa;
    transition: border-color .2s ease, background .2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.cqr_form_fields input:focus,
.cqr_form_fields textarea:focus {
    border-color: #09AEB3;
    background: #fff;
    outline: none;
}

.cqr_form_fields textarea {
    min-height: 5em;
    resize: vertical;
}

/* Field-level error (red border) */
.cqr_form_fields input.cqr_field_error,
.cqr_form_fields textarea.cqr_field_error {
    border-color: #E61C7E;
    background: #fff5f8;
}
.cqr_form_fields input.cqr_field_error:focus,
.cqr_form_fields textarea.cqr_field_error:focus {
    border-color: #E61C7E;
}

/* === Personal fields (name + email) — progressive disclosure === */
.cqr_personal_fields {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .4s ease, opacity .3s ease, margin .3s ease;
}

.cqr_wrap.has_comment .cqr_personal_fields {
    max-height: 300px;
    opacity: 1;
    margin-top: 0;
}

/* === Consent area (Datenschutz) — only when personal data entered === */
.cqr_consent_area {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .4s ease, opacity .3s ease, margin .3s ease;
}

.cqr_wrap.has_comment .cqr_consent_area {
    max-height: 400px;
    opacity: 1;
    margin-top: 0.5em;
}

.cqr_datenschutz {
    margin: 0.9em 0 0.6em 0;
    font-size: 0.85em;
    color: #666;
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
}

.cqr_datenschutz input[type="checkbox"] {
    margin-top: 0.25em;
    flex-shrink: 0;
}

/* DS error state */
.cqr_datenschutz.cqr_ds_error input[type="checkbox"] {
    accent-color: #E61C7E;
    outline: 2px solid #E61C7E;
    outline-offset: 1px;
    border-radius: 2px;
}

.cqr_datenschutz.cqr_ds_error small {
    color: #E61C7E;
}

/* === Field hints (notwendig / optional) === */
.cqr_field_hint {
    display: none;
    font-weight: normal;
    font-size: 0.85em;
}

.cqr_wrap.has_content .cqr_hint_required {
    display: inline;
    color: #E61C7E;
}

.cqr_wrap.has_content .cqr_hint_optional {
    display: inline;
    color: #999;
}

/* === No-stars mode (entered via comment link) === */
.cqr_wrap.cqr_no_stars .cqr_submit_btn {
    display: none;
}

.cqr_wrap.cqr_no_stars.has_content .cqr_submit_btn {
    display: inline-block;
}

.cqr_wrap.cqr_no_stars .cqr_form_title--stars {
    display: none;
}

.cqr_wrap.cqr_no_stars .cqr_personal_fields {
    max-height: 300px;
    opacity: 1;
    margin-top: 0;
}

.cqr_wrap.cqr_no_stars .cqr_consent_area {
    max-height: 400px;
    opacity: 1;
    margin-top: 0.5em;
}

/* === Stars nudge ("Über eine Bewertung würden wir uns freuen...") === */
.cqr_stars_nudge {
    display: none;
    font-size: 0.85em;
    color: #999;
    text-align: center;
    margin: 0 0 0.5em 0;
}

.cqr_wrap.cqr_no_stars .cqr_stars_nudge {
    display: block;
}

/* === Action buttons === */
.cqr_actions {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    margin-top: 0.8em;
}

@media (min-width: 500px) {
    .cqr_actions {
        flex-direction: row;
        justify-content: center;
    }
}

/* Self-contained button style (no UIkit/Bootstrap dependency) */
.cqr_submit_btn {
    display: inline-block;
    padding: 0.7em 1.5em;
    background: #E61C7E;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background .2s ease;
    line-height: 1.4;
    -webkit-appearance: none;
    appearance: none;
}

.cqr_submit_btn:hover {
    background: #c91568;
    color: #fff;
    text-decoration: none;
}

.cqr_submit_btn:active {
    transform: scale(0.97);
}

/* === Toast messages (success / error) === */
.cqr_toast {
    display: none;
    padding: 0.9em 1em;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

.cqr_toast--inner {
    margin: 0 0 0.8em 0;
}

.cqr_toast--outer {
    margin: 1em 0 0 0;
}

.cqr_toast.is_success {
    display: block;
    background: #e4f6e4;
    color: #2b6b2b;
    border: 1px solid #b6dcb6;
    animation: cqr_toast_pop .4s ease both;
}

.cqr_toast.is_error {
    display: block;
    background: #fde8e8;
    color: #a83434;
    border: 1px solid #f0b8b8;
    animation: cqr_toast_pop .4s ease both;
}

@keyframes cqr_toast_pop {
    0%   { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1);   opacity: 1; }
}

/* === Submitted state === */
/* Stars + headline stay fully visible; form, button, links go away */
.cqr_wrap.is_submitted .cqr_stars {
    pointer-events: none;
}

.cqr_wrap.is_submitted .cqr_actions,
.cqr_wrap.is_submitted .cqr_comment_link,
.cqr_wrap.is_submitted .cqr_hint,
.cqr_wrap.is_submitted .cqr_form_title {
    display: none;
}

.cqr_wrap.is_submitted .cqr_form_fields,
.cqr_wrap.is_submitted .cqr_consent_area,
.cqr_wrap.is_submitted .cqr_stars_nudge {
    display: none;
}

/* === Star-only comments in PW list: hide irrelevant UI === */
.CommentListItem.cqr_stars_only .CommentVotes,
.CommentListItem.cqr_stars_only .CommentFooter,
.CommentListItem.cqr_stars_only .CommentText {
    display: none;
}

/* After comment submitted: hide form, keep stars active */
.cqr_wrap.cqr_comment_done .cqr_form_area,
.cqr_wrap.cqr_comment_done .cqr_comment_link {
    display: none;
}
