/* Korectif */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #1a1a1a;
    --bg2: #222;
    --bg3: #2a2a2a;
    --border: #333;
    --text: #ccc;
    --dim: #777;
    --heading: #eee;
    --accent: #6a9fff;
    --red: #e55;
    --orange: #c93;
    --green: #6a6;
    --purple: #a7c;
    --cyan: #5aa;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: Consolas, "Liberation Mono", Menlo, monospace;
}

body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); min-height: 100vh; }
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* -- Header -- */
header { border-bottom: 1px solid var(--border); padding: 10px 0; }
.header-row { display: flex; align-items: center; justify-content: space-between; }
header h1 { font-size: 1.1rem; font-weight: 600; color: var(--heading); }

.stats { display: flex; gap: 12px; font: 0.8rem var(--mono); color: var(--dim); }
.stats .has-errors { color: var(--red); }

/* -- Buttons -- */
.btn {
    display: inline-block; padding: 5px 12px; font: 0.8rem var(--font);
    color: var(--text); background: var(--bg3); border: 1px solid var(--border);
    border-radius: 3px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #555; color: var(--heading); }
.btn.copied { border-color: var(--green); color: var(--green); }
.btn-sm { padding: 3px 9px; font-size: 0.75rem; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: rgba(238,85,85,0.1); }

/* -- Toolbar -- */
.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; gap: 10px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--dim); }
.toolbar-left select { background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 3px; padding: 3px 8px; font: 0.8rem var(--font); }
.toolbar-right { display: flex; gap: 6px; }

/* -- Editor -- */
.editor {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
    border: 1px solid var(--border); border-radius: 3px; overflow: hidden; min-height: 260px;
}
.editor-input, .editor-preview { background: var(--bg3); }
.editor-input textarea {
    width: 100%; height: 100%; min-height: 260px; background: transparent;
    color: var(--text); border: none; padding: 14px; font: 0.95rem/1.6 var(--font);
    resize: vertical; outline: none;
}
.editor-input textarea::placeholder { color: var(--dim); }

.corrected-text { padding: 14px; font-size: 0.95rem; line-height: 1.6; min-height: 260px; }
.placeholder-text { color: var(--dim); font-style: italic; }
.text-ok, .corrected-content { white-space: pre-wrap; word-wrap: break-word; }

/* -- Error highlights -- */
.error-highlight { border-bottom: 2px solid var(--red); cursor: pointer; }
.error-highlight:hover { background: rgba(238,85,85,0.1); }
.error-grammar { border-color: var(--orange); }
.error-grammar:hover { background: rgba(204,153,51,0.1); }
.error-typography { border-color: var(--accent); }
.error-typography:hover { background: rgba(106,159,255,0.06); }
.error-agreement { border-color: var(--purple); }
.error-agreement:hover { background: rgba(170,119,204,0.06); }
.error-conjugation { border-color: var(--cyan); }
.error-conjugation:hover { background: rgba(85,170,170,0.06); }
.error-common_mistake { border-color: var(--orange); }

/* -- Corrections -- */
.corrections { margin-top: 20px; padding-bottom: 30px; }
.corrections h2 { font-size: 0.9rem; font-weight: 600; color: var(--heading); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.count { font: 0.75rem var(--mono); color: var(--dim); background: var(--bg3); border: 1px solid var(--border); padding: 1px 7px; border-radius: 3px; }
.corrections-list { display: flex; flex-direction: column; gap: 4px; }
.empty, .no-corrections { color: var(--dim); font-size: 0.85rem; padding: 6px 0; }

/* -- Correction cards -- */
.correction-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 3px; padding: 8px 12px; }
.correction-card.highlight { border-color: var(--accent); }
.correction-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.correction-type { font: 500 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); }
.type-spelling { color: var(--red); }
.type-grammar { color: var(--orange); }
.type-typography { color: var(--accent); }
.type-agreement { color: var(--purple); }
.type-conjugation { color: var(--cyan); }
.type-common_mistake { color: var(--orange); }
.correction-confidence { font: 0.7rem var(--mono); color: var(--dim); }

.correction-body { display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; }
.correction-body .label { color: var(--dim); font-size: 0.8rem; }
.correction-body .value { color: var(--text); }
.error-text { color: var(--red); }

.correction-original, .correction-suggestions, .correction-explanation { display: flex; align-items: baseline; gap: 6px; }
.suggestions-list { display: flex; gap: 4px; flex-wrap: wrap; }
.suggestion-btn {
    background: var(--bg3); color: var(--green); border: 1px solid var(--border);
    padding: 2px 10px; font: 0.82rem var(--font); border-radius: 3px; cursor: pointer;
}
.suggestion-btn:hover { border-color: var(--green); }

.correction-actions { margin-top: 3px; }
.propose-btn, .propose-btn-sm {
    background: none; color: var(--dim); border: 1px solid var(--border);
    padding: 2px 10px; font: 0.78rem var(--font); border-radius: 3px; cursor: pointer;
}
.propose-btn:hover, .propose-btn-sm:hover { color: var(--text); border-color: #555; }

/* -- Toast -- */
.toast {
    position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
    padding: 7px 16px; border-radius: 3px; font-size: 0.85rem;
    background: var(--bg2); border: 1px solid var(--border);
    color: var(--heading); opacity: 0; pointer-events: none;
    transition: opacity 0.15s; z-index: 1000;
}
.toast-visible { opacity: 1; }
.toast-error { border-color: var(--red); }
.toast-success { border-color: var(--green); }

/* -- Responsive -- */
@media (max-width: 640px) {
    .editor { grid-template-columns: 1fr; }
    .editor-input textarea, .corrected-text { min-height: 160px; }
    .toolbar { flex-direction: column; align-items: flex-start; }
}
