/* Стили для модалки генерации прототипа */
.prototype-generation-modal-wrapper {
    max-width: 800px;
    width: 90vw;
    max-height: 90vh;
    overflow: hidden;
}

.prototype-generation-modal {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


.generation-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.progress-container {
    padding: 24px;
    background: #fff;
    flex-shrink: 0;
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    transition: all 0.3s ease;
}

.progress-step.waiting {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.progress-step.active {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.progress-step.completed {
    background: #f0fdf4;
    border-color: #10b981;
}

.progress-step .step-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.3s ease;
}

.progress-step.waiting .step-icon {
    background: #e5e7eb;
}

.progress-step.active .step-icon {
    background: #3b82f6;
    animation: pulse 1.5s ease-in-out infinite;
}

.progress-step.completed .step-icon {
    background: #10b981;
}

.progress-step .step-icon i {
    font-size: 14px;
    color: #6b7280;
    transition: all 0.3s ease;
}

.progress-step.waiting .step-icon i {
    color: #6b7280;
}

.progress-step.active .step-icon i {
    color: #fff;
}

.progress-step.completed .step-icon i {
    color: #fff;
}

.progress-step .step-info {
    flex: 1;
}

.progress-step .step-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
}

.progress-step .step-status {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0;
}

.progress-step.active .step-status {
    color: #3b82f6;
}

.progress-step.completed .step-status {
    color: #10b981;
}

.current-operation {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.operation-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.operation-icon i {
    font-size: 16px;
    color: #3b82f6;
}

.operation-text {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.generation-progress {
    padding: 24px;
    background: #fff;
    flex-shrink: 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    width: 0%;
    transition: width 0.3s ease;
}

.current-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.current-status i {
    color: #3b82f6;
}

.generation-steps {
    padding: 0 24px 24px;
    background: #fff;
    flex-shrink: 0;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.3s ease;
}

.step-item:last-child {
    border-bottom: none;
}

.step-item.completed {
    background: #f0fdf4;
    margin: 0 -24px;
    padding: 12px 24px;
    border-radius: 6px;
}

.step-item.failed {
    background: #fef2f2;
    margin: 0 -24px;
    padding: 12px 24px;
    border-radius: 6px;
}

.step-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-icon i {
    font-size: 12px;
    color: #9ca3af;
    transition: all 0.3s ease;
}

.step-item.completed .step-icon i {
    color: #10b981;
}

.step-item.failed .step-icon i {
    color: #dc2626;
}

.step-text {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.layout-result {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.layout-result h4 {
    margin: 0 0 16px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.analysis-content,
.layout-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    flex: 1;
}

.analysis-content pre,
.layout-content pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.success-message {
    text-align: center;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.success-message p {
    margin: 8px 0;
    color: #374151;
    font-size: 1rem;
}

/* Стили для результата рендеринга */
.render-result {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.canvas-container {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    overflow: hidden;
    max-height: 500px;
    position: relative;
}

.zoom-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.zoom-controls .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d1d5db;
    color: #374151;
    font-size: 12px;
}

.zoom-controls .btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rendered-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s ease;
    transform-origin: center;
}

.export-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.export-buttons .btn {
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.export-buttons .btn i {
    font-size: 0.875em;
}

.result-section {
    margin-bottom: 24px;
}

.result-section h4 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.result-content {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
}

.result-text h5 {
    margin: 0 0 12px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.result-preview pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.debug-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.debug-section h4 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    flex-shrink: 0;
}

.debug-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.debug-tab {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.debug-tab:hover {
    background: #f9fafb;
    color: #374151;
}

.debug-tab.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.debug-content {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0 6px 6px 6px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.debug-panel {
    display: none;
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.debug-panel.active {
    display: flex;
    flex-direction: column;
}

.debug-panel pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.generation-actions {
    padding: 16px 24px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    flex-shrink: 0;
}

.generation-actions .btn {
    min-width: 120px;
    height: 44px;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    box-sizing: border-box;
    padding: 0 16px;
}

.generation-actions .btn:first-child {
    margin-left: 0;
}

.generation-actions .btn-warning {
    background-color: #f59e0b;
    border-color: #f59e0b;
    color: #ffffff;
}

.generation-actions .btn-warning:hover {
    background-color: #d97706;
    border-color: #d97706;
}

.generation-actions .btn-secondary {
    background-color: #6b7280;
    border-color: #6b7280;
    color: #ffffff;
}

.generation-actions .btn-secondary:hover {
    background-color: #4b5563;
    border-color: #4b5563;
}

/* Стили для поля уточнения */
.retry-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    width: 100%;
}

.clarification-field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-end;
}

.clarification-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #374151;
    background: #fff;
    resize: vertical;
    min-height: 44px;
    max-height: 100px;
    transition: border-color 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
    margin: 0;
}

.clarification-field textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.clarification-field textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.retry-button-container {
    flex-shrink: 0;
}

.retry-button-container .btn {
    min-width: 120px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    box-sizing: border-box;
    padding: 0 16px;
}

/* Анимации */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.step-item.running .step-icon i {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Drag and Drop стили для прототипов */
.draggable-element {
    cursor: pointer;
    transition: filter 0.15s ease;
}

.draggable-element:hover {
    filter: brightness(1.05);
}

.draggable-element.dragging {
    opacity: 0.8;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    cursor: grabbing;
    transition: none !important;
}

.drop-zone {
    position: relative;
    min-height: 200px;
}

.element-selected {
    filter: brightness(1.1);
}

/* Рамка выделения */
.selection-border {
    pointer-events: none;
}

/* Контролы для выбранного элемента */
.element-controls {
    position: absolute;
    top: -30px;
    left: 0;
    display: flex;
    gap: 4px;
    z-index: 1000;
}

.delete-button {
    width: 32px;
    height: 32px;
    background: #dc2626;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.delete-button:hover {
    background: #b91c1c;
    transform: scale(1.1);
}


/* Стили для модального окна добавления компонента */
.add-component-modal-wrapper .modal-content {
    max-height: 70vh;
    overflow-y: auto;
}

/* Стили для кнопок зума */
.zoom-controls button {
    transition: all 0.2s ease;
    border: 1px solid #d1d5db !important;
    background: white !important;
    color: #374151 !important;
}

.zoom-controls button:hover {
    background: #f3f4f6 !important;
    border-color: #9ca3af !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.zoom-controls button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.zoom-controls #prototype-zoom-level {
    user-select: none;
    font-weight: 500;
    color: #6b7280;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    min-width: 35px;
    text-align: center;
    font-size: 11px;
    padding: 4px 6px;
}

/* Стили для редактора прототипа */
.prototype-editor-modal-wrapper .prototype-image-container {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

.prototype-editor-modal-wrapper #prototype-svg-container {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

.prototype-editor-modal-wrapper .prototype-image-wrapper {
    transform-origin: center center;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* Убираем скролл у SVG контейнера в редакторе */
.prototype-editor-modal-wrapper svg {
    max-width: none !important;
    max-height: none !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
}

/* Убираем все ограничения по высоте для редактора */
.prototype-editor-modal-wrapper .modal-body {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
}

.prototype-editor-modal-wrapper .modal-content {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
}

.component-item:hover {
    border-color: #3b82f6 !important;
    background-color: #f8fafc !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.component-item.selected {
    border-color: #3b82f6 !important;
    background-color: #eff6ff !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Стили для редактора прототипа - убираем ограничения по высоте */

.editor-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Адаптивность */
@media (max-width: 640px) {
    .prototype-generation-modal-wrapper {
        width: 95vw;
        margin: 20px auto;
    }
    
    .progress-container,
    .layout-result,
    .generation-actions {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .progress-steps {
        gap: 12px;
    }
    
    .progress-step {
        padding: 10px 12px;
    }
    
    .progress-step .step-icon {
        width: 28px;
        height: 28px;
    }
    
    .progress-step .step-icon i {
        font-size: 12px;
    }
    
    .progress-step .step-title {
        font-size: 0.8rem;
    }
    
    .progress-step .step-status {
        font-size: 0.7rem;
    }
    
    .current-operation {
        padding: 12px;
    }
    
    .operation-text {
        font-size: 0.8rem;
    }
    
    .export-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .export-buttons .btn {
        width: 100%;
        max-width: 200px;
    }
    
    .canvas-container {
        max-height: 300px;
        padding: 12px;
    }
    
    .zoom-controls {
        top: 8px;
        right: 8px;
    }
    
    .zoom-controls .btn {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
    
    .image-wrapper {
        min-height: 150px;
    }
    
    .debug-tabs {
        flex-direction: column;
    }
    
    .debug-tab {
        border-radius: 6px;
        margin-bottom: 4px;
    }
    
    .debug-content {
        border-radius: 6px;
    }
    
    /* Адаптивность для поля уточнения */
    .retry-container {
        flex-direction: column;
        gap: 12px;
    }
    
    .retry-button-container {
        width: 100%;
    }
    
    .retry-button-container .btn {
        width: 100%;
        min-width: auto;
    }
    
    .generation-actions .btn {
        width: 100%;
        min-width: auto;
        margin-left: 0;
        margin-bottom: 8px;
    }
    
    .generation-actions .btn:last-child {
        margin-bottom: 0;
    }
    
    .clarification-field textarea {
        min-height: 60px;
    }
}
