/* ===== Стили для табов и дерева ===== */
.tree-nav { list-style: none; padding-left: 0; margin: 0; }
.tree-nav .tree-item { margin-bottom: 2px; }
.tree-nav .tree-item-content { display: flex; align-items: center; padding: 4px 8px; border-radius: 4px; transition: background 0.15s; }
.tree-nav .tree-item-content:hover { background: #f0f0f0; }
.tree-nav .tree-toggle { display: inline-block; width: 18px; text-align: center; cursor: pointer; font-size: 14px; color: #6c757d; margin-right: 4px; transition: transform 0.2s; }
.tree-nav .tree-toggle.open { transform: rotate(90deg); }
.tree-nav .tree-toggle-placeholder { display: inline-block; width: 18px; margin-right: 4px; }
.tree-nav .tree-link { text-decoration: none; color: #333; flex: 1; }
.tree-nav .tree-link.active { font-weight: bold; color: #0d6efd; }
.tree-nav .tree-icon { margin-right: 4px; }
.tree-nav .tree-children { list-style: none; padding-left: 20px; margin: 0; }

.static-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid #ccc; padding-top: 10px !important; padding-bottom: 2px;}
.static-tabs .static-link { padding: 6px 16px; border-radius: 4px 4px 0 0; text-decoration: none; color: #495057; background: #f8f9fa; border: 1px solid #dee2e6; border-bottom: none; transition: background 0.15s, color 0.15s; }
.static-tabs .static-link:hover { background: #e9ecef; }
.static-tabs .static-link.active { background: #0d6efd; color: #fff; border-color: #0d6efd; }

.static-layout { display: flex; gap: 30px; margin-top: 10px; }
.static-sidebar { flex: 0 0 280px; min-width: 200px; border-right: 1px solid #dee2e6; padding-right: 20px; }
.static-content { flex: 1; min-width: 0; }

/* ===== Админ-контролы для статического модуля ===== */
.menu-item-wrapper.admin-mode {
    position: relative;
    transition: outline 0.15s ease;
}
.menu-item-wrapper.admin-mode.show-controls > .admin-controls {
    display: flex !important;
}
.menu-item-wrapper.admin-mode > .admin-controls {
    display: none !important;
    position: absolute;
    top: -10px;
    right: -10px;
    gap: 4px;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    padding: 2px 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10001;
    pointer-events: auto;
    border: 1px solid #ccc;
}
.menu-item-wrapper.admin-mode > .admin-controls span {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    font-size: 14px;
    cursor: pointer;
    border-radius: 50%;
    background: #f0f0f0;
    border: 1px solid #ddd;
    transition: background 0.2s;
    user-select: none;
}
.menu-item-wrapper.admin-mode > .admin-controls span:hover {
    background: #e0e0e0;
}
.menu-item-wrapper.admin-mode > .admin-controls .admin-edit-btn { color: #0d6efd; }
.menu-item-wrapper.admin-mode > .admin-controls .admin-drag-handle { color: #6c757d; cursor: grab; }

/* ===== Стили для карточек продуктов ===== */
.product-card-wrapper {
    overflow: visible !important;
    position: relative;
}
.product-content-wrap {
    border-radius: inherit;
    overflow: hidden;
}
.product-card-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
}

.product-card-wrapper:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.product-card-wrapper.admin-mode > .admin-controls {
    display: none !important;
    position: absolute;
    top: -10px;
    right: -10px;
    gap: 4px;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    padding: 2px 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10001;
    pointer-events: auto;
    border: 1px solid #ccc;
}
.product-card-wrapper.admin-mode:hover > .admin-controls {
    display: flex !important;
}
.product-card-wrapper.admin-mode > .admin-controls span {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    font-size: 14px;
    cursor: pointer;
    border-radius: 50%;
    background: #f0f0f0;
    border: 1px solid #ddd;
    transition: background 0.2s;
    user-select: none;
}
.product-card-wrapper.admin-mode > .admin-controls span:hover {
    background: #e0e0e0;
}
.product-card-wrapper.admin-mode > .admin-controls .admin-edit-btn { color: #0d6efd; }
.product-card-wrapper.admin-mode > .admin-controls .admin-drag-handle { color: #6c757d; cursor: grab; }

.product-card-wrapper.dragging {
    opacity: 0.5;
}
.sortable-ghost {
    opacity: 0.4;
    background: #e7f1ff;
}

/* ===== Изображения в карточках ===== */
.product-card-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
}

/* ===== Зона перетаскивания файлов ===== */
.products-grid.drag-over {
    border: 3px dashed #0d6efd !important;
    background: rgba(13, 110, 253, 0.05) !important;
    border-radius: 8px;
}
.drop-hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 4px;
    text-align: center;
}

/* ===== Тёмная тема ===== */
body.theme-dark .product-card-wrapper {
    background: #2a2a2a;
    border-color: #444;
}
body.theme-dark .product-card-wrapper:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
body.theme-dark .product-card-wrapper.admin-mode > .admin-controls {
    background: rgba(40,40,40,0.95);
    border-color: #555;
}
body.theme-dark .product-card-wrapper.admin-mode > .admin-controls span {
    background: #444;
    border-color: #666;
    color: #e0e0e0;
}
body.theme-dark .product-card-wrapper.admin-mode > .admin-controls span:hover {
    background: #555;
}
body.theme-dark .product-card-wrapper.admin-mode > .admin-controls .admin-edit-btn { color: #6ea8fe; }
body.theme-dark .product-card-wrapper.admin-mode > .admin-controls .admin-drag-handle { color: #adb5bd; }
body.theme-dark .tree-nav .tree-item-content:hover { background: #3a3a3a; }
body.theme-dark .tree-nav .tree-link { color: #e0e0e0; }
body.theme-dark .tree-nav .tree-link.active { color: #6ea8fe; }
body.theme-dark .static-tabs .static-link { background: #2a2a2a; border-color: #444; color: #adb5bd; }
body.theme-dark .static-tabs .static-link:hover { background: #3a3a3a; }
body.theme-dark .static-tabs .static-link.active { background: #0d6efd; color: #fff; }
body.theme-dark .static-sidebar { border-color: #444; }

.static-content-simple {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
}
.static-content-simple .editable-content {
    margin: 0 !important;
    padding: 0 !important;
}
#user-products-list {
    min-height: 100px;
}
.products-grid .product-card-wrapper {
    flex: 0 0 auto;
}
