/* =========================================
   1. ОБЩИЙ КОНТЕЙНЕР БЛОКА
   ========================================= */
.mocc-code-wrapper {
    position: relative;
    margin: 24px 0;
    background: #1e1e1e;
    border-radius: 8px;
    border: 1px solid #2d3139;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* =========================================
   2. ШАПКА БЛОКА (HEADER)
   ========================================= */
.mocc-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: linear-gradient(161deg, #d0c79a 0%, #a39c7b 100%);
    border-bottom: none; /* Убираем границу, чтобы не портила градиент */
    min-height: 40px;
    box-sizing: border-box;
}

.mocc-filename {
    color: #381400; /* Цвет текста шапки */
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: auto;
}

/* Если названия файла нет, выравниваем кнопку вправо */
.mocc-code-wrapper:not(:has(.mocc-filename)) .mocc-code-header {
    justify-content: flex-end;
}

/* =========================================
   3. КНОПКА КОПИРОВАНИЯ
   ========================================= */
.mocc-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none; /* Убираем обводку */
    border-radius: 6px;
    color: #664735; /* Цвет текста */
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    transition: all 0.2s ease-in-out;
    line-height: 1;
}

/* Убираем рамку браузера при клике */
.mocc-copy-btn:focus {
    outline: none;
}

/* Шрифтовые иконки Mix Of Icons */
.mocc-copy-btn i[class^="mix-"] {
    font-size: 14px;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #664735; /* Цвет иконки */
    transition: color 0.2s;
    font-style: normal;
}

/* Fallback эмодзи иконки */
.mocc-copy-btn .moce-emoji-icon {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-style: normal;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #664735;
}

/* Ховер-эффект кнопки */
.mocc-copy-btn:hover {
    background: transparent;
    color: #381400; /* Цвет текста при наведении */
}

.mocc-copy-btn:hover i[class^="mix-"],
.mocc-copy-btn:hover .moce-emoji-icon {
    color: #381400; /* Цвет иконки при наведении */
}

/* Состояние "Скопировано!" */
.mocc-copy-btn.copied {
    background: transparent;
    color: #11611d; /* Цвет текста при успешном копировании */
}

.mocc-copy-btn.copied i[class^="mix-"],
.mocc-copy-btn.copied .moce-emoji-icon {
    color: #11611d; /* Цвет иконки при успешном копировании */
}

/* =========================================
   4. БЛОК КОДА (PRE / CODE)
   ========================================= */
.mocc-code-wrapper pre {
    margin: 0 !important;
    padding: 0 !important;
}

.mocc-code-wrapper pre code.hljs {
    border-radius: 0 0 8px 8px !important;
    padding: 16px !important;
    background: #1e1e1e !important;
}

/* =========================================
   5. НУМЕРАЦИЯ СТРОК
   ========================================= */
.mocc-line {
    display: flex;
    align-items: flex-start;
}

.mocc-line-number {
    display: inline-block;
    width: 30px;
    min-width: 30px;
    text-align: right;
    padding-right: 12px;
    margin-right: 12px;
    color: #5c6370;
    user-select: none;
    border-right: 1px solid #2d3139;
}

.mocc-line-content {
    white-space: pre-wrap;
    word-break: break-all;
    flex-grow: 1;
}

.mocc-line-number::before {
    content: attr(data-num);
    font-size: 12px;
}

/* =========================================
   6. СТИЛИ ДЛЯ РЕДАКТОРА (TEXTAREA)
   ========================================= */
.mocc-textarea:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

.mocc-textarea::placeholder {
    color: #5c6370;
    font-style: italic;
}

.mocc-code-wrapper textarea {
    all: unset;
    display: block;
    box-sizing: border-box;
    width: 100%;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #1e1e1e;
    color: #abb2bf;
    padding: 16px;
    margin: 0;
    border: none;
    resize: vertical;
    min-height: 150px;
}

.mocc-code-wrapper textarea:focus {
    outline: none;
}

/* =========================================
   7. LIVE-ПРЕВЬЮ В РЕДАКТОРЕ
   ========================================= */
.mocc-editor-preview {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    overflow: hidden;
}

.mocc-editor-preview pre {
    margin: 0 !important;
    padding: 16px !important;
    background: #1e1e1e !important;
    overflow-x: auto;
}

.mocc-editor-preview pre code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-break: break-all;
    display: block;
}

/* Стили тем подсветки применяются автоматически через подключённые CSS файлов тем */