/* Поднимаем само окно строго НАД темным фоном (.mfp-bg) */
.ai-mfp-active.mfp-wrap {
    z-index: 100005 !important;
}

.ai-mfp-active .mfp-container {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px !important;
}

/* Делаем окно гибким для размещения панели справа */
.ai-mfp-active .mfp-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: center !important;
    max-width: 1120px !important;
    width: auto !important;
    background: #fff !important;
    padding: 0 !important;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 10px 35px rgba(0,0,0,0.6);
    position: relative !important;
    z-index: 100006 !important;
}

.ai-mfp-active .mfp-figure {
    order: 1 !important; /* Картинка всегда строго слева */
    flex: 1 1 auto !important;
    background: #f8f8f8 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ai-mfp-active .mfp-figure::after {
    display: none !important;
}

.ai-mfp-active img.mfp-img {
    display: block !important;
    padding: 15px !important;
    max-height: 80vh !important;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    margin: 0 auto !important;
}

.ai-mfp-active .mfp-bottom-bar {
    display: none !important; /* Скрываем нижнюю черную полосу с подписью */
}

.ai-mfp-active .mfp-close {
    color: #333 !important;
    top: 5px !important;
    right: 8px !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 28px !important;
    z-index: 100010 !important;
    cursor: pointer !important;
}

/* Правая панель выбора параметров */
.ai-painter-panel {
    order: 2 !important; /* Панель всегда строго справа */
    width: 310px;
    flex-shrink: 0;
    background: #ffffff;
    border-left: 1px solid #e5e5e5;
    padding: 40px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
    font-family: 'Open Sans', sans-serif;
    box-sizing: border-box;
}

.ai-painter-title {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    margin: 0 0 18px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.ai-painter-group {
    margin-bottom: 16px;
}

.ai-painter-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.ai-painter-select {
    width: 100%;
    height: 38px;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    background-color: #fff;
}

.ai-painter-btn {
    width: 100%;
    padding: 12px;
    background-color: #2b8a3e;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
}

.ai-painter-btn:hover {
    background-color: #237032;
}

.ai-painter-btn:disabled {
    background-color: #999;
    cursor: not-allowed;
}

.ai-painter-status {
    margin-top: 12px;
    font-size: 12px;
    color: #666;
    min-height: 18px;
    word-break: break-word;
}

@media (max-width: 768px) {
    .ai-mfp-active .mfp-content {
        flex-direction: column !important;
        max-height: 92vh;
        overflow-y: auto;
    }
    .ai-painter-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e5e5e5;
        padding: 15px;
    }
    .ai-mfp-active img.mfp-img {
        max-height: 45vh !important;
    }
}
