/* Основные стили */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #c0392b;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --gray-color: #95a5a6;
    --border-radius: 12px;
    --box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    min-height: calc(100vh - 40px);
}

/* Шапка */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    border-bottom: 4px solid var(--secondary-color);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--secondary-color);
}

.logo h1 {
    font-family: 'Roboto Slab', serif;
    font-size: 2.2rem;
    font-weight: 600;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 5px;
}

/* Основной контент */
.main-content {
    padding: 2rem;
}

/* Секция загрузки */
.upload-section {
    max-width: 800px;
    margin: 0 auto;
}

.upload-area {
    background: var(--light-color);
    border: 3px dashed var(--gray-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--secondary-color);
    background: #f8f9fa;
    transform: translateY(-2px);
}

.upload-area i {
    font-size: 4rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.upload-area p {
    color: var(--gray-color);
    margin-bottom: 0.5rem;
}

.formats {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 1rem !important;
}

.upload-note {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-top: 1rem;
    font-style: italic;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

#fileInput {
    display: none;
}

.btn-select {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-select:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* Информация о файле */
.file-info {
    margin-top: 2rem;
}

.file-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
}

.file-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.file-header i {
    font-size: 2rem;
    color: var(--secondary-color);
}

.file-details h4 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.file-details p {
    color: var(--gray-color);
    font-size: 0.9rem;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: auto;
    padding: 5px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove:hover {
    background: #ffebee;
}

.file-preview h5 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.preview-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    border: 1px solid #e0e0e0;
}

.btn-analyze {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1.5rem auto 0;
    width: fit-content;
}

.btn-analyze:hover {
    background: #219653;
    transform: translateY(-2px);
}

/* Секция предпросмотра */
.preview-section {
    margin-top: 2rem;
}

.preview-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.preview-header h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.preview-header p {
    color: var(--gray-color);
    font-size: 1rem;
}

.document-viewer {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.document-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.info-item i {
    color: var(--secondary-color);
}

.document-content {
    padding: 1.5rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.content-header h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.content-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    background: white;
    color: var(--primary-color);
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-small:hover {
    background: #f8f9fa;
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.content-wrapper {
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    max-height: 60vh;
    overflow-y: auto;
}

.document-text {
    margin: 0;
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--dark-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    background: white;
    min-height: 200px;
}

.document-text.wrap {
    white-space: pre-wrap;
}

.document-text.nowrap {
    white-space: pre;
}

.content-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.9rem;
    color: var(--gray-color);
}

.content-footer i {
    color: var(--secondary-color);
    margin-right: 5px;
}

.preview-actions {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 1px solid #ddd;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: var(--gray-color);
}

.btn-primary {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: #219653;
    transform: translateY(-2px);
}

/* Секция анализа */
.analysis-section {
    margin-top: 2rem;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.analysis-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 300px;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    background: var(--secondary-color);
    width: 0%;
    transition: width 0.5s ease;
}

#progressText {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 40px;
}

.analysis-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.analysis-steps::before {
    content: '';
    position: absolute;
    top: 25px;
    left: 50px;
    right: 50px;
    height: 2px;
    background: #e0e0e0;
    z-index: 1;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-icon {
    width: 50px;
    height: 50px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--gray-color);
    margin-bottom: 10px;
    transition: var(--transition);
}

.step.active .step-icon {
    border-color: var(--secondary-color);
    background: var(--secondary-color);
    color: white;
}

.step-text {
    font-size: 0.9rem;
    color: var(--gray-color);
    font-weight: 500;
}

.step.active .step-text {
    color: var(--primary-color);
}

.analysis-status {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.status-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.status-message i {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

/* Секция результатов */
.results-section {
    margin-top: 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.results-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.results-actions {
    display: flex;
    gap: 15px;
}

.btn-action {
    background: white;
    color: var(--primary-color);
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action:hover {
    background: #f8f9fa;
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card,
.risks-card,
.strengths-card,
.weaknesses-card,
.recommendations-card,
.details-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
}

.summary-card h3,
.risks-card h3,
.strengths-card h3,
.weaknesses-card h3,
.recommendations-card h3,
.details-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.summary-card {
    grid-column: span 2;
}

.risks-card {
    grid-column: span 2;
}

.risks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.risk-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid var(--warning-color);
}

.risk-item.high {
    border-left-color: var(--danger-color);
}

.risk-item.medium {
    border-left-color: var(--warning-color);
}

.risk-item.low {
    border-left-color: var(--success-color);
}

.risk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.risk-name {
    font-weight: 600;
    color: var(--primary-color);
}

.risk-score {
    font-weight: 700;
    font-size: 1.1rem;
}

.risk-item.high .risk-score {
    color: var(--danger-color);
}

.risk-item.medium .risk-score {
    color: var(--warning-color);
}

.risk-item.low .risk-score {
    color: var(--success-color);
}

.risk-description {
    font-size: 0.9rem;
    color: var(--gray-color);
    line-height: 1.4;
}

.strengths-list,
.weaknesses-list,
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.strength-item,
.weakness-item,
.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: var(--transition);
}

.strength-item:hover,
.weakness-item:hover,
.recommendation-item:hover {
    background: #e8f4fc;
    transform: translateX(5px);
}

.strength-item i {
    color: var(--success-color);
    margin-top: 2px;
}

.weakness-item i {
    color: var(--danger-color);
    margin-top: 2px;
}

.recommendation-item i {
    color: var(--secondary-color);
    margin-top: 2px;
}

.item-content h4 {
    font-size: 0.95rem;
    margin-bottom: 3px;
    color: var(--primary-color);
}

.item-content p {
    font-size: 0.85rem;
    color: var(--gray-color);
    line-height: 1.4;
}

.details-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--dark-color);
}

.details-content p {
    margin-bottom: 0.8rem;
}

/* Подвал */
.footer {
    background: var(--light-color);
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid #e0e0e0;
    margin-top: 2rem;
}

.footer p {
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.disclaimer {
    font-size: 0.8rem !important;
    color: var(--danger-color) !important;
    font-style: italic;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 90%;
    max-width: 500px;
    overflow: hidden;
}

.modal-header {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

.modal-footer {
    padding: 1rem 2rem;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #e0e0e0;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: #2980b9;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .results-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .summary-card,
    .risks-card {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 1.5rem;
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .analysis-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .progress-container {
        width: 100%;
    }
    
    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .results-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-area i {
        font-size: 3rem;
    }
    
    .upload-area h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .logo {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .analysis-steps::before {
        display: none;
    }
    
    .step {
        margin-bottom: 10px;
    }
    
    .step-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .step-text {
        font-size: 0.8rem;
    }
}
