/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

/* Хедер */
.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5em;
}

.logo h1 {
    font-size: 2em;
    font-weight: 700;
}

.header-info p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Карточки */
.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    margin: 20px;
    overflow: hidden;
}

.upload-card {
    border: 2px solid #e3f2fd;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header i {
    font-size: 1.5em;
}

.card-header h3 {
    font-size: 1.3em;
    font-weight: 600;
}

.card-body {
    padding: 30px;
}

/* Форма */
.form-group {
    margin-bottom: 25px;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #2c5282;
    margin-bottom: 10px;
    cursor: pointer;
}

.file-label i {
    color: #4299e1;
}

input[type="file"] {
    width: 100%;
    padding: 15px;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    background: #f7fafc;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="file"]:hover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.file-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #718096;
    font-size: 0.9em;
    margin-top: 8px;
}

.file-hint i {
    color: #4299e1;
}

/* Улучшенные стили для области загрузки */
.drop-zone {
    border: 3px dashed #cbd5e0;
    border-radius: 20px;
    padding: 50px 30px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 20px;
}

.drop-zone:hover {
    border-color: #4299e1;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(66, 153, 225, 0.15);
}

.drop-zone-active {
    border-color: #4299e1;
    background: #e0f2fe;
    transform: scale(1.02);
    box-shadow: 0 15px 30px rgba(66, 153, 225, 0.2);
}

.drop-zone-content {
    pointer-events: none;
}

.upload-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.upload-icon i {
    font-size: 2.5em;
    color: white;
}

.drop-zone-content h4 {
    color: #2d3748;
    margin-bottom: 12px;
    font-size: 1.4em;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.drop-zone-content p {
    color: #718096;
    margin-bottom: 25px;
    font-size: 1.1em;
    font-weight: 500;
}

/* Кнопка выбора файлов */
.btn-select-files {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
    pointer-events: auto;
}

.btn-select-files:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

.btn-select-files:active {
    transform: translateY(-1px);
}

.upload-info {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    font-weight: 500;
}

.upload-info i {
    color: #f39c12;
    font-size: 1.1em;
}

.upload-info strong {
    color: #e74c3c;
    font-weight: 700;
}

/* Стили для поддерживаемых форматов */
.supported-formats {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #4a5568;
    font-weight: 500;
}

.supported-formats i {
    color: #48bb78;
    font-size: 1.1em;
}

/* Улучшенные стили для списка файлов */
.file-list-container {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.file-list-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #2d3748;
    font-size: 1.2em;
    font-weight: 600;
}

.file-list-title span {
    background: #4299e1;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 700;
}

.total-size {
    background: #e2e8f0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95em;
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.total-size i {
    color: #4299e1;
}

.total-size.warning {
    background: #fefcbf;
    color: #d69e2e;
    border: 1px solid #faf089;
}

.total-size.error {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.file-list {
    max-height: 300px;
    overflow-y: auto;
}

.file-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.file-list-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #4299e1;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.file-info i {
    color: #4299e1;
    width: 20px;
    font-size: 1.1em;
}

.file-name {
    font-weight: 500;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.file-size {
    color: #718096;
    font-size: 0.9em;
    white-space: nowrap;
}

.file-remove {
    background: none;
    border: none;
    color: #e53e3e;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.file-remove:hover {
    background: #fed7d7;
    transform: scale(1.1);
}

/* Поле ИГК */
.igk-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #2c5282;
    margin-bottom: 10px;
}

.igk-label i {
    color: #4299e1;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    color: #a0aec0;
    z-index: 1;
}

.input-with-icon input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.input-with-icon input:focus {
    border-color: #4299e1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* Кнопки */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Информационная сетка */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.info-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.info-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
}

.info-icon i {
    font-size: 1.5em;
    color: white;
}

.info-card h4 {
    color: #2d3748;
    margin-bottom: 10px;
    font-weight: 600;
}

.info-card p {
    color: #718096;
    font-size: 0.95em;
}

/* Очистка */
.cleanup-section {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.btn-cleanup {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.btn-cleanup:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(237, 137, 54, 0.3);
}

/* Загрузка */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.loading-text h4 {
    color: #2d3748;
    margin: 20px 0 10px;
    font-size: 1.2em;
}

.loading-text p {
    color: #718096;
}

/* Флеш-сообщения */
.flash-messages {
    margin: 20px;
}

.flash-message {
    padding: 15px 20px;
    border-radius: 10px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.flash-message.success {
    background: #f0fff4;
    color: #2f855a;
    border: 1px solid #9ae6b4;
}

.flash-message.error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #fc8181;
}

/* Анимация спиннера */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* Анимация для активной зоны drop */
@keyframes pulse-gentle {
    0% { transform: scale(1); }
    50% { transform: scale(1.01); }
    100% { transform: scale(1); }
}

.drop-zone-active {
    animation: pulse-gentle 1.5s ease-in-out infinite;
}

/* Стили для страницы результатов */
.results-card .card-body {
    padding: 30px;
}

.results-summary {
    margin-bottom: 25px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
}

.summary-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
}

.summary-icon.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.summary-content h4 {
    color: #718096;
    font-size: 0.9em;
    margin-bottom: 5px;
    font-weight: 600;
}

.igk-number {
    font-size: 1.4em;
    font-weight: 700;
    color: #2d3748;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.2em;
}

.stat-icon.processed {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.stat-icon.skipped {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.stat-icon.errors {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.stat-card h4 {
    color: #718096;
    font-size: 0.9em;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-count {
    font-size: 1.8em;
    font-weight: 700;
    color: #2d3748;
}

.download-section {
    text-align: center;
    margin: 25px 0;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(66, 153, 225, 0.3);
}

/* Таблица результатов */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.results-table th {
    background: #f7fafc;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
}

.results-table td {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.results-table tr:last-child td {
    border-bottom: none;
}

.results-table tr:hover {
    background: #f7fafc;
}

.file-col {
    min-width: 250px;
}

.file-col i {
    color: #4299e1;
    width: 20px;
    margin-right: 10px;
}

.status-col {
    min-width: 120px;
}

.message-col {
    min-width: 200px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.status-badge.success {
    background: #f0fff4;
    color: #2f855a;
}

.status-badge.error {
    background: #fff5f5;
    color: #c53030;
}

.status-badge.skipped {
    background: #fffaf0;
    color: #c05621;
}

/* Кнопка возврата */
.action-section {
    text-align: center;
    margin: 30px 0;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #f7fafc;
    color: #4a5568;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: #edf2f7;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Стили для страницы результатов */
.details-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.files-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 500;
}

/* Компактная таблица */
.results-table {
    font-size: 0.9em;
}

.results-table th {
    padding: 12px 8px;
    font-size: 0.85em;
}

.results-table td {
    padding: 8px;
    height: 36px;
    border-bottom: 1px solid #eef2f7;
}

.status-col {
    width: 50px;
    min-width: 50px;
    text-align: center;
}

.status-icon {
    font-size: 1.1em;
    cursor: help;
}

.file-col {
    min-width: 0;
    max-width: 500px;
}

.file-col {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.file-col .file-icon {
    color: #4299e1;
    width: 16px;
    min-width: 16px;
    font-size: 0.9em;
}

.filename-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    font-size: 0.9em;
}

.file-message {
    color: #a0aec0;
    cursor: help;
    font-size: 0.8em;
    margin-left: auto;
    padding-left: 8px;
}

.file-message:hover {
    color: #4299e1;
}

/* Уменьшаем высоту строк */
.results-table tr {
    height: 36px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .file-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .file-remove {
        align-self: flex-end;
    }
    
    .details-card .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .files-count {
        align-self: flex-start;
    }
    
    .file-col {
        max-width: 250px;
    }
    
    .filename-text {
        font-size: 0.85em;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .results-table {
        font-size: 0.9em;
    }
    
    .results-table th, 
    .results-table td {
        padding: 12px 8px;
    }
    
    .file-col, .status-col, .message-col {
        min-width: unset;
    }
    
    .status-badge {
        padding: 4px 8px;
    }

    /* Адаптивность для новой области загрузки */
    .drop-zone {
        padding: 40px 20px;
    }
    
    .upload-icon {
        width: 70px;
        height: 70px;
        margin-bottom: 20px;
    }
    
    .upload-icon i {
        font-size: 2em;
    }
    
    .drop-zone-content h4 {
        font-size: 1.2em;
    }
    
    .drop-zone-content p {
        font-size: 1em;
    }
    
    .btn-select-files {
        padding: 14px 28px;
        font-size: 1em;
    }
    
    .file-list-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .total-size {
        align-self: flex-start;
    }
}

/* Убираем лишние отступы */
.results-table thead th {
    padding-bottom: 8px;
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

/* Дополнительные улучшения для лучшего UX */
.file-list::-webkit-scrollbar {
    width: 6px;
}

.file-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.file-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.file-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Плавные переходы для всех интерактивных элементов */
.drop-zone,
.file-list-item,
.btn-select-files,
.file-remove,
.btn-primary,
.btn-cleanup {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Улучшенные фокус-стили для доступности */
.drop-zone:focus-within {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.file-remove:focus {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
}

.instruction-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
}

.instruction-card h4 {
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.instruction-card ol {
    color: #4a5568;
    padding-left: 20px;
}

.instruction-card li {
    margin-bottom: 8px;
    line-height: 1.5;
}