/**
 * Sentence Rephraser Helper – Styles
 */

/* ── Preview / Result areas ──────────────────────────────── */
.rephraser-result-box {
    min-height: 80px;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    font-size: 1rem;
    line-height: 1.7;
    word-break: break-word;
}

.rephraser-result-box.has-result {
    background: #ffffff;
    border-color: #dee2e6;
}

/* ── Diff Highlight Spans ─────────────────────────────────── */
.word-replaced {
    color: #1a6fc4;
    background: #dbeafe;
    border-radius: 3px;
    padding: 0 3px;
    font-weight: 600;
}

.word-added {
    color: #166534;
    background: #dcfce7;
    border-radius: 3px;
    padding: 0 3px;
    text-decoration: underline;
    font-weight: 600;
}

.word-removed {
    color: #991b1b;
    background: #fee2e2;
    border-radius: 3px;
    padding: 0 3px;
    text-decoration: line-through;
}

.word-structural {
    color: #14532d;
    background: #bbf7d0;
    border-radius: 3px;
    padding: 0 3px;
    font-weight: 600;
}

/* ── Grammar Explanation Box ─────────────────────────────── */
.grammar-explanation-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.grammar-explanation-box .expl-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    font-size: 0.92rem;
}

.grammar-explanation-box .expl-label {
    font-weight: 700;
    color: #0369a1;
    min-width: 90px;
    flex-shrink: 0;
}

.grammar-explanation-box .expl-value {
    color: #1e293b;
}

.grammar-explanation-box .expl-rule {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #bae6fd;
}

.grammar-explanation-box .expl-rule .expl-label {
    color: #7c3aed;
}

.grammar-explanation-box .expl-explanation p {
    font-size: 0.9rem;
    color: #374151;
    margin: 0;
    line-height: 1.6;
}

/* ── Highlight Legend ─────────────────────────────────────── */
.highlight-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: #4b5563;
}

.legend-swatch {
    width: 22px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

.legend-swatch.replaced {
    background: #dbeafe;
    border: 1px solid #93c5fd;
}

.legend-swatch.added {
    background: #dcfce7;
    border: 1px solid #86efac;
    text-decoration: underline;
}

.legend-swatch.removed {
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

.legend-swatch.structural {
    background: #bbf7d0;
    border: 1px solid #4ade80;
}

/* ── Difficulty + Mode selectors ──────────────────────────── */
.difficulty-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.difficulty-btn {
    flex: 1;
    min-width: 100px;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.difficulty-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
}

.difficulty-btn.active {
    border-color: #6366f1;
    background: #6366f1;
    color: #fff;
    font-weight: 600;
}

.mode-check-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 0.4rem;
    color: #374151;
}

.mode-check-label:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.mode-check-label input[type="checkbox"] {
    accent-color: #6366f1;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.mode-check-label.disabled-mode {
    opacity: 0.45;
    pointer-events: none;
}

/* ── Char counter bar ─────────────────────────────────────── */
.char-counter-bar {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: right;
    margin-top: 0.3rem;
}

.char-counter-bar.near-limit {
    color: #f59e0b;
    font-weight: 600;
}

.char-counter-bar.at-limit {
    color: #ef4444;
    font-weight: 700;
}

/* ── Warning / Error alerts ──────────────────────────────── */
.rephraser-alert {
    display: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-top: 0.5rem;
}

.rephraser-alert.show {
    display: block;
}

.rephraser-alert.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.rephraser-alert.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ── Rephrase Button ─────────────────────────────────────── */
.btn-rephrase {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    width: 100%;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-rephrase:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-rephrase:active {
    transform: translateY(0);
}

/* ── Sticky right panel ──────────────────────────────────── */
@media (min-width: 992px) {
    .rephraser-sticky {
        position: sticky;
        top: 2rem;
    }
}