﻿/* =========================================
   NOTA PROFILE EDITOR — profile-editor.css
   ========================================= */

/* ── Модалка с HTML-кодом — прикреплена к тулбару ── */

.nota-modal-overlay {
    position: fixed;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}
.nota-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nota-modal-window {
    background: var(--pun);
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    width: 420px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 1px 5px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text1);
}
.nota-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #2a2a2a;
    padding-bottom: 10px;
}
.nota-modal-title {
    font-weight: 600;
    font-family: system-ui, sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text2);
}
.nota-modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    color: var(--text2);
    transition: color 0.15s ease;
}
.nota-modal-close:hover { color: var(--text1); }

.nota-modal-apply {
    background: #1b5e20;
    border: none;
    color: #fff;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.nota-modal-apply:hover { background: #2e7d32; }

.nota-modal-window .nota-html-textarea {
    width: 100%;
    height: 250px;
    border: 1px solid #333 !important;
    font-family: 'Courier New', monospace !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    padding: 12px !important;
    border-radius: 6px !important;
    box-sizing: border-box;
    resize: vertical;
    background: #0d0d0d !important;
    color: #e8e8e8 !important;
    -webkit-text-fill-color: #e8e8e8 !important;
}
.nota-modal-window .nota-html-textarea:focus {
    border-color: #ca4949 !important;
    background: #0d0d0d !important;
    outline: none;
}
.nota-modal-window .nota-html-textarea::placeholder {
    color: #555 !important;
    -webkit-text-fill-color: #555 !important;
}
.nota-modal-hint {
    font-size: 10px;
    font-family: system-ui, sans-serif;
    color: var(--text2);
}

/* ── Базовый контейнер поля ── */

.pa-fld2 {
    position: relative;
    transition: background 0.2s ease;
    border-radius: 4px;
    padding: 4px;
    display: block !important;
    overflow: visible;
}
.pa-fld2:hover {
    background: rgba(255, 255, 255, 0.05);
}
.pa-fld2[data-nota-editing="true"] {
    outline: 1px dashed #444 !important;
    background: rgba(0, 0, 0, 0.08) !important;
    resize: vertical;
    overflow: hidden;
}
.pa-fld2[data-nota-editing="true"] a {
    pointer-events: none !important;
    cursor: text !important;
}

/* ── #cv статичен ── */

.pa-fld2 #cv.nota-editable-block {
    display: block !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    margin: 0 0 8px 0 !important;
    cursor: default !important;
    pointer-events: auto;
    transform: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* ── Редактируемые фрагменты ── */

.nota-editable-block {
    display: block;
    min-height: 18px;
    border-radius: 2px;
    padding: 2px 4px;
    box-sizing: border-box;
    position: relative;
    transition: box-shadow 0.2s ease, background 0.2s ease;
}
.pa-fld2[data-nota-editing="true"] .nota-editable-block:not(#cv) {
    cursor: pointer;
}
.pa-fld2[data-nota-editing="true"] .nota-editable-block:not(#cv):hover {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 0 0 1px #555;
}
.pa-fld2[data-nota-editing="true"] .nota-editable-block.nota-block-active {
    outline: none !important;
    box-shadow: 0 0 0 1px #ca4949 !important;
    background: rgba(202, 73, 73, 0.05) !important;
}

/* Ползунок изменения ширины */
.pa-fld2[data-nota-editing="true"] .nota-editable-block:not(#cv)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: e-resize;
    background: transparent;
    transition: background 0.2s;
}
.pa-fld2[data-nota-editing="true"] .nota-editable-block.nota-block-active:not(#cv)::after {
    background: rgba(202, 73, 73, 0.3);
}

/* ── Кнопка-карандаш ── */

.nota-editor-trigger {
    position: absolute;
    right: 6px;
    top: 6px;
    opacity: 0;
    visibility: hidden;
    cursor: pointer;
    background: #121212;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 3px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1010;
}
.pa-fld2:hover .nota-editor-trigger { opacity: 1; visibility: visible; }
.nota-editor-trigger:hover { background: #ca4949; border-color: #ca4949; }
.nota-editor-trigger svg { fill: #fff; width: 12px; height: 12px; }

/* ── Тулбар ── */

.nota-figma-toolbar {
    position: absolute;
    background: #121212;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 1px 5px rgba(0,0,0,0.4);
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 9999;
    font-family: system-ui, -apple-system, sans-serif;
    opacity: 0;
    transform: translateY(6px) scale(0.97);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    flex-wrap: wrap;
    max-width: 520px;
}
.nota-figma-toolbar.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.nota-toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
    border-right: 1px solid #2a2a2a;
    padding-right: 6px;
    margin-right: 2px;
}
.nota-toolbar-group:last-child { border-right: none; padding-right: 0; margin-right: 0; }

/* Маленькая подпись группы */
.nota-group-label {
    font-size: 8px;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 2px;
    user-select: none;
}

/* ── Кнопки, селекты, инпуты ── */

.nota-tb-btn, .nota-tb-select, .nota-tb-input {
    background: transparent;
    border: 1px solid transparent;
    color: #b3b3b3;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    box-sizing: border-box;
    transition: all 0.15s ease;
}
.nota-tb-btn:hover { background: #222; color: #fff; }
.nota-tb-btn.active { background: #ca4949; color: #fff; }
.nota-tb-select { background: #1a1a1a; border: 1px solid #2a2a2a; color: #fff; }
.nota-tb-select:hover { background: #222; }
.nota-tb-input {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    width: 42px;
    text-align: center;
    color: #fff;
}
.nota-tb-input:focus { border-color: #ca4949; outline: none; }

/* Маленькая подпись у инпута (LS, T, L) */
.nota-tb-label {
    font-size: 9px;
    color: #444;
    text-transform: uppercase;
    user-select: none;
    padding: 0 1px;
}

/* ── Цветовые пикеры ── */

.nota-color-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    color: #555;
    cursor: pointer;
}
.nota-color-wrapper input[type="color"] {
    opacity: 0;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}
.nota-color-preview {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid #333;
    flex-shrink: 0;
}
.nota-color-label {
    font-size: 9px;
    color: #555;
    text-transform: uppercase;
    user-select: none;
    font-family: system-ui, sans-serif;
}

/* ── Специальные кнопки ── */

.nota-tb-add-block {
    background: rgba(202, 73, 73, 0.12);
    color: #ff8a80;
    font-weight: bold;
    gap: 4px;
}
.nota-tb-add-block:hover { background: #ca4949; color: #fff; }

.nota-tb-btn[id="nota-delete-block-btn"] { color: #ef5350; }
.nota-tb-btn[id="nota-delete-block-btn"]:hover { background: rgba(239, 83, 80, 0.15); color: #ff6b6b; }

.nota-tb-cancel {
    color: #666;
    border: 1px solid #2a2a2a;
}
.nota-tb-cancel:hover { background: #1a1a1a; color: #aaa; }

.nota-tb-save {
    background: #1b5e20;
    color: #fff;
    font-weight: bold;
    border: none;
}
.nota-tb-save:hover { background: #2e7d32; color: #fff; }

/* ── Счётчик символов ── */

.nota-char-counter {
    font: 600 11px system-ui, sans-serif;
    color: #777;
    padding: 0 4px;
    white-space: nowrap;
    user-select: none;
    letter-spacing: 0.3px;
    transition: color 0.15s ease;
}
.nota-char-counter.nota-counter-warn { color: #ffb74d; }
.nota-char-counter.nota-counter-over { color: #ff5252; font-weight: 700; }

/* ── Кнопка «Сжать код» ── */

.nota-tb-compress {
    color: #64b5f6;
    background: rgba(100, 181, 246, 0.10);
}
.nota-tb-compress:hover {
    background: #1565c0;
    color: #fff;
}

/* ── Инлайн-поле для URL ── */

.nota-url-group {
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.25s ease, opacity 0.2s ease;
    pointer-events: none;
}
.nota-url-group.visible {
    max-width: 200px;
    opacity: 1;
    pointer-events: auto;
}
.nota-url-input {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #fff;
    border-radius: 4px;
    padding: 4px 7px;
    font-size: 11px;
    height: 24px;
    box-sizing: border-box;
    width: 155px;
    font-family: 'Courier New', monospace;
    transition: border-color 0.15s ease;
}
.nota-url-input:focus {
    border-color: #ca4949;
    outline: none;
}
.nota-url-confirm {
    color: #81c784;
    font-size: 14px;
    padding: 2px 6px;
}
.nota-url-confirm:hover { background: #1b5e20; color: #fff; }

/* ── Toast-уведомление ── */

.nota-editor-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 10px 14px 10px 12px;
    font: 400 12px var(--font, system-ui);
    color: #ccc;
    z-index: 100001;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    max-width: 320px;
    border-left: 3px solid #2a2a2a;
}
.nota-editor-toast.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.nota-editor-toast.nota-toast-success { border-left-color: #2e7d32; }
.nota-editor-toast.nota-toast-error { border-left-color: #b71c1c; color: #ef9a9a; }
.nota-editor-toast.nota-toast-info { border-left-color: #1565c0; }

.nota-toast-text { flex: 1; line-height: 1.4; }

.nota-toast-close {
    cursor: pointer;
    color: #444;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s ease;
    font-family: Arial, sans-serif;
}
.nota-toast-close:hover { color: #aaa; }

/* ============================================================
   ПЕРЕОПРЕДЕЛЕНИЯ ПОД КИНГС
   Глобальные правила форума (button/input/select { ... !important })
   перебивали стиль тулбара (кнопки становились бирюзовыми, инпуты
   с пунктиром). Возвращаем тёмный читабельный вид с !important.
   ============================================================ */

.nota-figma-toolbar .nota-tb-btn,
.nota-figma-toolbar button.nota-tb-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: #cfcfcf !important;
    border-radius: 4px !important;
    padding: 4px 6px !important;
    height: 24px !important;
    width: auto !important;
    min-width: 0 !important;
    font: 500 12px system-ui, sans-serif !important;
    text-transform: none !important;
    filter: none !important;
    box-shadow: none !important;
    letter-spacing: 0 !important;
}
.nota-figma-toolbar .nota-tb-btn:hover { background: #262626 !important; color: #fff !important; }
.nota-figma-toolbar .nota-tb-btn.active { background: #ca4949 !important; color: #fff !important; }

.nota-figma-toolbar .nota-tb-add-block {
    background: rgba(202,73,73,0.16) !important;
    color: #ff8a80 !important;
}
.nota-figma-toolbar .nota-tb-add-block:hover { background: #ca4949 !important; color: #fff !important; }

.nota-figma-toolbar .nota-tb-cancel { color: #9a9a9a !important; border: 1px solid #2a2a2a !important; }
.nota-figma-toolbar .nota-tb-cancel:hover { background: #1a1a1a !important; color: #ddd !important; }

.nota-figma-toolbar .nota-tb-save { background: #1b5e20 !important; color: #fff !important; }
.nota-figma-toolbar .nota-tb-save:hover { background: #2e7d32 !important; color: #fff !important; }

.nota-figma-toolbar #nota-delete-block-btn { color: #ef5350 !important; }
.nota-figma-toolbar #nota-delete-block-btn:hover { background: rgba(239,83,80,0.18) !important; color: #ff6b6b !important; }

.nota-figma-toolbar .nota-tb-select,
.nota-figma-toolbar select.nota-tb-select {
    background: #1a1a1a !important;
    border: 1px solid #2a2a2a !important;
    color: #fff !important;
    height: 24px !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font: 400 12px system-ui, sans-serif !important;
}

.nota-figma-toolbar .nota-tb-input,
.nota-figma-toolbar input.nota-tb-input {
    background: #1a1a1a !important;
    border: 1px solid #2a2a2a !important;
    color: #fff !important;
    height: 24px !important;
    padding: 2px 4px !important;
    border-radius: 4px !important;
    text-align: center !important;
    font: 400 12px system-ui, sans-serif !important;
}
.nota-figma-toolbar .nota-tb-input:focus,
.nota-figma-toolbar .nota-tb-select:focus { border-color: #ca4949 !important; outline: none !important; }

/* URL-инпут вставки ссылки */
.nota-figma-toolbar .nota-url-input {
    background: #1a1a1a !important;
    border: 1px solid #2a2a2a !important;
    color: #fff !important;
    border-radius: 4px !important;
    padding: 2px 6px !important;
    font: 400 12px system-ui, sans-serif !important;
}

/* Подписи групп/инпутов — читаемее на тёмном */
.nota-figma-toolbar .nota-group-label,
.nota-figma-toolbar .nota-tb-label,
.nota-figma-toolbar .nota-color-label { color: #888 !important; }
.nota-figma-toolbar .nota-char-counter { color: #9a9a9a !important; }

/* Модалка HTML-кода: кнопка применить и поле */
.nota-modal-window .nota-modal-apply {
    background: #1b5e20 !important;
    color: #fff !important;
    border: none !important;
    filter: none !important;
    text-transform: none !important;
    padding: 4px 10px !important;
    width: auto !important;
}
.nota-modal-window .nota-modal-apply:hover { background: #2e7d32 !important; }
.nota-modal-window .nota-html-textarea {
    background: #0d0d0d !important;
    color: #e8e8e8 !important;
    border: 1px solid #333 !important;
}

/* ============================================================
   МОБИЛЬНАЯ ТЕМА: ЛЗ скрыто полностью, редактор не показывается.
   Наш .pa-fld2{display:block!important} перебивал скрытие мобильной
   темы — здесь возвращаем display:none и прячем UI редактора.
   ============================================================ */
@media screen and (max-width: 720px) {
    .pa-fld2,
    .pa-fld2[data-nota-editing="true"] { display: none !important; }
    .nota-editor-trigger,
    .nota-figma-toolbar,
    .nota-modal-overlay { display: none !important; }
}
