/* static/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 30px 0;
}

header h1 {
    font-size: 2.5em;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #888;
    margin-top: 10px;
}

/* Кнопка закрытия */
.close-btn {
    cursor: pointer;
    color: #888;
    font-size: 24px;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #ff6b6b;
}

.close-btn.large {
    font-size: 32px;
}

/* Форма */
.generator-form {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #ccc;
}

.form-row {
    display: flex;
    gap: 20px;
}

.half {
    flex: 1;
}

textarea, select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
    font-family: inherit;
}

textarea:focus, select:focus {
    outline: none;
    border-color: #00d4ff;
}

textarea::placeholder {
    color: #666;
}

select option {
    background: #1a1a2e;
    color: #fff;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

button {
    width: 100%;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Прогресс */
.progress-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-bar {
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    color: #888;
}

/* Результат */
.result-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(76, 175, 80, 0.3);
    position: relative;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.result-header h2 {
    margin: 0;
}

/* Сравнение промптов */
.prompts-comparison {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.prompt-box {
    padding: 15px;
    border-radius: 8px;
}

.prompt-box.original {
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
}

.prompt-box.improved {
    background: rgba(76, 175, 80, 0.1);
    border-left: 4px solid #4caf50;
}

.prompt-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    opacity: 0.8;
}

.prompt-box.original .prompt-label {
    color: #ffc107;
}

.prompt-box.improved .prompt-label {
    color: #4caf50;
}

.prompt-text {
    font-size: 14px;
    line-height: 1.6;
    color: #e0e0e0;
    word-break: break-word;
    white-space: pre-wrap;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.result-image {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.result-image img {
    width: 100%;
    display: block;
}

.result-image.highlighted {
    border: 3px solid #4caf50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

.result-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

.image-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    opacity: 0;
    transition: opacity 0.3s;
}

.result-image:hover .image-actions {
    opacity: 1;
}

.download-btn {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
}

.download-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Галерея */
.gallery-section {
    margin-top: 40px;
}

.gallery-section h2 {
    margin-bottom: 20px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    font-size: 12px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-style {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
}

.empty-gallery {
    color: #666;
    text-align: center;
    padding: 40px;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    background: #1a1a2e;
    border-radius: 16px;
    padding: 25px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    overflow: auto;
}

.modal-content img {
    max-width: 100%;
    max-height: 50vh;
    object-fit: contain;
    border-radius: 8px;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 32px;
    z-index: 10;
}

.modal-prompts {
    margin-top: 20px;
    max-height: 30vh;
    overflow-y: auto;
}

.modal-prompts .prompt-box {
    margin-bottom: 10px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .container {
        padding: 15px;
    }
    
    .prompts-comparison {
        padding: 15px;
    }
    
    .prompt-text {
        font-size: 12px;
    }
    
    .modal-content {
        padding: 15px;
        margin: 10px;
    }
}