/**
 * BulbaSoft Menu - Text Block Styles
 * Стили для текстового блока с поддержкой WordPress контента
 */

/* === ОСНОВНЫЕ СТИЛИ ТЕКСТОВОГО БЛОКА === */

.bsftmenu-text-content {
    line-height: 1.6;
    color: #333;
}

.bsftmenu-text-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

/* === ТИПОГРАФИКА === */

.bsftmenu-text-content h1,
.bsftmenu-text-content h2,
.bsftmenu-text-content h3,
.bsftmenu-text-content h4,
.bsftmenu-text-content h5,
.bsftmenu-text-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.2;
    font-weight: 600;
}

.bsftmenu-text-content h1:first-child,
.bsftmenu-text-content h2:first-child,
.bsftmenu-text-content h3:first-child,
.bsftmenu-text-content h4:first-child,
.bsftmenu-text-content h5:first-child,
.bsftmenu-text-content h6:first-child {
    margin-top: 0;
}

.bsftmenu-text-content h1 { font-size: 2em; }
.bsftmenu-text-content h2 { font-size: 1.75em; }
.bsftmenu-text-content h3 { font-size: 1.5em; }
.bsftmenu-text-content h4 { font-size: 1.25em; }
.bsftmenu-text-content h5 { font-size: 1.1em; }
.bsftmenu-text-content h6 { font-size: 1em; }

.bsftmenu-text-content p {
    margin-bottom: 1em;
}

.bsftmenu-text-content p:last-child {
    margin-bottom: 0;
}

/* === СПИСКИ === */

.bsftmenu-text-content ul,
.bsftmenu-text-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.bsftmenu-text-content ul li {
    list-style-type: disc;
    margin-bottom: 0.5em;
}

.bsftmenu-text-content ol li {
    list-style-type: decimal;
    margin-bottom: 0.5em;
}

.bsftmenu-text-content li:last-child {
    margin-bottom: 0;
}

/* === ССЫЛКИ === */

.bsftmenu-text-content a {
    color: #0073aa;
    transition: color 0.2s ease;
}

.bsftmenu-text-content a:hover {
    color: #005a87;
}

.bsftmenu-text-content a:visited {
    color: #6c3791;
}

/* === ИЗОБРАЖЕНИЯ === */

.bsftmenu-text-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bsftmenu-text-content .wp-caption {
    max-width: 100%;
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    padding: 5px;
    border-radius: 4px;
    margin: 1em 0;
}

.bsftmenu-text-content .wp-caption img {
    display: block;
    margin: 0 auto;
    box-shadow: none;
}

.bsftmenu-text-content .wp-caption-text {
    font-size: 0.9em;
    color: #666;
    text-align: center;
    margin-top: 5px;
    font-style: italic;
}

/* === ГАЛЕРЕИ === */

.bsftmenu-text-content .gallery {
    display: grid;
    grid-gap: 15px;
    margin: 1.5em 0;
}

.bsftmenu-text-content .gallery-columns-1 { grid-template-columns: 1fr; }
.bsftmenu-text-content .gallery-columns-2 { grid-template-columns: repeat(2, 1fr); }
.bsftmenu-text-content .gallery-columns-3 { grid-template-columns: repeat(3, 1fr); }
.bsftmenu-text-content .gallery-columns-4 { grid-template-columns: repeat(4, 1fr); }
.bsftmenu-text-content .gallery-columns-5 { grid-template-columns: repeat(5, 1fr); }
.bsftmenu-text-content .gallery-columns-6 { grid-template-columns: repeat(6, 1fr); }

.bsftmenu-text-content .gallery-item {
    text-align: center;
}

.bsftmenu-text-content .gallery-icon img {
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.bsftmenu-text-content .gallery-icon a:hover img {
    transform: scale(1.05);
}

.bsftmenu-text-content .gallery-caption {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
}

/* === ЦИТАТЫ === */

.bsftmenu-text-content blockquote {
    margin: 1.5em 0;
    padding: 1em 1.5em;
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    font-style: italic;
    position: relative;
}

.bsftmenu-text-content blockquote p {
    margin: 0;
    font-size: 1.1em;
}

.bsftmenu-text-content blockquote cite {
    display: block;
    text-align: right;
    margin-top: 1em;
    font-style: normal;
    font-size: 0.9em;
    color: #666;
}

.bsftmenu-text-content blockquote cite:before {
    content: "— ";
}

/* === КОД === */

.bsftmenu-text-content code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9em;
}

.bsftmenu-text-content pre {
    background: #f8f8f8;
    border: 1px solid #e1e1e1;
    padding: 1em;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.5em 0;
}

.bsftmenu-text-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

/* === ТАБЛИЦЫ === */

.bsftmenu-text-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    border: 1px solid #e1e1e1;
}

.bsftmenu-text-content th,
.bsftmenu-text-content td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e1e1;
}

.bsftmenu-text-content th {
    background: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #e1e1e1;
}

.bsftmenu-text-content tr:hover {
    background: #f9f9f9;
}

/* === ФОРМАТИРОВАНИЕ === */

.bsftmenu-text-content strong,
.bsftmenu-text-content b {
    font-weight: 600;
}

.bsftmenu-text-content em,
.bsftmenu-text-content i {
    font-style: italic;
}

.bsftmenu-text-content u {
    text-decoration: underline;
}

.bsftmenu-text-content del,
.bsftmenu-text-content s {
    text-decoration: line-through;
}

.bsftmenu-text-content mark {
    background: #fff3cd;
    padding: 1px 4px;
    border-radius: 2px;
}

/* === ВЫРАВНИВАНИЕ === */

.bsftmenu-text-content .alignleft {
    float: left;
    margin: 0 1.5em 1em 0;
}

.bsftmenu-text-content .alignright {
    float: right;
    margin: 0 0 1em 1.5em;
}

.bsftmenu-text-content .aligncenter {
    display: block;
    margin: 1em auto;
    text-align: center;
}

.bsftmenu-text-content .alignnone {
    margin: 1em 0;
}

/* === CLEARFIX === */

.bsftmenu-text-content:after {
    content: "";
    display: table;
    clear: both;
}

/* === АДАПТИВНОСТЬ === */

@media (max-width: 768px) {
    .bsftmenu-text-content {
        font-size: 14px;
    }
    
    .bsftmenu-text-content h1 { font-size: 1.75em; }
    .bsftmenu-text-content h2 { font-size: 1.5em; }
    .bsftmenu-text-content h3 { font-size: 1.25em; }
    
    .bsftmenu-text-content .gallery-columns-3 { grid-template-columns: repeat(2, 1fr); }
    .bsftmenu-text-content .gallery-columns-4 { grid-template-columns: repeat(2, 1fr); }
    .bsftmenu-text-content .gallery-columns-5 { grid-template-columns: repeat(2, 1fr); }
    .bsftmenu-text-content .gallery-columns-6 { grid-template-columns: repeat(3, 1fr); }
    
    .bsftmenu-text-content .alignleft,
    .bsftmenu-text-content .alignright {
        float: none;
        display: block;
        margin: 1em auto;
    }
    
    .bsftmenu-text-content blockquote {
        padding: 0.75em 1em;
    }
    
    .bsftmenu-text-content table {
        font-size: 0.9em;
    }
    
    .bsftmenu-text-content th,
    .bsftmenu-text-content td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .bsftmenu-text-content .gallery-columns-2 { grid-template-columns: 1fr; }
    .bsftmenu-text-content .gallery-columns-3 { grid-template-columns: 1fr; }
    .bsftmenu-text-content .gallery-columns-4 { grid-template-columns: 1fr; }
    .bsftmenu-text-content .gallery-columns-5 { grid-template-columns: 1fr; }
    .bsftmenu-text-content .gallery-columns-6 { grid-template-columns: 1fr; }
    
    .bsftmenu-text-content pre {
        font-size: 0.8em;
        padding: 0.75em;
    }
}

/* === СТИЛИ ДЛЯ АДМИНКИ === */

.bsftmenu-text-editor-container {
    margin: 10px 0;
}

.bsftmenu-wp-editor-wrapper {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.bsftmenu-wp-editor-wrapper .wp-editor-wrap {
    border: none;
}

.bsftmenu-wp-editor-wrapper .wp-media-buttons {
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e1e1;
}

.bsftmenu-wp-editor-wrapper .wp-editor-tabs {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e1e1;
    padding: 0 12px;
}

.bsftmenu-wp-editor-wrapper .wp-editor-container {
    background: #fff;
}

.bsftmenu-wp-editor-wrapper .wp-editor-area {
    border: none;
    box-shadow: none;
    resize: vertical;
}

/* Улучшенные стили для WordPress редактора в админке */
.wp-editor-wrap[id*="bsftmenu_text_content"] {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .wp-media-buttons {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e1e1;
    padding: 8px 12px;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .wp-editor-tabs {
    background: #f0f0f1;
    border-bottom: 1px solid #e1e1e1;
    margin: 0;
    padding: 0;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .wp-switch-editor {
    background: transparent;
    border: none;
    color: #646970;
    cursor: pointer;
    font-size: 13px;
    line-height: 2.15384615;
    margin: 0;
    padding: 3px 8px 4px;
    position: relative;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .wp-switch-editor.active {
    background: #fff;
    color: #1d2327;
    box-shadow: 0 -3px 0 #007cba inset;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .wp-editor-container {
    background: #fff;
    position: relative;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .wp-editor-area {
    border: none;
    box-shadow: none;
    outline: none;
    resize: vertical;
    width: 100%;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.4;
    padding: 10px;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .quicktags-toolbar {
    background: #f6f7f7;
    border-bottom: 1px solid #e1e1e1;
    padding: 5px;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .quicktags-toolbar input {
    margin: 0 1px;
    padding: 2px 4px;
    font-size: 11px;
    line-height: 1.4;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    cursor: pointer;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .quicktags-toolbar input:hover {
    background: #f6f7f7;
    border-color: #8c8f94;
}

/* КРИТИЧЕСКИ ВАЖНО: Переопределяем WordPress стили для текста в TinyMCE */
.js .tmce-active .wp-editor-area,
.wp-editor-wrap[id*="bsftmenu_text_content"] .wp-editor-area,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body *,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body p,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body div,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body span,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body h1,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body h2,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body h3,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body h4,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body h5,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body h6,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body li,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body ul,
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body ol,
.bsftmenu-tinymce-content,
.bsftmenu-tinymce-content * {
    color: #333 !important;
    background: transparent !important;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-content-body {
    background-color: #fff !important;
}

/* TinyMCE стили */
.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-tinymce {
    border: none !important;
    box-shadow: none !important;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-toolbar-grp {
    background: #f6f7f7 !important;
    border-bottom: 1px solid #e1e1e1 !important;
}

.wp-editor-wrap[id*="bsftmenu_text_content"] .mce-edit-area {
    padding: 10px !important;
}

/* Fallback редактор */
.bsftmenu-text-editor-fallback {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    padding: 15px;
}

.bsftmenu-text-editor-fallback textarea {
    width: 100%;
    min-height: 300px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 10px;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.4;
    resize: vertical;
}

.bsftmenu-text-editor-fallback textarea:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
    outline: none;
}
