/* ================================================================
   EWI Elliott Structure Eliminator — Frontend Styles
   Targets the ewi-ese__* BEM class names used by tool-ui.php
   ================================================================ */

/* ── Outer wrap ─────────────────────────────────────────────── */

#ewi-ese {
    max-width: 980px;
    margin: 0 auto;
    padding: 24px;
    background: #111827;
    color: #e5e7eb;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
}

/* ── Intro ──────────────────────────────────────────────────── */

.ewi-ese__intro {
    margin: 0 0 22px;
    color: #9ca3af;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ── Sections ───────────────────────────────────────────────── */

.ewi-ese__section {
    margin: 0 0 20px;
    padding: 16px 18px 14px;
    background: rgba(255,255,255,.02);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
}

.ewi-ese__section-hdr {
    margin-bottom: 14px;
}

.ewi-ese__section-title {
    display: block;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #93c5fd;
    margin-bottom: 6px;
}

.ewi-ese__section-why {
    display: block;
    font-size: 0.84rem;
    color: #94a3b8;
    line-height: 1.5;
    max-width: 64ch;
}

/* ── Rows ───────────────────────────────────────────────────── */

.ewi-ese__row {
    margin-bottom: 14px;
}

.ewi-ese__row:last-child {
    margin-bottom: 0;
}

.ewi-ese__field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #93c5fd;
    margin-bottom: 8px;
}

/* ── Button group (toggle pills) ────────────────────────────── */

.ewi-ese__btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ewi-ese__btn {
    padding: 7px 13px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.10);
    color: #cbd5e1;
    border-radius: 6px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
    line-height: 1;
}

.ewi-ese__btn:hover {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.18);
    color: #e5e7eb;
}

.ewi-ese__btn.active {
    background: rgba(56,189,248,.15);
    border-color: #38bdf8;
    color: #38bdf8;
}

/* ── Hints ──────────────────────────────────────────────────── */

.ewi-ese__hint {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.45;
}

/* ── Leg blocks ─────────────────────────────────────────────── */

.ewi-ese__leg-block {
    padding: 14px 0;
    border-top: 1px solid rgba(255,255,255,.06);
}

.ewi-ese__leg-block:first-of-type {
    border-top: none;
    padding-top: 0;
}

.ewi-ese__leg-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e5e7eb;
    margin-bottom: 12px;
}

.ewi-ese__leg-sublabel {
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
    margin-left: 4px;
}

/* ── Nested (Leg 2 sub-degree) ──────────────────────────────── */

.ewi-ese__nested {
    margin-top: 14px;
    padding: 14px;
    background: rgba(56,189,248,.04);
    border: 1px solid rgba(56,189,248,.12);
    border-radius: 8px;
    display: none;
}

.ewi-ese__nested-hdr {
    font-size: 0.82rem;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 8px;
}

/* ── Evaluate row ───────────────────────────────────────────── */

.ewi-ese__evaluate-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.ewi-ese__evaluate-btn {
    background: #38bdf8;
    color: #082f49;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 180ms ease, box-shadow 180ms ease;
}

.ewi-ese__evaluate-btn:hover {
    background: #7dd3fc;
    box-shadow: 0 4px 16px rgba(56,189,248,.25);
}

.ewi-ese__evaluate-btn:active {
    background: #0ea5e9;
}

.ewi-ese__reset-btn {
    background: rgba(255,255,255,.04);
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.ewi-ese__reset-btn:hover {
    background: rgba(255,255,255,.08);
    color: #e5e7eb;
}

/* ── Results panel ──────────────────────────────────────────── */

.ewi-ese__results {
    margin-top: 28px;
}

.ewi-ese__result-degree-note {
    padding: 10px 14px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 16px;
}

/* ── Leg 2 sub-analysis ─────────────────────────────────────── */

.ewi-ese__leg2-analysis {
    padding: 14px 16px;
    background: rgba(56,189,248,.05);
    border: 1px solid rgba(56,189,248,.15);
    border-radius: 10px;
    margin-bottom: 16px;
}

.ewi-ese__leg2-analysis-hdr {
    font-size: 0.82rem;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 8px;
}

.ewi-ese__leg2-analysis-candidate {
    font-size: 1rem;
    font-weight: 700;
    color: #e5e7eb;
}

.ewi-ese__forming-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(255,193,7,.15);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffc107;
    vertical-align: middle;
}

/* ── Result list ────────────────────────────────────────────── */

.ewi-ese__result-list {
    margin: 6px 0 0;
    padding: 0 0 0 16px;
    list-style: disc;
}

.ewi-ese__result-list li {
    font-size: 0.86rem;
    color: #cbd5e1;
    margin-bottom: 4px;
    line-height: 1.45;
}

/* ── Primary result block ───────────────────────────────────── */

.ewi-ese__result-primary {
    padding: 16px 18px;
    background: rgba(56,189,248,.07);
    border: 1px solid rgba(56,189,248,.22);
    border-radius: 10px;
    margin-bottom: 16px;
}

.ewi-ese__result-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: #93c5fd;
    margin-bottom: 6px;
}

.ewi-ese__result-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.ewi-ese__confidence {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}

.ewi-ese__confidence--high   { background: rgba(76,175,114,.15); color: #4caf72; }
.ewi-ese__confidence--medium { background: rgba(255,193,7,.15);  color: #ffc107; }
.ewi-ese__confidence--low    { background: rgba(255,90,90,.15);  color: #ff5a5a; }

.ewi-ese__result-score {
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 12px;
}

/* ── Result sub-blocks ──────────────────────────────────────── */

.ewi-ese__result-support,
.ewi-ese__result-confirmations,
.ewi-ese__result-contradictions,
.ewi-ese__result-watch {
    margin-top: 12px;
}

.ewi-ese__result-block-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #93c5fd;
    margin-bottom: 4px;
}

.ewi-ese__result-block-title--green { color: #4caf72; }
.ewi-ese__result-block-title--warn  { color: #ffc107; }
.ewi-ese__result-block-title--blue  { color: #38bdf8; }

/* ── Remaining candidates ───────────────────────────────────── */

.ewi-ese__result-remaining {
    padding: 14px 16px;
    background: rgba(255,255,255,.02);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    margin-bottom: 12px;
}

.ewi-ese__remaining-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #93c5fd;
    margin-bottom: 10px;
}

.ewi-ese__remaining-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ewi-ese__remaining-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(255,255,255,.03);
    border-radius: 6px;
    font-size: 0.88rem;
    gap: 12px;
}

.ewi-ese__remaining-item strong {
    color: #e5e7eb;
}

.ewi-ese__remaining-item span {
    color: #64748b;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* ── Eliminated ─────────────────────────────────────────────── */

.ewi-ese__result-eliminated {
    margin-top: 16px;
    padding: 14px 16px;
    background: rgba(255,90,90,.03);
    border: 1px solid rgba(255,90,90,.12);
    border-radius: 10px;
}

.ewi-ese__elim-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ff5a5a;
    margin-bottom: 10px;
}

.ewi-ese__elim-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.ewi-ese__elim-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ewi-ese__elim-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 3px;
}

.ewi-ese__elim-reason {
    font-size: 0.80rem;
    color: #64748b;
    line-height: 1.4;
    padding-left: 10px;
}

/* ── Loading / error states ─────────────────────────────────── */

.ewi-ese__loading {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

.ewi-ese__error {
    padding: 14px 16px;
    background: rgba(255,90,90,.06);
    border: 1px solid rgba(255,90,90,.18);
    border-radius: 8px;
    color: #ff5a5a;
    font-size: 0.9rem;
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 640px) {
    #ewi-ese {
        padding: 16px;
    }

    .ewi-ese__section {
        padding: 14px 14px 12px;
    }

    .ewi-ese__evaluate-row {
        flex-direction: column;
        align-items: stretch;
    }

    .ewi-ese__evaluate-btn,
    .ewi-ese__reset-btn {
        width: 100%;
        text-align: center;
    }

    .ewi-ese__result-name {
        font-size: 1rem;
    }
}
