/* ========================================
   REMOVE BACKGROUND - WORKSPACE STYLES
   Двухсостояния Hero-блока (по аналогии с Upscale)
   ======================================== */

/* ========================================
   HERO DYNAMIC STATES - Трансформация внутри
   ======================================== */

/* АДАПТИВНЫЙ H1 - Всегда видимый */
.hero-title-container {
    text-align: center;
    margin-bottom: 2rem;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 900;
    color: #f1f5f9;
    text-shadow: 0 2px 8px rgba(139,92,246,.3);
    line-height: 1.2;
    margin-bottom: 1rem;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-subtitle {
    font-size: clamp(0.875rem, 1.5vw, 1.125rem);
    color: #cbd5e1;
    max-width: 42rem;
    margin: 0 auto;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* H1 в режиме loaded - компактный, смещен влево */
#heroContainer[data-state="loaded"] .hero-title-container {
    text-align: left;
    margin-bottom: 1.5rem;
}

#heroContainer[data-state="loaded"] .hero-h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 0.5rem;
}

#heroContainer[data-state="loaded"] .hero-subtitle {
    font-size: clamp(0.813rem, 1.2vw, 0.938rem);
    color: #10b981;
    max-width: 100%;
}

/* Hero States - Плавная трансформация */
.hero-state {
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-state.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
}

#heroUploadState {
    opacity: 1;
    transform: translateY(0);
    position: relative;
}

#heroWorkspaceState {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
}

/* Когда hero в режиме loaded */
#heroContainer[data-state="loaded"] #heroUploadState {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    position: absolute;
}

#heroContainer[data-state="loaded"] #heroWorkspaceState {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
}

/* ========================================
   WORKSPACE GRID LAYOUT
   ======================================== */

.workspace-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 2rem;
    align-items: start;
}

/* ===== LEFT PANEL: Image Preview ===== */
.image-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Image Controls */
.image-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.control-btn {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 2px solid;
}

.control-btn-secondary {
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
    border-color: rgba(139,92,246,0.3);
    color: #a78bfa;
}

.control-btn-secondary:hover {
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.2));
    border-color: rgba(139,92,246,0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.2);
}

.control-btn-danger {
    background: linear-gradient(135deg, rgba(239,68,68,0.1), rgba(220,38,38,0.1));
    border-color: rgba(239,68,68,0.3);
    color: #f87171;
}

.control-btn-danger:hover {
    background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(220,38,38,0.2));
    border-color: rgba(239,68,68,0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.2);
}

/* ===== RIGHT PANEL: Tools ===== */
.tools-panel {
    background: linear-gradient(135deg, rgba(15,23,42,.85) 0%, rgba(11,18,32,.95) 100%);
    border: 2px solid rgba(139,92,246,.35);
    border-radius: 24px;
    padding: 2rem;
    position: relative;
    max-height: none;
    overflow-y: visible;
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(139, 92, 246, 0.15);
    animation: slideInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Custom Scrollbar */
.tools-panel::-webkit-scrollbar {
    width: 8px;
}

.tools-panel::-webkit-scrollbar-track {
    background: rgba(15,23,42,0.3);
    border-radius: 4px;
}

.tools-panel::-webkit-scrollbar-thumb {
    background: rgba(139,92,246,0.3);
    border-radius: 4px;
}

.tools-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(139,92,246,0.5);
}

/* Panel Header */
.panel-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(139,92,246,0.2);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: #f1f5f9;
    margin: 0;
}

.panel-title svg {
    color: #8b5cf6;
}

/* Panel Sections */
.panel-section {
    margin-bottom: 2rem;
}

.panel-section:last-child {
    margin-bottom: 0;
}

.section-label {
    font-size: 14px;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

/* ========================================
   MODE SELECTOR (Режим обработки)
   ======================================== */

.mode-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.mode-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    min-height: 72px;
    background: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(15,23,42,0.8));
    border: 2px solid rgba(100,116,139,0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.mode-card:hover {
    border-color: rgba(139,92,246,0.4);
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(99,102,241,0.05));
    transform: translateY(-2px);
}

.mode-card.active {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(99,102,241,0.1));
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.mode-card.locked {
    opacity: 0.7;
    cursor: not-allowed;
}

.mode-card.locked:hover {
    opacity: 1;
    transform: none;
}

.mode-card .pro-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.mode-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.mode-card:hover .mode-icon {
    transform: scale(1.1);
}

.mode-icon-auto {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.mode-icon-photo {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
}

.mode-icon-product {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.mode-icon-complex {
    background: linear-gradient(135deg, #ec4899, #a855f7);
}

.mode-icon svg {
    color: white;
}

.mode-info {
    flex: 1;
}

.mode-name {
    font-weight: 700;
    font-size: 14px;
    color: #f1f5f9;
    margin-bottom: 2px;
}

.mode-desc {
    font-size: 12px;
    color: #94a3b8;
}

/* ========================================
   ACTION SELECTOR (Действие с фоном)
   ======================================== */

.action-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(15,23,42,0.8));
    border: 2px solid rgba(100,116,139,0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #cbd5e1;
    font-weight: 600;
    font-size: 14px;
}

.action-card:hover {
    border-color: rgba(139,92,246,0.4);
    transform: translateX(4px);
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(99,102,241,0.05));
}

.action-card.active {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(99,102,241,0.1));
    color: #a78bfa;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.action-card svg {
    color: #8b5cf6;
    flex-shrink: 0;
}

.action-card.active svg {
    color: #a78bfa;
}

.action-card.locked {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

.action-card.locked:hover {
    opacity: 1;
    transform: none;
}

.action-card .pro-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    z-index: 1;
}

/* ========================================
   OPTIONS LIST (Дополнительные опции)
   ======================================== */

.options-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.option-checkbox {
    display: none;
}

.option-toggle {
    width: 48px;
    height: 26px;
    background: rgba(100,116,139,0.3);
    border-radius: 13px;
    position: relative;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.option-toggle::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.option-checkbox:checked + .option-toggle {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.option-checkbox:checked + .option-toggle::after {
    transform: translateX(22px);
}

.option-text {
    flex: 1;
}

.option-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #f1f5f9;
    margin-bottom: 2px;
}

.option-hint {
    display: block;
    font-size: 12px;
    color: #94a3b8;
}

/* ========================================
   PROCESS BUTTON (CTA)
   ======================================== */

.process-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    font-weight: 700;
    font-size: 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 16px rgba(139, 92, 246, 0.4),
        0 0 0 2px rgba(139, 92, 246, 0.1);
}

.process-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(139, 92, 246, 0.5),
        0 0 0 2px rgba(139, 92, 246, 0.2);
}

.process-btn:active {
    transform: translateY(0);
}

.process-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.process-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 13px;
    color: #94a3b8;
}

/* ========================================
   USAGE INFO (Лимиты обработок)
   ======================================== */

.usage-info {
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.05));
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.usage-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.usage-label {
    font-size: 13px;
    color: #cbd5e1;
}

.usage-value {
    font-weight: 700;
    font-size: 15px;
    color: #8b5cf6;
}

.usage-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 14px;
    font-weight: 600;
    color: #a78bfa;
    text-decoration: none;
    transition: all 0.3s ease;
}

.usage-link:hover {
    color: #c4b5fd;
    gap: 0.5rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet and below - Workspace становится вертикальным */
@media (max-width: 1024px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
    
    .tools-panel {
        margin-top: 2rem;
    }
}

/* Mobile - Simplified controls */
@media (max-width: 768px) {
    .mode-selector {
        grid-template-columns: 1fr;
    }
    
    .image-controls {
        flex-direction: column;
    }
    
    .control-btn {
        min-width: 100%;
    }
    
    .tools-panel {
        padding: 1.5rem;
    }
    
    .panel-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .image-preview-container {
        padding: 1.5rem;
        min-height: 400px;
    }
    
    .tools-panel {
        padding: 1.25rem;
    }
    
    .panel-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .panel-section {
        margin-bottom: 1.5rem;
    }
    
    .mode-card,
    .action-card {
        padding: 0.875rem;
    }
}

/* ========================================
   DYNAMIC BLOCKS - Replace Background Options
   ======================================== */

/* Background Presets Row */
.bg-presets-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.bg-preset-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 0.75rem;
    background: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(15,23,42,0.8));
    border: 2px solid rgba(100,116,139,0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-preset-btn:hover {
    border-color: rgba(139,92,246,0.4);
    transform: translateY(-2px);
}

.bg-preset-btn.active {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(99,102,241,0.1));
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.preset-color {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.preset-name {
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
}

.bg-preset-btn.active .preset-name {
    color: #a78bfa;
}

/* Color Picker Section */
.color-picker-section {
    margin-bottom: 1.5rem;
}

.color-picker-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.75rem;
}

.color-picker-wrapper {
    position: relative;
}

.color-picker-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.color-picker-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(15,23,42,0.8));
    border: 2px solid rgba(100,116,139,0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #cbd5e1;
    font-weight: 600;
    font-size: 14px;
}

.color-picker-btn:hover {
    border-color: rgba(139,92,246,0.4);
    transform: translateX(2px);
}

.color-preview {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ========================================
   BACKGROUND GALLERY - REFACTORED VERSION
   Премиальный дизайн + оптимизация производительности
   ======================================== */

.bg-gallery-section {
    margin-bottom: 1.5rem;
}

.section-sublabel {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.75rem;
}

/* Container - увеличенная высота, улучшенный scrollbar */
.bg-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    background: linear-gradient(135deg, rgba(15,23,42,0.4), rgba(11,18,32,0.5));
    border: 2px solid rgba(139,92,246,0.2);
    border-radius: 16px;
    
    /* Performance optimizations - ENHANCED */
    contain: layout style paint;
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Убрали scroll-behavior: smooth для лучшей производительности */
}

/* Premium Scrollbar - тонкий и элегантный */
.bg-gallery::-webkit-scrollbar {
    width: 6px;
}

.bg-gallery::-webkit-scrollbar-track {
    background: rgba(15,23,42,0.6);
    border-radius: 3px;
    margin: 6px 0;
}

.bg-gallery::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, 
        rgba(139,92,246,0.6), 
        rgba(139,92,246,0.8));
    border-radius: 3px;
    transition: background 0.2s ease;
}

.bg-gallery::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, 
        rgba(139,92,246,0.8), 
        rgba(139,92,246,1));
}

/* Card - чёткая карточка с визуальным разделением */
.bg-gallery-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    
    /* Performance optimization */
    contain: layout style paint;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

/* Inner container - содержит изображение и overlay */
.bg-gallery-card-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 4/5;
    border-radius: 12px;
    overflow: hidden;
    
    /* LQIP - Упрощённая заглушка (простой цвет быстрее градиента) */
    background: rgba(30, 41, 59, 0.7);
    
    border: 2px solid rgba(100,116,139,0.25);
    
    /* Transitions ТОЛЬКО на transform и border-color (GPU acceleration) */
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s ease;
}

/* Image - простое отображение БЕЗ сложных оптимизаций */
.bg-gallery-card-inner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Label - название фона под превью */
.bg-gallery-label {
    display: block;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    line-height: 1.2;
    padding: 0 4px;
    transition: color 0.2s ease;
}

/* Overlay - МИНИМАЛИСТИЧНЫЙ (без заливки, только галочка) */
.bg-gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: transparent; /* Прозрачный фон */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    backface-visibility: hidden;
}

/* Check icon */
.bg-gallery-check {
    width: 40px;
    height: 40px;
    color: #8b5cf6;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: scale(0.8) translateZ(0);
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== STATES ===== */

/* Hover - лёгкий lift эффект БЕЗ scale */
.bg-gallery-card:hover .bg-gallery-card-inner {
    transform: translate3d(0, -2px, 0);
    border-color: rgba(139,92,246,0.4);
}

.bg-gallery-card:hover .bg-gallery-label {
    color: #cbd5e1;
}

/* Active/Selected - яркая фиолетовая рамка с галочкой */
.bg-gallery-card[aria-selected="true"] .bg-gallery-card-inner {
    border-width: 3px;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.bg-gallery-card[aria-selected="true"] .bg-gallery-card-overlay {
    opacity: 1;
    pointer-events: auto;
}

.bg-gallery-card[aria-selected="true"] .bg-gallery-check {
    transform: scale(1) translateZ(0);
}

.bg-gallery-card[aria-selected="true"] .bg-gallery-label {
    color: #a78bfa;
    font-weight: 700;
}

/* Focus - для keyboard navigation */
.bg-gallery-card:focus-visible .bg-gallery-card-inner {
    outline: 3px solid rgba(139, 92, 246, 0.6);
    outline-offset: 2px;
}

/* Legacy support для старого класса .bg-gallery-item */
.bg-gallery-item {
    /* Deprecated - use .bg-gallery-card instead */
    display: none;
}

/* Upload Custom Background Button */
.upload-bg-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
    border: 2px dashed rgba(139,92,246,0.3);
    border-radius: 12px;
    color: #a78bfa;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-bg-btn:hover {
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.2));
    border-color: rgba(139,92,246,0.5);
    transform: translateY(-2px);
}

/* ========================================
   DYNAMIC BLOCKS - AI Redraw Options
   ======================================== */

/* PRO Badge */
.pro-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
    margin-left: 0.5rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* AI Prompt Section */
.ai-prompt-section {
    margin-bottom: 1.5rem;
}

.ai-prompt-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.75rem;
}

.ai-prompt-textarea {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(15,23,42,0.8));
    border: 2px solid rgba(100,116,139,0.2);
    border-radius: 12px;
    color: #f1f5f9;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
}

.ai-prompt-textarea:focus {
    outline: none;
    border-color: rgba(139,92,246,0.5);
    background: linear-gradient(135deg, rgba(139,92,246,0.05), rgba(99,102,241,0.03));
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.ai-prompt-textarea::placeholder {
    color: #64748b;
}

.ai-prompt-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 12px;
    color: #94a3b8;
}

.ai-prompt-hint svg {
    color: #8b5cf6;
    flex-shrink: 0;
}

/* AI Presets Section */
.ai-presets-section {
    margin-bottom: 0;
}

.preset-chips {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.preset-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(15,23,42,0.8));
    border: 2px solid rgba(100,116,139,0.2);
    border-radius: 10px;
    color: #cbd5e1;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.preset-chip:hover {
    border-color: rgba(139,92,246,0.4);
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(99,102,241,0.05));
    transform: translateY(-2px);
    color: #a78bfa;
}

.preset-chip.active {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(99,102,241,0.15));
    color: #a78bfa;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.preset-chip svg {
    color: #8b5cf6;
    flex-shrink: 0;
}

/* ========================================
   RESPONSIVE DESIGN FOR DYNAMIC BLOCKS
   ======================================== */

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
    .bg-presets-row {
        flex-direction: column;
    }
    
    .bg-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
        max-height: 280px;
    }
    
    .bg-gallery-card-inner {
        border-radius: 10px;
    }
    
    .bg-gallery-check {
        width: 28px;
        height: 28px;
    }
    
    .preset-chips {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .bg-preset-btn {
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.75rem;
    }
    
    .preset-color {
        width: 32px;
        height: 32px;
    }
    
    .bg-gallery {
        gap: 8px;
        padding: 8px;
    }
    
    .bg-gallery-label {
        font-size: 10px;
    }
}

/* ==================== AI REDRAW ENHANCED CONTROLS ==================== */

/* COLLAPSIBLE WRAPPER */
.ai-advanced-wrapper {
    margin-top: 1.5rem;
}

/* TOGGLE BUTTON - Premium Design */
.advanced-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08));
    border: 2px solid rgba(139,92,246,0.25);
    border-radius: 12px;
    color: #a78bfa;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.advanced-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(139,92,246,0.12));
    border-color: rgba(139,92,246,0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

.advanced-toggle-btn.expanded {
    border-color: rgba(139,92,246,0.5);
    background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(99,102,241,0.12));
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
}

.advanced-text {
    flex: 1;
    text-align: left;
}

.advanced-count {
    padding: 0.25rem 0.625rem;
    background: rgba(139,92,246,0.15);
    border: 1px solid rgba(139,92,246,0.3);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #c4b5fd;
}

.chevron-icon {
    width: 20px;
    height: 20px;
    color: #8b5cf6;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.advanced-toggle-btn.expanded .chevron-icon {
    transform: rotate(180deg);
}

/* COLLAPSIBLE CONTENT */
.advanced-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                margin-top 0.3s ease;
}

.advanced-content.expanded {
    max-height: 2000px;
    opacity: 1;
    margin-top: 1.5rem;
}

/* 1. НЕГАТИВНЫЙ ПРОМПТ */
.ai-negative-section {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.ai-negative-section:first-child {
    margin-top: 0;
}

.negative-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.neg-chip {
    appearance: none;
    border: none;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.neg-chip:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.neg-chip.active {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    color: #ef4444;
}

/* 2. НАПРАВЛЕНИЕ СВЕТА */
.ai-lighting-section {
    margin-top: 1.5rem;
}

.lighting-control {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.light-btn {
    appearance: none;
    border: none;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
}

.light-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.light-btn.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.15));
    border-color: rgba(139, 92, 246, 0.5);
    color: #a78bfa;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
}

.light-icon {
    font-size: 18px;
    line-height: 1;
}

/* 3. СТРОГОСТЬ ПРОМПТА */
.ai-guidance-section {
    margin-top: 1.5rem;
}

.guidance-value {
    float: right;
    color: #a78bfa;
    font-weight: 700;
}

.guidance-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    outline: none;
    margin: 12px 0 8px 0;
    -webkit-appearance: none;
}

.guidance-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
}

.guidance-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.6);
}

.guidance-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.guidance-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}

/* 4. РАЗМЕР ИЗОБРАЖЕНИЯ */
.ai-size-section {
    margin-top: 1.5rem;
}

.size-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.size-option {
    cursor: pointer;
}

.size-option input[type="radio"] {
    display: none;
}

.size-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.size-option:hover .size-card {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.35);
    transform: translateY(-2px);
}

.size-option input:checked + .size-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(139, 92, 246, 0.12));
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

.size-icon {
    font-size: 24px;
}

.size-name {
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
}

.size-desc {
    font-size: 11px;
    color: #94a3b8;
}

/* 5. HR FIX */
.ai-hrfix-section {
    margin-top: 1.5rem;
}

.pro-badge-inline {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 800;
    color: #fbbf24;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.15));
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 4px;
    margin-left: 6px;
    letter-spacing: 0.5px;
}

/* RESPONSIVE - МОБИЛЬНАЯ АДАПТАЦИЯ */
@media (max-width: 640px) {
    .lighting-control {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .size-selector {
        grid-template-columns: 1fr;
    }
    
    .light-btn {
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .negative-chips {
        gap: 6px;
    }
    
    .neg-chip {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* ========================================
   СЕКЦИИ ВСЕГДА ВИДНЫ (для SEO)
   ======================================== */

.original-sections {
    display: block;
}

/* ========================================
   АДАПТИВНЫЙ КОНТЕЙНЕР ИЗОБРАЖЕНИЯ (из upscale)
   ======================================== */

/* Обновленный контейнер - статичная рамка без анимации */
.image-preview-container {
    position: relative;
    background: linear-gradient(135deg, rgba(15,23,42,.95) 0%, rgba(11,18,32,.98) 100%);
    border-radius: 24px;
    padding: 1rem;
    overflow: hidden;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(139, 92, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Статичная рамка */
.image-preview-container::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, 
        rgba(139, 92, 246, 0.3) 0%, 
        rgba(99, 102, 241, 0.2) 50%,
        rgba(139, 92, 246, 0.3) 100%
    );
    border-radius: 24px;
    z-index: -1;
    opacity: 0.5;
}

/* Внутренний контейнер - ПОЛНОСТЬЮ адаптивный */
.image-preview {
    position: relative;
    width: 100%;
    height: auto;
    display: block;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    overflow: hidden;
    line-height: 0;
}

/* Изображения адаптируются под свой размер */
.image-preview img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
    transition: opacity 0.3s ease;
}

/* Spinner animation для loader */
@keyframes spin { 
    to { transform: rotate(360deg); } 
}

/* Mobile адаптация */
@media (max-width: 768px) {
    .image-preview-container {
        min-height: 300px !important;
        padding: 1rem !important;
    }
}

@media (max-width: 480px) {
    .image-preview-container {
        min-height: 250px !important;
        padding: 0.75rem !important;
    }
}

/* ========================================
   EXPORT ZONE - ТОЧНАЯ КОПИЯ ИЗ UPSCALE.CSS
   ======================================== */

/* Зона экспорта - появляется после обработки */
.export-zone {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.05));
    border: 2px solid rgba(139,92,246,0.25);
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-zone.hidden {
    display: none;
}

/* Анимация появления */
.export-zone:not(.hidden) {
    animation: slideInUpSmooth 0.4s ease;
}

@keyframes slideInUpSmooth {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Segmented buttons для формата */
.export-format-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 6px;
    background: rgba(15,23,42,0.6);
    border-radius: 12px;
}

.format-segment {
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #94a3b8;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.format-segment::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(99,102,241,0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

.format-segment:hover {
    color: #cbd5e1;
}

.format-segment:hover::before {
    opacity: 1;
}

.format-segment.active {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    box-shadow: 
        0 4px 12px rgba(139, 92, 246, 0.3),
        0 0 0 1px rgba(139, 92, 246, 0.2);
}

.format-segment.active:hover {
    box-shadow: 
        0 6px 16px rgba(139, 92, 246, 0.4),
        0 0 0 1px rgba(139, 92, 246, 0.3);
}

.format-name {
    position: relative;
    z-index: 1;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Ползунок качества */
.quality-control {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.05));
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 12px;
}

.quality-control.hidden {
    display: none;
}

.quality-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quality-label {
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quality-value {
    font-size: 15px;
    font-weight: 700;
    color: #8b5cf6;
    min-width: 45px;
    text-align: right;
}

.quality-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, 
        rgba(239,68,68,0.3) 0%, 
        rgba(245,158,11,0.3) 50%, 
        rgba(34,197,94,0.3) 100%
    );
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.quality-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 
        0 2px 8px rgba(139, 92, 246, 0.4),
        0 0 0 2px rgba(139, 92, 246, 0.2);
    transition: all 0.2s ease;
}

.quality-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 
        0 4px 12px rgba(139, 92, 246, 0.5),
        0 0 0 3px rgba(139, 92, 246, 0.3);
}

.quality-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 
        0 2px 8px rgba(139, 92, 246, 0.4),
        0 0 0 2px rgba(139, 92, 246, 0.2);
    transition: all 0.2s ease;
}

.quality-range::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 
        0 4px 12px rgba(139, 92, 246, 0.5),
        0 0 0 3px rgba(139, 92, 246, 0.3);
}

.quality-range::-moz-range-track {
    background: linear-gradient(90deg, 
        rgba(239,68,68,0.3) 0%, 
        rgba(245,158,11,0.3) 50%, 
        rgba(34,197,94,0.3) 100%
    );
    border-radius: 3px;
}

/* Финальная кнопка скачивания */
.final-download-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    font-weight: 700;
    font-size: 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.final-download-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}

.final-download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.final-download-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Кнопка маски (дополнительно для remove-background) */
.download-mask-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
    border: 2px solid rgba(139,92,246,0.3);
    color: #a78bfa;
    font-weight: 700;
    font-size: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: -0.5rem;
}

.download-mask-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.2));
    border-color: rgba(139,92,246,0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

.download-mask-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.download-mask-btn:active:not(:disabled) {
    transform: translateY(0);
}

.download-mask-btn.hidden {
    display: none;
}

/* Mobile Responsive для зоны экспорта */
@media (max-width: 768px) {
    .export-zone {
        padding: 1.25rem;
    }
    
    .export-format-selector {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .format-segment {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .final-download-btn {
        padding: 1rem 1.5rem;
        font-size: 15px;
    }
    
    .download-mask-btn {
        padding: 0.875rem 1.25rem;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .export-zone {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .quality-control {
        padding: 0.875rem;
    }
    
    .final-download-btn {
        padding: 0.875rem 1.25rem;
        font-size: 14px;
    }
    
    .download-mask-btn {
        padding: 0.75rem 1rem;
        font-size: 13px;
    }
}
