/* ============================================================
   EchoBox – Die stille Frage  |  assets/echobox.css
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.echobox-wrap {
    margin: 3em 0 1.5em;
    padding: 2em 2.2em 2em;
    background: #fafafa;
    border: 1px solid #eaeaea;
    border-top: 3px solid #5b5ea6;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 2px 16px rgba(0,0,0,.04);
}

/* ── Header ──────────────────────────────────────────────── */
.echobox-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 1.2em;
}

.echobox-icon {
    font-size: 1.6em;
    line-height: 1.2;
    flex-shrink: 0;
}

.echobox-question {
    margin: 0;
    font-size: 1.15em;
    font-weight: 600;
    color: #222;
    line-height: 1.45;
}

/* ── Eingabe-Bereich ─────────────────────────────────────── */
.echobox-input-area {
    margin-bottom: 1.6em;
}

.echobox-input-row {
    display: flex;
    gap: 8px;
}

.echobox-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #d0d0d0;
    border-radius: 8px;
    font-size: 0.95em;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.echobox-input:focus {
    border-color: #5b5ea6;
    box-shadow: 0 0 0 3px rgba(91, 94, 166, 0.12);
}

.echobox-input::placeholder {
    color: #aaa;
}

.echobox-send {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #5b5ea6;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.9em;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s;
    white-space: nowrap;
}

.echobox-send:hover {
    background: #484b8a;
}

.echobox-send:active {
    transform: scale(0.97);
}

.echobox-send:disabled {
    background: #b0b3d4;
    cursor: default;
}

/* ── Zeichenzähler ───────────────────────────────────────── */
.echobox-char-counter {
    font-size: 0.78em;
    color: #aaa;
    margin-top: 5px;
    text-align: right;
}

.echobox-char-counter.warn {
    color: #e8873a;
}

/* ── Status-Meldung ──────────────────────────────────────── */
.echobox-message {
    margin: 10px 0 0;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.88em;
}

.echobox-message[hidden] { display: none; }

.echobox-message.success {
    background: #eaf7ee;
    color: #2d7a4f;
    border: 1px solid #b4dec4;
}

.echobox-message.error {
    background: #fef3f2;
    color: #b42d2d;
    border: 1px solid #f5c0bc;
}

.echobox-message.info {
    background: #eef2ff;
    color: #3d47a0;
    border: 1px solid #c7cdee;
}

/* ── Wortwolke ───────────────────────────────────────────── */
.echobox-cloud-section {
    border-top: 1px solid #eaeaea;
    padding-top: 1.2em;
}

.echobox-cloud-header {
    margin-bottom: 0.8em;
}

.echobox-count {
    font-size: 0.82em;
    color: #888;
    font-weight: 500;
}

.echobox-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 48px;
    align-items: center;
}

.echobox-loading {
    color: #bbb;
    font-size: 0.9em;
    font-style: italic;
}

/* Jedes Echo als Bubble */
.echobox-bubble {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid #ddd;
    border-radius: 24px;
    padding: 5px 13px;
    font-size: 0.88em;
    color: #444;
    cursor: default;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    animation: echobox-popin 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.echobox-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    border-color: #5b5ea6;
    color: #333;
    z-index: 1;
}

/* Größe je nach Häufigkeit */
.echobox-bubble[data-freq="1"] { font-size: 0.84em; color: #666; }
.echobox-bubble[data-freq="2"] { font-size: 0.92em; font-weight: 500; border-color: #b0b3d4; }
.echobox-bubble[data-freq="3"] { font-size: 1.00em; font-weight: 600; border-color: #8487c0; color: #333; }
.echobox-bubble[data-freq="4"] { font-size: 1.08em; font-weight: 600; border-color: #5b5ea6; color: #222; }
.echobox-bubble[data-freq="5+"]{ font-size: 1.16em; font-weight: 700; border-color: #5b5ea6; color: #1a1a1a; background: #f0f1ff; }

/* Anzahl-Badge */
.echobox-freq-badge {
    margin-left: 6px;
    background: #5b5ea6;
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 0.72em;
    font-weight: 700;
    line-height: 1.6;
}

/* Tooltip mit vollem Text bei langen Antworten */
.echobox-bubble[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8em;
    white-space: nowrap;
    max-width: 220px;
    white-space: normal;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* Neu-hinzugekommenes Echo hervorheben */
.echobox-bubble.is-new {
    border-color: #5b5ea6;
    background: #eef0ff;
}

/* Animation */
@keyframes echobox-popin {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1); }
}

.echobox-no-echoes {
    color: #bbb;
    font-size: 0.9em;
    font-style: italic;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 540px) {
    .echobox-wrap {
        padding: 1.4em 1.2em;
    }
    .echobox-input-row {
        flex-direction: column;
    }
    .echobox-send {
        justify-content: center;
    }
}
