/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Заголовок */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Секции */
section {
    padding: 30px 40px;
}

section h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #667eea;
}

/* Алерты */
.alert {
    padding: 15px 20px;
    margin: 20px 40px;
    border-radius: 10px;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Форма загрузки */
.upload-section form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border: 2px dashed #667eea;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    background: #e9ecef;
    border-color: #764ba2;
}

.file-icon {
    font-size: 2rem;
}

.file-text {
    flex: 1;
    font-size: 1rem;
    color: #666;
}

/* Кнопки */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    color: white;
    font-size: 1.1rem;
    padding: 15px 40px;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(86, 171, 47, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Информация о файле */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.file-info {
    margin-bottom: 30px;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.file-icon-large {
    font-size: 3rem;
}

.file-details {
    flex: 1;
}

.file-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

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

/* Секция конвертации */
.convert-section {
    text-align: center;
    margin: 30px 0;
}

/* Предварительный просмотр HTML */
.html-preview {
    margin-top: 30px;
    border-top: 2px solid #e9ecef;
    padding-top: 30px;
}

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

.preview-header h3 {
    color: #667eea;
    font-size: 1.5rem;
}

.html-content {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
}

/* Загрузчик */
.loader {
    text-align: center;
    padding: 40px;
}

.spinner {
    margin: 0 auto 20px;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader p {
    color: #666;
    font-size: 1.1rem;
}

/* Инструкция */
.info-section {
    background: #f8f9fa;
    border-radius: 10px;
    margin: 20px 40px;
    padding: 30px;
}

.instructions {
    list-style-position: inside;
    padding-left: 0;
}

.instructions li {
    padding: 10px 0;
    font-size: 1rem;
    line-height: 1.6;
    color: #555;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 10px;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    section {
        padding: 20px;
    }

    .alert {
        margin: 15px 20px;
    }

    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .preview-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

/* Компактная форма загрузки */
.upload-section.compact {
    padding: 15px 40px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.upload-form-compact {
    margin: 0;
}

.upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.file-input-wrapper-compact {
    position: relative;
    flex-shrink: 0;
}

.file-input-wrapper-compact input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label-compact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #667eea;
}

.file-label-compact:hover {
    background: #667eea;
    color: white;
}

.file-info-compact {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: #e7f3ff;
    border-radius: 6px;
    font-size: 0.9rem;
}

.file-name-compact {
    font-weight: 500;
    color: #0066cc;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-compact {
    padding: 8px 16px !important;
    font-size: 0.9rem !important;
    margin: 0 !important;
}

/* Область предварительного просмотра */
.preview-section {
    padding: 20px 40px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.preview-header h3 {
    margin: 0;
    color: #667eea;
    font-size: 1.5rem;
}

.preview-buttons {
    display: flex;
    gap: 10px;
}

.preview-content {
    min-height: 500px;
    max-height: 600px;
    overflow: auto;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
}

.preview-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.preview-content:empty::before {
    content: 'Нажмите "Преобразовать в HTML" для отображения результата';
    color: #6c757d;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 500px;
}
