/* =========================================================
   Echtzeit Feedback – Frontend CSS v1.1
========================================================= */

/*
   Schriftgrößen-Skala (angepasst an Theme-Werte):
   Textkörper M  = 1.25rem  → Kategorielabels, Kommentare, Button
   Textkörper S  = 1rem     → Feldlabels, Checkbox-Text, Fehler, Sektions-Titel
   Klein (< S)   = 0.8rem   → Hinweise, Optional-Labels, Char-Count, Footer-Meta
   Sterne-Icon   = 1.75rem
   Statistik-Avg = 3rem     → entspricht h2
   Statistik-Avg Detail = 3.75rem → entspricht h1
*/

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

.efb-wrap {
    max-width: 540px;
    margin: 0 auto;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1a1a2e;
}

.efb-hidden { display: none !important; }

/* ── Fehler / Erfolg ──────────────────────────────────── */
.efb-error {
    background: #fef0f0;
    border-left: 4px solid #e74c3c;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 1rem;
    color: #c0392b;
}

.efb-success { text-align: center; padding: 40px 20px; }
.efb-success-icon { font-size: 3rem; margin-bottom: 12px; }
.efb-success h3   { font-size: 1.25rem; margin-bottom: 8px; color: #2d6a4f; }
.efb-success p    { color: #666; font-size: 1rem; }

/* ── Formular ─────────────────────────────────────────── */
.efb-form { display: flex; flex-direction: column; gap: 20px; }

.efb-categories { display: flex; flex-direction: column; gap: 14px; }

.efb-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* Validierungs-Highlight – nur beim Invalid-Zustand sichtbar */
.efb-category.efb-invalid .efb-star-hint { display: block !important; }
.efb-category.efb-invalid .efb-stars .efb-star { color: #f5c6c6; }

.efb-consent-wrap.efb-invalid {
    border: 1.5px solid #e74c3c;
    border-radius: 8px;
    background: #fef8f8;
}
.efb-consent-wrap.efb-invalid .efb-consent-hint { display: block !important; }

.efb-field-hint {
    font-size: 0.8rem;
    color: #e74c3c;
    margin-top: 4px;
    display: none;
    width: 100%;
}

.efb-cat-label-wrap {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.efb-cat-label {
    font-size: 1rem;
    font-weight: 600;
    color: #2d6a4f;
}

.efb-cat-description {
    font-size: 0.8rem;
    color: #2c1a0e;
    margin: 0;
    line-height: 1.4;
}

.efb-required-star { color: #e74c3c; font-size: 0.8rem; }
.efb-required-note { font-size: 0.8rem; color: #888; margin: 4px 0 0 28px; }

/* Sterne */
.efb-stars { display: flex; gap: 4px; align-items: center; }

.efb-star {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #ddd;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    transition: color 0.1s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.efb-star.efb-active,
.efb-star.efb-hover { color: #f4b942; }

@media (hover: hover) {
    .efb-star:hover { color: #f4b942; transform: scale(1.15); }
}
.efb-star:active { transform: scale(1.1); color: #f4b942; }

/* Felder */
.efb-field { display: flex; flex-direction: column; gap: 6px; }

.efb-field label {
    font-size: 1rem;
    font-weight: 600;
    color: #444;
}

.efb-optional { font-weight: 400; color: #888; font-size: 0.8rem; }

.efb-field textarea,
.efb-field input[type="text"],
.efb-field input[type="password"],
.efb-field select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1.5px solid #ddd;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s;
    -webkit-appearance: auto;
    appearance: auto;
}

.efb-field textarea { resize: vertical; }

.efb-field textarea:focus,
.efb-field input:focus,
.efb-field select:focus {
    outline: none;
    border-color: #2d6a4f;
}

.efb-char-count { font-size: 0.8rem; color: #aaa; text-align: right; }
.efb-char-count.efb-warn { color: #e67e22; }
.efb-hint { font-size: 0.8rem; color: #888; margin: 0; line-height: 1.4; }
.efb-hint a { color: #2d6a4f; text-decoration: underline; }

/* DSGVO-Checkbox */
.efb-consent-wrap {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.efb-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 1rem;
    color: #555;
    line-height: 1.5;
}

.efb-checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #2d6a4f;
    cursor: pointer;
}

/* Button */
.efb-btn-primary {
    background: #2d6a4f;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    align-self: flex-start;
}

@media (hover: hover) {
    .efb-btn-primary:hover { background: #235a41; }
}
.efb-btn-primary:active { background: #235a41; }
.efb-btn-primary:focus-visible { outline: 2px solid #2d6a4f; outline-offset: 2px; }

/* ── Login ────────────────────────────────────────────── */
.efb-login-wrap { max-width: 380px; }
.efb-login-form { gap: 16px; }

/* ── Statistik-Label ──────────────────────────────────── */
.efb-stat-label {
    font-weight: 700;
    color: #2d6a4f;
    margin: 0 0 16px;
    line-height: 1.2;
}

/* Kurze Statistik: groß genug um alleine zu stehen */
.efb-stat-simple .efb-stat-label {
    font-size: 2.25rem;
}

/* Ausführliche Statistik: größer als Section-Titles aber eingeordnet */
.efb-stat-detail .efb-stat-label {
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Statistik: schlicht ──────────────────────────────── */
.efb-stat-simple { padding: 20px 0; }

.efb-simple-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.efb-simple-avg {
    font-size: 3rem;
    font-weight: 700;
    color: #2d6a4f;
    line-height: 1;
}

.efb-simple-stars { font-size: 1.25rem; letter-spacing: 2px; }
.efb-s-full  { color: #f4b942; }
.efb-s-half  { color: #f4b942; opacity: 0.5; }
.efb-s-empty { color: #ddd; }
.efb-simple-count { font-size: 0.8rem; color: #888; }
.efb-no-data { color: #aaa; font-style: italic; font-size: 1rem; }

/* ── Kommentare ───────────────────────────────────────── */
.efb-comments { display: flex; flex-direction: column; gap: 12px; }

.efb-comment-hidden { display: none; }

.efb-comment {
    background: #f8faf9;
    border-left: 3px solid #2d6a4f;
    margin: 0;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
}

.efb-comment p {
    margin: 0 0 8px;
    font-size: 1rem;
    color: #333;
    line-height: 1.6;
}

.efb-comment footer {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.8rem;
    color: #aaa;
}

.efb-comment-name { font-weight: 600; color: #666; }

.efb-more-btn {
    background: none;
    border: 1.5px solid #2d6a4f;
    border-radius: 8px;
    color: #2d6a4f;
    font-size: 1rem;
    font-weight: 500;
    padding: 8px 16px;
    cursor: pointer;
    margin-top: 4px;
    align-self: flex-start;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@media (hover: hover) {
    .efb-more-btn:hover { background: #2d6a4f; color: #fff; }
}
.efb-more-btn:active { background: #2d6a4f; color: #fff; }

/* ── Statistik: ausführlich ───────────────────────────── */
.efb-stat-detail { padding: 20px 0; }

.efb-detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #eee;
}

.efb-detail-avg { font-size: 3.75rem; font-weight: 700; color: #2d6a4f; line-height: 1; }

.efb-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #555;
    margin: 0 0 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.efb-cat-bars,
.efb-distribution { margin-bottom: 32px; }

.efb-cat-bar-row,
.efb-dist-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.efb-cat-bar-label { width: 130px; font-size: 1rem; color: #444; flex-shrink: 0; }
.efb-dist-label    { width: 40px;  font-size: 1rem; color: #444; flex-shrink: 0; }

.efb-bar-track {
    flex: 1;
    height: 10px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
}

.efb-bar-fill {
    height: 100%;
    background: #2d6a4f;
    border-radius: 5px;
    transition: width 0.6s cubic-bezier(.22,1,.36,1);
}

.efb-bar-dist { background: #f4b942; }

.efb-cat-bar-val { width: 30px; font-size: 1rem; font-weight: 600; color: #2d6a4f; text-align: right; flex-shrink: 0; }
.efb-dist-count  { width: 24px; font-size: 0.8rem; color: #aaa; text-align: right; flex-shrink: 0; }

.efb-trend { margin-bottom: 32px; }
.efb-trend-chart { width: 100%; height: 160px; position: relative; }
.efb-trend-chart canvas { width: 100% !important; height: 100% !important; }

.efb-comments-section { margin-bottom: 16px; }
.efb-comments-section .efb-comments { margin-top: 0; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 480px) {
    .efb-cat-bar-row {
        flex-wrap: wrap;
    }
    .efb-cat-bar-label {
        width: 100%;
        font-size: 0.8rem;
        margin-bottom: 2px;
    }
    .efb-detail-avg    { font-size: 2.25rem; }
    .efb-btn-primary   { width: 100%; text-align: center; align-self: stretch; }
    .efb-more-btn      { width: 100%; text-align: center; }
}
