/* editor_components.css — Вынесенные статические стили шаблона Скин-Редактора */

/* Прячем мобильную кнопку на обычных экранах компьютеров */
.mobile-menu-toggle-btn {
    display: none !important;
}

.editor-main-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
    background: #0b0f19;
}

/* ФИКСИРОВАННЫЙ САЙДБАР (FIGMA STYLE) */
.sidebar { 
    width: 440px; /* 440 Ширина сайдбара зафиксирована по стандарту Blender/Spine */
    background: #111827; 
    padding: 12px 16px; 
    display: flex; 
    flex-direction: column; 
    border-right: 1px solid #1f2937; 
    box-sizing: border-box;
    z-index: 10;
    height: 100vh;
    overflow-y: auto; /* <--- 1. Включаем умный вертикальный скролл всей панели */
}

h2 {
    margin-top: 2px; 
    margin-bottom: 6px;
    font-size: 20px;
    color: #f8fafc;
}

.editor-top-controls {
    margin-bottom: 6px; 
    background: #0f172a;
    padding: 8px; 
    border-radius: 6px;
    border: 1px solid #334155;
    flex-shrink: 0; /* Шапка управления никогда не сжимается */
}

.btn-back-orbit {
    width: 100%;
    margin-bottom: 8px; 
    background: rgba(148, 163, 184, 0.2);
    border: 1px solid #94a3b8;
    color: #fff;
    border-radius: 4px;
    padding: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 11px;
}

.editor-label-primary {
    color: #00ffcc;
    font-weight: bold;
    margin-bottom: 4px; 
    display: block;
}

.editor-label-secondary {
    color: #94a3b8;
    font-size: 11px;
    display: block;
    margin-bottom: 2px; 
}

.editor-select-skin {
    width: 100%;
    margin-bottom: 8px; 
    background: #0d1117;
    border: 1px solid #30363d;
    color: #fff;
    padding: 5px; 
    border-radius: 4px;
}

.editor-input-name {
    width: 100%;
    background: #0d1117;
    border: 1px solid #334155;
    color: #fff;
    padding: 5px; 
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 6px; 
}

.editor-btn-group {
    display: flex;
    gap: 6px;
    margin-bottom: 6px; 
}

.editor-btn-group button {
    flex: 1;
    font-size: 11px;
    padding: 5px; 
    color: #fff;
    margin: 0;
}

.btn-db-save-all {
    width: 100%;
    background: rgba(0, 255, 204, 0.2);
    border: 1px solid #00ffcc;
    color: #fff;
    border-radius: 4px;
    padding: 6px; 
    cursor: pointer;
    font-weight: bold;
    font-size: 11px;
    margin: 0;
}

.editor-section-divider {
    border-top: 1px solid #1f2937;
    margin: 6px 0; 
    flex-shrink: 0;
}

/* ДОК А: ЗОНА ДЕТАЛЕЙ */
.editor-layers-section {
    flex: 1; /* Автоматически забирает ВСЕ свободное вертикальное место до пикселя */
    min-height: 150px; /* Безопасный минимальный размер для маленьких экранов */
    display: flex;
    flex-direction: column;
}

/* Контейнер прокрутки деталей внутри резиновой зоны Дока А */
.editor-scroll-container {
    flex: 1;
    overflow-y: auto; 
    padding-right: 4px;
    margin-top: 4px; 
}

/* ДОК Б: ЗОНА ИНСПЕКТОР СВОЙСТВ (зафиксирована по высоте) */
.editor-inspector-section {
    flex-shrink: 0; /* Инспектор свойств больше никогда не сжимается и не урезается */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Тонкие кастомные скроллбары Figma-style */
.editor-scroll-container::-webkit-scrollbar { 
    width: 8px; 
}
.editor-scroll-container::-webkit-scrollbar-track { 
    background: transparent; 
}
.editor-scroll-container::-webkit-scrollbar-thumb { 
    background: #374151; 
    border-radius: 4px; 
}
.editor-scroll-container::-webkit-scrollbar-thumb:hover { 
    background: #00ffcc; 
}

/* Профессиональный кастомный скроллбар для ВСЕЙ панели сайдбара */
.sidebar::-webkit-scrollbar { 
    width: 6px; /* Фирменная профессиональная толщина */
}
.sidebar::-webkit-scrollbar-track { 
    background: transparent; 
}
.sidebar::-webkit-scrollbar-thumb { 
    background: rgba(55, 65, 81, 0.4); /* Мягкий, полупрозрачный серый цвет */
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover { 
    background: #00ffcc; /* Фирменный неоновый цвет при наведении */
}

.editor-layers-list {
    display: flex;
    flex-direction: column;
}

/* СТИЛИ ПЛАШЕК СЛОЕВ И ИТЕРФЕЙСА АКТИВНОСТИ */
.layer-item {
    padding: 8px; 
    margin-bottom: 4px; 
    background: #1f2937;
    border-radius: 6px;
    cursor: pointer;
    border-left: 4px solid #374151;
    transition: all 0.15s ease;
}
.layer-item:hover { 
    background: #374151; 
}

.layer-item.active { 
    border-left-color: #ff007f !important; 
    background: #2d3748 !important;
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.15);
}

.editor-layer-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-layer-name {
    color: #fff;
    font-size: 12px; 
}

.editor-layer-delete {
    color: #ef4444;
    cursor: pointer;
    font-size: 13px; 
    padding: 0 4px;
}
.editor-layer-delete:hover { color: #f87171; }

.editor-control-panel {
    background: #1f2937;
    padding: 12px; 
    border-radius: 8px;
    border: 1px solid #2d3748;
    box-sizing: border-box;
}

.editor-control-title {
    color: #00ffcc;
    margin-top: 0;
    font-size: 13px; 
    margin-bottom: 8px; 
}

/* ДВУХКОЛОНОЧНАЯ СЕТКА FIGMA-STYLE */
.editor-prop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 12px; 
    margin-bottom: 6px; 
    box-sizing: border-box;
}

.editor-compact-row {
    background: #111827;
    padding: 4px 6px; 
    border-radius: 4px;
    border: 1px solid #1f2937;
    display: flex;
    align-items: center;
    gap: 4px;
    box-sizing: border-box;
    width: 100%; 
}

.editor-compact-label {
    color: #ff007f;
    font-size: 10px;
    font-weight: bold;
    font-family: monospace;
    width: 10px;
    flex-shrink: 0;
}

.editor-range-input {
    flex: 1;
    min-width: 0 !important; 
    max-width: 100% !important; /* <--- 1. ДОБАВЬТЕ ЭТУ СТРОЧКУ */
    width: 100% !important;     /* <--- 2. ДОБАВЬТЕ ЭТУ СТРОЧКУ */
    margin: 0 !important; 
    padding: 0 !important;
    cursor: pointer;
    height: 4px;
}

.editor-compact-value {
    color: #00ffcc;
    font-size: 10px;
    font-weight: bold;
    font-family: monospace;
    width: 32px; 
    text-align: right;
    flex-shrink: 0;
}

.editor-control-label {
    color: #94a3b8;
    display: block;
    font-size: 11px;
    margin-bottom: 3px; 
}

.editor-color-input {
    width: 100%;
    background: none;
    border: none;
    height: 24px; 
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.editor-output-title {
    margin: 6px 0 4px 0; 
    color: #ff007f;
    font-size: 11px; 
}

.editor-tool-btn {
    flex: 1;
    font-size: 11px;
    padding: 5px; 
    color: #fff;
    font-weight: bold;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background 0.1s, opacity 0.2s;
}
.editor-tool-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.btn-tool-z { background: #475569; }
.btn-tool-z:hover:not(:disabled) { background: #64748b; }

.btn-tool-clone { background: #10b981; }
.btn-tool-clone:hover { background: #059669; }

.btn-tool-mirror { background: #8b5cf6; }
.btn-tool-mirror:hover { background: #7c3aed; }

/* ВСПЛЫВАЮЩЕЕ МОДАЛЬНОЕ ОКНО ЭКСПОРТА KOДA */
.editor-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.editor-modal-window {
    width: 600px;
    background: #1f2937;
    border: 1px solid #ff007f;
    box-shadow: 0 0 25px rgba(255, 0, 127, 0.25);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.editor-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.editor-modal-title {
    margin: 0;
    font-size: 16px;
    color: #ff007f;
    font-weight: bold;
}

.editor-modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.15s;
}
.editor-modal-close:hover { color: #fff; }

.editor-modal-textarea {
    width: 100%;
    height: 350px;
    background: #090d16;
    color: #00ffcc;
    border: 1px solid #374151;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    resize: none;
    padding: 12px;
    box-sizing: border-box;
}

.editor-modal-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 8px;
    text-align: left;
}

.editor-layer-name-input {
    width: 100%;
    background: #0d1117;
    border: 1px solid #30363d;
    color: #fff;
    padding: 6px 10px; 
    border-radius: 4px;
    box-sizing: border-box; /* Гарантирует идеальный отступ справа */
    font-size: 12px;
    transition: border-color 0.15s ease;
}

/* Красивая подсветка при клике на поле */
.editor-layer-name-input:focus {
    border-color: #00ffcc;
    outline: none;
}
/* =========================================================================
   📱 ЧИСТЫЙ И ОПТИМИЗИРОВАННЫЙ МОБИЛЬНЫЙ БЛОК (Экраны до 768px)
   ========================================================================= */
@media (max-width: 767px) {
    
    /* 1. ГЛАВНЫЙ КОНТЕЙНЕР И КНОПКА УПРАВЛЕНИЯ */
    .editor-main-layout {
        flex-direction: column;
        overflow: hidden;
    }

    .mobile-menu-toggle-btn {
        display: block !important;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 9999 !important;
        background: #111827;
        color: #00ffcc;
        border: 2px solid #00ffcc;
        padding: 12px 20px;
        border-radius: 25px;
        font-weight: bold;
        font-size: 14px;
        box-shadow: 0 4px 20px rgba(0, 255, 204, 0.4);
        cursor: pointer;
    }

    /* 2. ТРАНСФОРМАЦИЯ САЙДБАРА В ВЫЕЗЖАЮЩУЮ ШТОРКУ */
    .sidebar {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100% !important;
        height: 70vh !important;
        background: #0b0f19 !important;
        border-right: none;
        border-top: 2px solid #ff007f;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 1000 !important;
        padding: 16px !important;
        overflow-y: auto !important;
        box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.7);
    }

    .sidebar.mobile-visible {
        transform: translateY(0) !important;
    }

    /* 3. ШАПКА ШТОРКИ И КРУПНЫЕ КНОПКИ ТУЛБАРА */
    .sidebar-mobile-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        border-bottom: 1px solid #1f2937;
        padding-bottom: 8px;
    }

    .mobile-close-sidebar-btn {
        display: block !important;
        background: none;
        border: none;
        color: #ef4444;
        font-size: 24px;
        font-weight: bold;
        cursor: pointer;
    }

    .btn-back-orbit, .btn-db-save-all, .editor-select-skin, .editor-layers-section button {
        height: 42px !important;
        font-size: 13px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .desktop-only-dots-btn, .hide-on-mobile {
        display: none !important;
    }

    /* 4. ВСТРОЕННОЕ МЕНЮ ДЕЙСТВИЙ (БЫВШИЙ DROPDOWN) */
    .sidebar .editor-top-controls div[style*="position: absolute"] {
        position: relative !important;
        top: 0 !important;
        right: 0 !important;
        width: 100% !important;
        box-shadow: none !important;
        background: #0f172a !important;
        margin-top: 10px;
        margin-bottom: 12px;
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        padding: 6px !important;
        border: 1px solid #1f2937;
        box-sizing: border-box;
    }

    .sidebar .editor-top-controls div[style*="position: absolute"] div {
        font-size: 11px !important;
        padding: 10px 4px !important;
        text-align: center;
        background: #1e293b !important;
        border-radius: 6px !important;
        min-height: 40px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .sidebar .editor-top-controls div[style*="position: absolute"] div[style*="border-top"] {
        display: none !important;
    }

    /* 5. УПРАВЛЕНИЕ СЛОЯМИ */
    .editor-layers-section {
        flex: none !important;
        height: auto !important;
    }

    .editor-scroll-container {
        max-height: 18vh !important;
        overflow-y: auto !important;
    }

    .layer-item {
        padding: 12px !important;
    }

    .editor-layer-name {
        font-size: 14px;
    }

    .editor-layer-delete {
        font-size: 18px;
        padding: 4px 10px;
    }

    /* 6. БАЗОВАЯ СЕТКА ИНСПЕКТОРA И ПОЛЗУНКИ */
    .editor-prop-grid {
        display: grid !important;
        width: 100% !important;
        box-sizing: border-box !important;
        gap: 12px !important;
    }

    /* Ползунки X, Y, R, W выстраиваем в одну колонку на мобилке */
    .editor-prop-grid.adaptive-prop-row {
        grid-template-columns: 1fr !important;
        margin-bottom: 8px !important;
    }

    /* Крупный сенсорный вид для строк ползунков */
    .editor-compact-row {
        display: grid !important;
        grid-template-columns: 24px 1fr 45px !important; /* Метка, резиновый трек, пиксели */
        height: 44px !important; /* Удобная высота под большой палец */
        padding: 0 12px !important;
        background: #0f172a !important;
        border-radius: 6px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    .editor-compact-label {
        font-size: 13px !important;
    }

    .editor-compact-value {
        font-size: 12px !important;
        text-align: right !important;
    }

    /* СУПЕР-ПОЛЗУНОК: увеличиваем кругляшок захвата */
    .editor-range-input {
        -webkit-appearance: none !important;
        appearance: none !important;
        height: 6px !important;
        background: #334155 !important;
        border-radius: 3px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Кругляшок захвата размером 22px по стандартам Apple/Google */
    .editor-range-input::-webkit-slider-thumb {
        -webkit-appearance: none !important;
        appearance: none !important;
        width: 22px !important;
        height: 22px !important;
        border-radius: 50% !important;
        background: #00ffcc !important;
        box-shadow: 0 2px 6px rgba(0,0,0,0.6) !important;
    }

    .editor-range-input::-moz-range-thumb {
        width: 22px !important;
        height: 22px !important;
        border-radius: 50% !important;
        background: #00ffcc !important;
        box-shadow: 0 2px 6px rgba(0,0,0,0.6) !important;
        border: none !important;
    }

    /* 7. ОСОБАЯ СЕТКА: ФИГУРА И ЦВЕТ */
    .editor-prop-grid[style*="align-items: center"] {
        grid-template-columns: 2fr 1fr !important; /* Фигура крупнее, цвет компактнее */
        margin-bottom: 14px !important;
    }

    /* Селект выбора фигуры растягиваем на всю левую половину */
    .sidebar .editor-prop-grid[style*="align-items: center"] select {
        width: 100% !important;
        height: 42px !important;
        font-size: 14px !important;
        box-sizing: border-box !important;
    }

    /* Растягиваем инпут цвета на всю ширину его колонки (как в оригинале) */
    .editor-color-input {
        width: 100% !important;
        max-width: 100% !important;
        height: 42px !important;
        background: #1f2937 !important;
        border: 1px solid #3b82f6 !important;
        border-radius: 6px !important;
        padding: 2px !important;
        display: block !important;
        box-sizing: border-box !important;
    }

    /* 8. КНОПКИ ГЛУБИНЫ И ТРАНСФОРМАЦИИ */
    .editor-btn-group {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .editor-tool-btn {
        height: 42px !important;
        font-size: 13px !important;
        margin: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 9. МОДАЛЬНОЕ ОКНО ЭКСПОРТА КОДА */
    .editor-modal-window {
        width: 92% !important;
        max-height: 85vh;
        padding: 14px;
    }

    .editor-modal-textarea {
        height: 50vh !important;
        font-size: 11px;
    }
}
