/* ══════════════════════════════════════════════
   Markdown Editor
══════════════════════════════════════════════ */

.editor-page {
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.editor-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-title-input {
    width: 100%;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    border: none;
    border-bottom: 2px solid var(--border);
    background: transparent;
    padding: 8px 0;
    outline: none;
    transition: border-color var(--transition);
}

.editor-title-input:focus { border-color: var(--accent); }
.editor-title-input::placeholder { color: var(--text-muted); font-weight: 400; }

.editor-tags-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-guide-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity var(--transition);
}

.editor-guide-link:hover { opacity: .75; }

/* ── Toolbar ── */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    padding: 6px 8px;
}

.editor-tool {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}

.editor-tool:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.editor-tool-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

/* ── Textarea ── */
.editor-textarea {
    width: 100%;
    min-height: 480px;
    padding: 16px;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
}

.editor-textarea:focus { border-color: var(--accent); }

.editor-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Предпросмотр ── */
.editor-preview {
    min-height: 480px;
    padding: 20px 24px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
}

.editor-preview h1 { font-size: 26px; font-weight: 800; margin: 0 0 12px; }
.editor-preview h2 { font-size: 20px; font-weight: 700; margin: 20px 0 10px; }
.editor-preview h3 { font-size: 17px; font-weight: 700; margin: 16px 0 8px; }
.editor-preview p  { margin: 0 0 10px; }
.editor-preview strong { font-weight: 700; }
.editor-preview em     { font-style: italic; }
.editor-preview del    { text-decoration: line-through; color: var(--text-muted); }
.editor-preview a      { color: var(--accent); }
.editor-preview code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: 'Consolas', monospace;
    font-size: 13px;
}
.editor-preview pre {
    background: #1a1d27;
    color: #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}
.editor-preview pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: 13px;
}
.editor-preview blockquote {
    border-left: 4px solid var(--accent);
    padding: 8px 16px;
    margin: 12px 0;
    background: var(--accent-light);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}
.editor-preview hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}
.editor-preview li { margin-left: 20px; margin-bottom: 4px; }

/* ── Обложка статьи ── */
.editor-cover-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.editor-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.editor-upload-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.editor-cover-preview {
    position: relative;
    width: 100%;
    max-height: 280px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.editor-cover-preview img {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    display: block;
}

.editor-cover-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    border: none;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.editor-cover-remove:hover { background: rgba(229,57,53,.85); }

/* ── GigaChad AI ── */
.gigachad-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@keyframes rainbow {
    0%   { filter: hue-rotate(0deg)   saturate(1.8) brightness(1.1); }
    25%  { filter: hue-rotate(90deg)  saturate(2)   brightness(1.2); }
    50%  { filter: hue-rotate(180deg) saturate(1.8) brightness(1.1); }
    75%  { filter: hue-rotate(270deg) saturate(2)   brightness(1.2); }
    100% { filter: hue-rotate(360deg) saturate(1.8) brightness(1.1); }
}

.gigachad-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 22px 10px 12px;
    border-radius: 32px;
    border: none;
    background: #fff;
    color: #374151;
    font-size: 15px;
    font-weight: 700;
    text-wrap: wrap;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    width: fit-content;
    position: relative;
    box-shadow:
        0 0 0 2px transparent,
        0 0 20px rgba(168,85,247,.4),
        0 6px 24px rgba(0,0,0,.4);
    animation: giga-border 4s linear infinite;
}

@keyframes giga-border {
    0%   { box-shadow: 0 0 0 2px #a855f7, 0 0 24px rgba(168,85,247,.5), 0 6px 24px rgba(0,0,0,.4); }
    25%  { box-shadow: 0 0 0 2px #3b82f6, 0 0 24px rgba(59,130,246,.5),  0 6px 24px rgba(0,0,0,.4); }
    50%  { box-shadow: 0 0 0 2px #06b6d4, 0 0 24px rgba(6,182,212,.5),   0 6px 24px rgba(0,0,0,.4); }
    75%  { box-shadow: 0 0 0 2px #ec4899, 0 0 24px rgba(236,72,153,.5),  0 6px 24px rgba(0,0,0,.4); }
    100% { box-shadow: 0 0 0 2px #a855f7, 0 0 24px rgba(168,85,247,.5), 0 6px 24px rgba(0,0,0,.4); }
}

.gigachad-toggle:hover {
    transform: scale(1.04) translateY(-1px);
}

.gigachad-toggle.open {
    background: #fff;
    color: #374151;
    animation: none;
    box-shadow: 0 0 0 2px #e53935, 0 0 16px rgba(229,57,53,.25), 0 4px 16px rgba(0,0,0,.1);
}

.gigachad-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    animation: rainbow 3s linear infinite;
    flex-shrink: 0;
}

.gigachad-label {
    background: linear-gradient(90deg, #a855f7, #3b82f6, #06b6d4, #a855f7);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer-text 2.5s linear infinite;
}

@keyframes shimmer-text {
    to { background-position: 200% center; }
}

.gigachad-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(168,85,247,.08);
}

.gigachad-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.gigachad-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #9ca3af;
    white-space: nowrap;
    min-width: 56px;
}

.gigachad-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1.5px solid #d8b4fe;
    background: #faf5ff;
    color: #7c3aed;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
}

.gigachad-btn:hover:not(:disabled) {
    background: #ede9fe;
    border-color: #a855f7;
    color: #6d28d9;
}

.gigachad-btn:disabled { opacity: .4; cursor: not-allowed; }

.gigachad-hint {
    font-size: 13px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.gigachad-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #7c3aed;
    box-shadow: 0 2px 8px rgba(168,85,247,.08);
    animation: giga-pulse 1.5s ease-in-out infinite;
}

@keyframes giga-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .6; }
}

.gigachad-loading-dots::after {
    content: '';
    animation: dots 1.2s steps(3, end) infinite;
}

@keyframes dots {
    0%   { content: '.';   }
    33%  { content: '..';  }
    66%  { content: '...'; }
    100% { content: '';    }
}

.gigachad-result {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(168,85,247,.08);
}

.gigachad-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #f3e8ff;
    background: #faf5ff;
    font-size: 13px;
    font-weight: 600;
    color: #7c3aed;
}

.gigachad-result-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color .18s;
}

.gigachad-result-close:hover { color: #6d28d9; }

/* Markdown-рендер внутри результата */
.gigachad-result-body {
    padding: 16px 18px;
    font-size: 13px;
    color: #374151;
    line-height: 1.75;
    margin: 10px;
}

.gigachad-result-body h1,
.gigachad-result-body h2,
.gigachad-result-body h3 {
    color: #111827;
    margin: 14px 0 6px;
    font-weight: 700;
}

.gigachad-result-body h1 { font-size: 18px; }
.gigachad-result-body h2 { font-size: 15px; }
.gigachad-result-body h3 { font-size: 13px; }

.gigachad-result-body p  { margin: 0 0 8px; }

.gigachad-result-body strong { color: #111827; font-weight: 700; }
.gigachad-result-body em     { font-style: italic; color: #7c3aed; }

.gigachad-result-body ul,
.gigachad-result-body ol {
    padding-left: 20px;
    margin: 6px 0 10px;
}

.gigachad-result-body li { margin-bottom: 4px; }

.gigachad-result-body code {
    background: #f3e8ff;
    border-radius: 4px;
    padding: 1px 6px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    color: #6d28d9;
}

.gigachad-result-body blockquote {
    border-left: 3px solid #a855f7;
    padding: 4px 12px;
    margin: 8px 0;
    color: #6b7280;
    font-style: italic;
    background: #faf5ff;
}

.gigachad-result-body hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 12px 0;
}

/* Кнопка «Внести изменения» */
.gigachad-apply-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 16px 14px;
    padding: 8px 18px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(90deg, #7c3aed, #3b82f6);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .18s, transform .18s;
}

.gigachad-apply-btn:hover { opacity: .88; transform: translateY(-1px); }

/* ── Замечания модератора в редакторе ── */
.editor-rejection-panel {
    border: 1px solid #f5c6c6;
    border-radius: 10px;
    background: #fff5f5;
    padding: 14px 16px;
}

.editor-rejection-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: #c62828;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-rejection-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.editor-preview mark.rejection-highlight,
.mod-review-preview mark.rejection-highlight {
    background: rgba(229, 57, 53, 0.28);
    color: inherit;
    border-radius: 2px;
    padding: 0 2px;
}
