/* =========================================
   ИНТЕРАКТИВНЫЙ КОНСТРУКТОР-МОКАП
========================================= */
.interactive-mockup-builder {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    margin-top: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.04);
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.imb-title {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 700;
    color: #4a3c5a;
    margin: 0 0 25px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #fb5a6c;
}

.imb-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* CANVAS С МАСКОЙ (ШИРОКИЙ ПРЯМОУГОЛЬНИК) */
.imb-canvas-col {
    width: 100%;
    max-width: none;
    margin: 0;
}

.imb-canvas {
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 280px;
    background: #fdfafb;
    border-radius: 12px;
    border: 1px solid #eeeeee;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
}

.imb-side-labels {
    position: absolute;
    bottom: 15px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    pointer-events: none;
    z-index: 10;
}

.imb-side-label {
    font-size: 11px;
    font-weight: 800;
    color: #4a3c5a;
    background: rgba(255,255,255,0.85);
    padding: 6px 14px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.imb-mask {
    position: absolute;
    top: 20px; left: 20px; right: 20px; bottom: 20px;
    -webkit-mask-size: contain;
    -webkit-mask-position: center bottom;
    -webkit-mask-repeat: no-repeat;
    mask-size: contain;
    mask-position: center bottom;
    mask-repeat: no-repeat;
}

/* СЛОЙ 1: Цвет основы пряжи */
.imb-yarn-bg {
    position: absolute;
    inset: 0;
    background-color: #936098; 
    z-index: 1;
    transition: background-color 0.3s ease;
}

/* КОНТЕЙНЕР ДЛЯ МАСКИРОВКИ ЛОГОТИПОВ (от hat_cut.svg) */
.imb-main-logo-wrapper {
    position: absolute;
    inset: 0;
    z-index: 2;
    -webkit-mask-size: contain;
    -webkit-mask-position: center bottom;
    -webkit-mask-repeat: no-repeat;
    mask-size: contain;
    mask-position: center bottom;
    mask-repeat: no-repeat;
}

.imb-logo-layer {
    position: absolute;
    top: 50%; left: 25%;
    width: 100px; height: 100px;
    margin-top: -50px; margin-left: -50px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: background-image 0.3s ease;
    cursor: grab;
    pointer-events: auto;
}

.imb-logo-layer.back-logo {
    left: 75%; 
}

/* Логотип отворота */
.imb-logo-layer.cuff-logo {
    top: 85%; 
    left: 25%;
    z-index: 6; 
    mix-blend-mode: multiply; 
}

.imb-logo-layer.has-logo { opacity: 0.9; }
.imb-logo-layer:active { cursor: grabbing; }

/* ТЕКСТУРА И ТЕНИ */
.imb-knit-texture {
    position: absolute;
    background-image: url('/assets/img/mockup-vectors/textures/5_inch.svg');
    background-repeat: repeat;
    mix-blend-mode: multiply;
    opacity: 0.65; 
    z-index: 3; 
    pointer-events: none;
}

.imb-knit-left { top: 0; bottom: 0; left: 0; width: 50%; }
.imb-knit-right { top: 0; bottom: 0; left: 50%; width: 50%; }

.imb-shadow-layer {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 20%, rgba(255,255,255,0.3) 0%, transparent 60%, rgba(0,0,0,0.4) 100%);
    mix-blend-mode: overlay;
    z-index: 4;
    pointer-events: none;
}

/* СЪЕМНЫЕ ДЕТАЛИ */
.imb-part {
    position: absolute;
    top: 20px; left: 20px; right: 20px; bottom: 20px; 
    z-index: 5;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    opacity: 0;
    -webkit-mask-size: contain;
    -webkit-mask-position: center bottom;
    -webkit-mask-repeat: no-repeat;
    mask-size: contain;
    mask-position: center bottom;
    mask-repeat: no-repeat;
    pointer-events: none;
}

.imb-part.visible { opacity: 1; }

.imb-part.pompom {
    background-color: #333333;
    -webkit-mask-image: url('/assets/img/mockup-vectors/details/hat_bumbone.svg');
    mask-image: url('/assets/img/mockup-vectors/details/hat_bumbone.svg');
}

.imb-part.cuff {
    background-color: rgba(0,0,0,0.25);
    -webkit-mask-image: url('/assets/img/mockup-vectors/details/hat_lapel.svg');
    mask-image: url('/assets/img/mockup-vectors/details/hat_lapel.svg');
}

.imb-part.fringe-left {
    background-color: rgba(0,0,0,0.2);
    -webkit-mask-image: url('/assets/img/mockup-vectors/details/fringe.svg');
    mask-image: url('/assets/img/mockup-vectors/details/fringe.svg');
}

.imb-part.fringe-right {
    background-color: rgba(0,0,0,0.2);
    -webkit-mask-image: url('/assets/img/mockup-vectors/details/fringe.svg');
    mask-image: url('/assets/img/mockup-vectors/details/fringe.svg');
}

/* КНОПКИ И ПАНЕЛИ УПРАВЛЕНИЯ */
.imb-360-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: #fdfafb;
    border: 1px solid #936098;
    color: #936098;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.imb-360-btn:hover { background: #f8eff1; }

.imb-360-btn.active {
    background: #936098;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(147, 96, 152, 0.3);
}

.imb-controls-col { width: 100%; display: flex; flex-direction: column; }
.imb-instruction { font-size: 14px; font-weight: 500; color: #555555; margin-bottom: 20px; line-height: 1.5; }
.imb-tools-panel { display: flex; flex-direction: column; gap: 15px; margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px dashed #dddddd; }

.imb-logo-controls {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.imb-upload-btn {
    flex-grow: 1;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    background: #fdfafb; border: 2px dashed #936098; color: #936098;
    padding: 12px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-align: center;
}
.imb-upload-btn:hover { background: #f8eff1; border-color: #df1b53; color: #df1b53; }
.imb-upload-btn.uploaded { border-style: solid; border-color: #10b981; background: #ecfdf5; color: #059669; }

.imb-upload-btn.disabled-btn {
    border-color: #cccccc !important;
    color: #888888 !important;
    background: #f5f5f5 !important;
    cursor: not-allowed;
}

.imb-scale-btns {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 36px;
    flex-shrink: 0;
}

.imb-scale-btn {
    flex-grow: 1;
    background: #fdfafb;
    border: 1px solid #dddddd;
    border-radius: 4px;
    color: #555555;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.imb-scale-btn:hover {
    background: #936098;
    color: #ffffff;
    border-color: #936098;
}

/* Селекторы */
.imb-class-selector { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.imb-select {
    width: 100%; padding: 12px 15px; border: 1px solid #dddddd; border-radius: 6px;
    background-color: #ffffff; font-family: 'Inter', sans-serif; font-size: 14px; color: #333333; cursor: pointer; outline: none; transition: border-color 0.2s;
}
.imb-select:focus { border-color: #936098; }

.imb-toggles { display: flex; flex-direction: column; gap: 10px; margin-top: 5px; }
.imb-toggle-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #333333; font-weight: 500; cursor: pointer; }
.imb-toggle-label input { accent-color: #936098; width: 16px; height: 16px; cursor: pointer; }

/* Калькулятор */
.imb-calculator-panel { background: #fcf9fa; padding: 20px; border-radius: 8px; border: 1px solid #eeeeee; }
.imb-stepper-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.imb-calc-label { font-size: 14px; font-weight: 700; color: #333333; }
.imb-stepper { display: flex; background: #ffffff; border: 1px solid #dddddd; border-radius: 6px; height: 38px; overflow: hidden; }
.imb-step-btn { width: 38px; background: #f5f5f5; border: none; font-size: 18px; font-weight: bold; color: #555555; cursor: pointer; transition: background 0.2s; }
.imb-step-btn:hover { background: #e5e5e5; color: #df1b53; }
.imb-qty-input { width: 60px; text-align: center; border: none; border-left: 1px solid #dddddd; border-right: 1px solid #dddddd; font-weight: 700; color: #333333; font-size: 15px; outline: none; -moz-appearance: textfield; }
.imb-qty-input::-webkit-outer-spin-button, .imb-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.imb-totals { border-top: 1px dashed #dddddd; padding-top: 15px; display: flex; flex-direction: column; gap: 5px; }
.imb-total-row { display: flex; justify-content: space-between; align-items: center; }
.imb-unit-price { font-size: 14px; color: #555555; font-weight: 500; }
.imb-final-price { font-size: 28px; font-weight: 800; color: #df1b53; }

.imb-submit-btn { display: block; width: 100%; background: #936098; color: #ffffff; text-align: center; padding: 16px; border-radius: 8px; font-weight: 700; font-size: 15px; margin-top: 20px; transition: background 0.2s; border: none; cursor: pointer; }
.imb-submit-btn:hover { background: #7b4a80; }

/* =========================================
   БЛОК МАГИИ ФАБРИКИ ВНУТРИ МОКАПА
========================================= */
.imb-recommended-yarns {
    margin-bottom: 25px;
    padding: 20px;
    border-radius: 12px;
    transition: all 0.3s;
}

.magic-appearance {
    animation: magicGlow 1.2s ease-out forwards;
    border: 2px solid #df1b53 !important;
    background: #fff5f7 !important;
}

@keyframes magicGlow {
    0% { opacity: 0; transform: translateY(20px); box-shadow: 0 0 0 rgba(223, 27, 83, 0); }
    100% { opacity: 1; transform: translateY(0); box-shadow: 0 8px 30px rgba(223, 27, 83, 0.2); }
}

.imb-magic-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #f5c2d0;
}

.imb-yarn-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.imb-yarn-card {
    background: #ffffff;
    border: 1px solid #eeeeee;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.imb-yarn-card:hover {
    border-color: #dcdcdc;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.imb-yarn-card.active {
    border-color: #df1b53;
    box-shadow: 0 4px 15px rgba(223, 27, 83, 0.15);
}

.imb-yarn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Жесткие рамки для кружочков внутри мокапа */
.imb-yarn-circle {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    border-radius: 50% !important;
    background-color: #f5f5f5;
    background-size: cover;
    background-position: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    margin-bottom: 12px;
    position: relative;
    border: 3px solid transparent;
    transition: border-color 0.2s;
    overflow: hidden !important; 
    flex-shrink: 0 !important;
}

.imb-yarn-circle img {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    pointer-events: none;
}

.imb-yarn-card.active .imb-yarn-circle {
    border-color: #df1b53;
}

.imb-yarn-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    font-size: 8px;
    font-weight: 800;
    color: #ffffff;
    background: #df1b53;
    padding: 2px 4px;
    border-radius: 4px;
    white-space: nowrap;
    text-transform: uppercase;
    z-index: 10;
}

.imb-yarn-name { font-size: 11px; font-weight: 600; color: #333; line-height: 1.1; }

@media screen and (max-width: 992px) { .imb-canvas { aspect-ratio: 4 / 3; } }
@media screen and (max-width: 576px) { .imb-canvas { aspect-ratio: 1 / 1; } }