/* Drag & Drop Element Sorter Styles */
.bsfttune-element-sorter {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

.bsfttune-element-item {
    background: #e0e0e0;
    border: 1px solid #bbb;
    border-radius: 3px;
    padding: 10px;
    margin: 5px 0;
    display: flex;
    align-items: center;
    cursor: move;
    user-select: none;
    transition: background-color 0.2s;
    gap: 8px;
}

.bsfttune-element-item:hover {
    background: #d5d5d5;
}

.bsfttune-element-item.dragging {
    opacity: 0.5;
    background: #ccc;
}

.bsfttune-element-item[data-element="image"] {
    background: #f0f0f0;
    cursor: default;
    opacity: 0.9;
}

.bsfttune-element-item[data-element="image"]:hover {
    background: #e8e8e8;
}

.bsfttune-element-drag-handle {
    color: #666;
    font-weight: bold;
    margin-right: 10px;
    font-size: 14px;
    cursor: grab;
}

.bsfttune-element-item[data-element="image"] .bsfttune-element-drag-handle {
    color: #999;
    cursor: default;
}

.bsfttune-element-name {
    flex: 1;
    font-weight: normal;
    color: #333;
}

.bsfttune-element-item[data-element="image"] .bsfttune-element-name {
    color: #666;
    font-style: italic;
}

/* Drop zone indication */
.bsfttune-element-item.drop-zone {
    background: #e3f2fd;
    border-color: #2196f3;
}

/* Placeholder styling */
.bsfttune-element-placeholder {
    height: 2px;
    background: #007cba;
    margin: 5px 0;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Sortable ghost/placeholder styling */
.sortable-ghost {
    opacity: 0.4;
    background: #c8ebfb;
}

.sortable-chosen {
    background: #c8ebfb;
}

.sortable-drag {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transform: rotate(2deg);
}

/* Visibility checkbox styles */
.bsfttune-element-visibility {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bsfttune-eye-icon {
    font-size: 16px;
    user-select: none;
}

.bsfttune-element-visibility-toggle {
    cursor: pointer;
    margin: 0;
    transform: scale(1.2);
}

/* Width inputs styles */
.bsfttune-element-widths {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.bsfttune-width-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
}

.bsfttune-width-group label {
    margin-bottom: 2px;
    font-weight: 500;
    white-space: nowrap;
}

.bsfttune-width-input {
    width: 40px;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    text-align: center;
    min-width: 60px;
}

.bsfttune-width-input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Style for disabled (invisible) elements - just visual indication in admin */
.bsfttune-element-item.element-hidden {
    opacity: 0.6;
    background: #f8f8f8;
}

.bsfttune-element-item.element-hidden .bsfttune-element-name {
    color: #999;
    font-style: italic;
}

.bsfttune-element-item.element-hidden::after {
    content: " (скрыт)";
    color: #666;
    font-size: 11px;
    margin-left: 5px;
}

/* Wrapper styles */
.bsfttune-wrapper-item {
    background: #e8f4fd;
    border: 2px solid #1e73be;
    border-radius: 6px;
    margin: 8px 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.bsfttune-wrapper-item:hover {
    background: #ddeefa;
    border-color: #0d5e9d;
}

.bsfttune-wrapper-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.bsfttune-wrapper-header {
    background: #f1f8fe;
    border-bottom: 1px solid #1e73be;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bsfttune-wrapper-content {
    min-height: 60px;
    padding: 12px;
    background: #fff;
    border-top: 1px dashed #ccc;
    transition: background-color 0.2s ease;
}

.bsfttune-wrapper-content.wrapper-drag-over {
    background: #e8f5e8;
    border-color: #4caf50;
}

.bsfttune-wrapper-dropzone {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
    border: 2px dashed #ccc;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.bsfttune-wrapper-content.wrapper-drag-over .bsfttune-wrapper-dropzone {
    border-color: #4caf50;
    color: #4caf50;
    background: #f1f8ff;
}

.bsfttune-wrapper-controls-inline {
    margin-left: auto;
}

.bsfttune-wrapper-delete {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.bsfttune-wrapper-delete:hover {
    background: rgba(255, 0, 0, 0.1);
}

/* Elements inside wrapper */
.bsfttune-wrapper-content .bsfttune-element-item {
    background: #f0f9ff;
    border-color: #3b82f6;
    margin: 4px 0;
}

.bsfttune-wrapper-content .bsfttune-element-item:hover {
    background: #dbeafe;
}

/* Hide dropzone when wrapper has elements */
.bsfttune-wrapper-content:has(.bsfttune-element-item) .bsfttune-wrapper-dropzone {
    display: none;
}

/* Frontend wrapper styles */
.bsfttune-wrapper-container {
    display: block;
    margin: 4px 0;
}

.bsfttune-wrapper-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Wrapper elements should flow together */
.bsfttune-wrapper-inner > * {
    flex: 0 0 auto;
}

/* Prevent drag on interactive elements */
.bsfttune-wrapper-header input,
.bsfttune-wrapper-header button,
.bsfttune-element-item input,
.bsfttune-element-item button {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: auto;
}

/* Allow dragging only on specific handle areas */
.bsfttune-element-drag-handle {
    cursor: move;
    -webkit-user-drag: element;
    -khtml-user-drag: element;
    -moz-user-drag: element;
    -o-user-drag: element;
    user-drag: element;
}