/* ==================== ОСНОВНЫЕ СТИЛИ ==================== */

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --light-bg: #f8f9fa;
    --dark-bg: #2c3e50;
    --text-color: #333;
    --text-light: #fff;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
}

/* ==================== ЗАГОЛОВОК ==================== */

.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 300;
}

/* ==================== ОСНОВНОЙ КОНТЕНТ ==================== */

.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* ==================== ЗОНА ЗАГРУЗКИ ==================== */

.upload-section {
    margin-bottom: 2rem;
}

.upload-section h2 {
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background-color: white;
    transition: all 0.3s ease;
    position: relative;
    min-height: 200px;
    cursor: pointer;
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(52, 152, 219, 0.1);
    transform: scale(1.02);
}

.drop-zone p {
    color: #666;
    margin-bottom: 1rem;
}

#fileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ==================== ПАНЕЛЬ НАСТРОЕК ==================== */

.settings-section {
    margin-bottom: 2rem;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.settings-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
}

.settings-panel label {
    display: flex;
    flex-direction: column;
    font-weight: 500;
}

.settings-panel select,
.settings-panel input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 0.25rem;
}

.settings-panel button {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
}

.settings-panel button:hover {
    background: #2980b9;
}

/* ==================== ПРОГРЕСС ==================== */

.progress-section {
    margin-bottom: 2rem;
}

.progress-container {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #2ecc71);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-weight: 500;
    color: var(--secondary-color);
}

/* ==================== РЕЗУЛЬТАТЫ ==================== */

.results-section {
    margin-bottom: 2rem;
}

.results-container {
    display: grid;
    gap: 1rem;
}

.result-item {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.result-item:hover {
    transform: translateY(-2px);
}

.result-content {
    padding: 1rem;
}

.result-content.error {
    border-left: 4px solid var(--error-color);
}

.result-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
}

.image-thumbnail {
    width: 100px;
    height: 100px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.image-thumbnail:hover {
    transform: scale(1.05);
}

.image-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-info {
    flex: 1;
}

.file-info h3 {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin: 0 0 0.5rem 0;
}

.file-size {
    color: #666;
    font-size: 0.9rem;
}

.result-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.metric.score-excellent { background: rgba(39, 174, 96, 0.1); border-left: 3px solid var(--success-color); }
.metric.score-good { background: rgba(46, 204, 113, 0.1); border-left: 3px solid #2ecc71; }
.metric.score-moderate { background: rgba(241, 196, 15, 0.1); border-left: 3px solid var(--warning-color); }
.metric.score-poor { background: rgba(230, 126, 34, 0.1); border-left: 3px solid #e67e22; }
.metric.score-bad { background: rgba(231, 76, 60, 0.1); border-left: 3px solid var(--error-color); }

.metric label {
    font-weight: 500;
    color: #666;
}

.metric span {
    font-weight: 600;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.result-actions button {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.result-actions button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.error-message {
    color: var(--error-color);
    font-weight: 500;
    padding: 1rem;
}

/* ==================== МОДАЛЬНОЕ ОКНО ==================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
}

.modal-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 2rem;
    min-height: 300px;
}

.modal-image {
    max-width: 100%;
    max-height: 70vh;
    cursor: grab;
    transform-origin: center center;
}

.modal-image:active {
    cursor: grabbing;
}

.modal-controls {
    display: flex;
    justify-content: center;
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid var(--border-color);
    gap: 1rem;
}

.modal-controls button {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.modal-controls button:hover {
    background: #2980b9;
}

body.modal-open {
    overflow: hidden;
}

/* ==================== АДАПТИВНОСТЬ ==================== */

@media (max-width: 768px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .settings-panel {
        flex-direction: column;
        align-items: stretch;
    }
    
    .result-metrics {
        grid-template-columns: 1fr;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .image-thumbnail {
        width: 80px;
        height: 80px;
        align-self: center;
    }
    
    .result-actions {
        justify-content: center;
    }
    
    .modal-content {
        width: 95vw;
        height: 95vh;
    }
}

@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .drop-zone {
        padding: 1rem;
    }
    
    .image-thumbnail {
        width: 60px;
        height: 60px;
    }
}
