/* ═══════════════ EDITOR LAYOUT ═══════════════ */
#product-editor-view { animation: fadeIn 0.3s ease; width: 100%; }
.editor-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    width: 100%;
}
.btn-back {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 11px 18px;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}
.btn-back:hover {
    color: var(--text-main);
    border-color: var(--text-main);
}
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
    width: 100%;
    box-sizing: border-box;
}
.editor-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.editor-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.editor-card h3 {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    width: 100%;
}

.image-upload-area { padding: 4px 0; }
.btn-upload {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-family: var(--font-body);
}
.btn-upload:hover {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
}
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 16px;
    width: 100%;
    min-width: 0;
}
.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-input);
    border: 1px solid var(--border);
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
}
.image-preview-item:active { cursor: grabbing; }
.image-preview-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    box-shadow: 0 10px 30px var(--shadow-strong);
    z-index: 100;
}
.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.image-preview-item .remove-img {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--overlay-backdrop);
    color: var(--white-on-accent);
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(4px);
    pointer-events: auto;
    cursor: pointer;
    border: none;
}
.image-preview-item .remove-img:hover {
    background: var(--accent);
    transform: scale(1.1);
}
.image-preview-item .main-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(var(--accent-rgb), 0.9);
    color: var(--white-on-accent);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.editor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.editor-card-header h3 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.btn-icon-add {
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-icon-add:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white-on-accent);
    transform: scale(1.05);
}

.ingredients-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    width: 100%;
    min-width: 0;
}
.ingredients-search-wrapper svg {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
    fill: none;
    z-index: 1;
}
.ingredients-search-wrapper input {
    padding-left: 48px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.ingredients-grid {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-content: start;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.ingredients-grid .form-check {
    margin: 0;
    padding: 9px 12px;
    background: var(--bg-input);
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    flex-wrap: nowrap;
    gap: 8px;
}
.ingredients-grid .form-check.active {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: var(--accent);
}
.ingredients-grid .form-check > div:first-child {
    gap: 10px !important;
    display: flex;
    align-items: center;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}
.ingredients-grid .form-check span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 15px;
    display: block;
    min-width: 0;
}
.ingredients-grid .form-check.is-filtered-out { display: none !important; }

.ing-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}
.ing-qty-group {
    display: none !important;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
    flex-wrap: nowrap;
}
.form-check.active .ing-qty-group { display: inline-flex !important; }
.ing-qty-btn {
    width: 28px;
    height: 28px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-main);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.ing-qty-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white-on-accent);
}
.ing-qty {
    width: 36px;
    height: 28px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    outline: none;
    padding: 0;
    flex-shrink: 0;
    box-sizing: border-box;
}
.del-ing-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    margin-left: 4px;
}
.del-ing-btn:hover {
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.15);
}
.del-ing-btn svg { width: 18px; height: 18px; }

.tag-input-wrapper {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 46px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.2s ease;
    cursor: text;
    width: 100%;
    box-sizing: border-box;
}
.tag-input-wrapper:focus-within { border-color: var(--accent); }

.tag-input-chips { display: contents; }

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 10px;
    background: rgba(var(--accent-rgb), 0.12);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    transition: all 0.15s ease;
}
.tag-chip-hash {
    color: var(--accent);
    font-weight: 700;
}
.tag-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    border-radius: 3px;
    transition: all 0.15s ease;
}
.tag-chip-remove:hover {
    background: var(--accent);
    color: var(--white-on-accent);
}
.tag-input-field {
    flex: 1;
    min-width: 120px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    padding: 4px 4px;
}
.tag-input-field::placeholder { color: var(--text-muted); font-size: 14px; }

.tag-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 40px var(--shadow-strong);
    z-index: 200;
    padding: 4px;
    display: none;
    max-height: 260px;
    overflow-y: auto;
}
.tag-suggestions.active { display: block; }

.tag-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}
.tag-suggestion:hover { background: var(--skeleton-base); }
.tag-suggestion-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tag-suggestion-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 100px;
    margin-left: 8px;
    flex-shrink: 0;
}
.tag-suggestion-new {
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 8px;
    flex-shrink: 0;
}

@media (max-width: 992px) {
    .editor-layout { grid-template-columns: 1fr; width: 100%; }
    .editor-actions {
        flex-direction: column-reverse;
        padding-bottom: 24px;
        border-top: none;
        position: sticky;
        bottom: 0;
        background: var(--bg-body);
        padding-top: 16px;
        z-index: 50;
        width: 100%;
    }
    .editor-actions button { width: 100%; }
}

@media (max-width: 768px) {
    .editor-card { padding: 16px; }
    .editor-header { margin-bottom: 20px; }
    .editor-header .tab-title { font-size: 21px; }
    .image-preview-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; }
    .ingredients-grid { padding: 8px; gap: 8px; width: 100%; }
    .ingredients-grid .form-check {
        padding: 11px;
        min-height: 48px;
        width: 100%;
        flex-wrap: wrap;
    }
    .ingredients-grid .form-check > div:first-child { width: 100%; }
    .ing-controls { width: 100%; justify-content: flex-end; margin-top: 4px; }
    .ing-qty-group { gap: 4px; margin-left: 0; }
    .ing-qty-btn { width: 30px; height: 30px; font-size: 16px; }
    .ing-qty { width: 38px; height: 30px; font-size: 14px; }
    .tag-input-field { min-width: 100px; }
}

@media (max-width: 480px) {
    .editor-layout,
    .editor-col,
    .editor-card,
    .ingredients-grid,
    .form-check { min-width: 0; max-width: 100%; box-sizing: border-box; }
}

/* ═══════════════ VIDEO PREVIEW (admin) ═══════════════ */
.video-preview-item {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: var(--video-bg, #000);
    border: 1px solid var(--border);
    min-width: 0;
}
.video-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.video-preview-item .remove-img {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--overlay-backdrop);
    color: var(--white-on-accent);
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(4px);
    cursor: pointer;
    border: none;
    z-index: 3;
}
.video-preview-item .remove-img:hover {
    background: var(--accent);
    transform: scale(1.1);
}
.video-preview-item .video-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: var(--overlay-backdrop);
    color: var(--white-on-accent);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    backdrop-filter: blur(4px);
    pointer-events: none;
    z-index: 2;
}

@media (max-width: 768px) {
    .video-preview-item {
        aspect-ratio: 16 / 10;
    }
}