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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

header h1 {
    font-size: 1.5em;
    font-weight: 300;
    margin: 0;
}

.main-content {
    padding: 15px 20px;
}

.section {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.section h2 {
    color: #333;
    margin-bottom: 12px;
    font-size: 1.1em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 6px;
}

.radio-group {
    display: flex;
    gap: 12px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.95em;
}

.file-upload {
    display: flex;
    gap: 8px;
    align-items: center;
}

.file-upload input[type="file"] {
    flex: 1;
    padding: 8px;
    border: 2px dashed #667eea;
    border-radius: 4px;
    background: white;
    font-size: 0.9em;
}

button {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}

button:hover {
    background: #5568d3;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    font-size: 1em;
    padding: 10px 20px;
    width: 100%;
}

.btn-add, .btn-paste {
    background: #28a745;
    margin-right: 8px;
    font-size: 0.85em;
}

.btn-delete {
    background: #dc3545;
    padding: 5px 15px;
    font-size: 0.9em;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin-bottom: 10px;
}

table th {
    background: #667eea;
    color: white;
    padding: 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
}

table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9em;
}

/* Выделение активной строки в таблице */
table tr {
    transition: background-color 0.2s;
}

table tr:hover {
    background-color: #f5f5f5;
}

.table-input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9em;
}

.table-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

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

.param-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-group label {
    font-weight: 600;
    color: #555;
}

.param-group input[type="number"],
.param-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.param-group input[type="range"] {
    width: 100%;
}

#status {
    margin-top: 12px;
    padding: 10px;
    border-radius: 4px;
    display: none;
    font-size: 0.9em;
}

#status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

#status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin: 15px 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9em;
}

#progressText {
    margin-top: 6px;
    text-align: center;
    color: #555;
    font-size: 0.85em;
    font-weight: 500;
    min-height: 16px;
}

#results {
    display: flex;
    flex-direction: column;
}

/* Кнопка скачать все */
.download-all-button {
    width: 100%;
    padding: 8px;
    font-size: 0.9em;
    margin-bottom: 12px;
}

/* Адаптивная сетка для файлов */
.files-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Адаптивность для разных размеров экрана */
@media (max-width: 1024px) {
    .files-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .files-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    text-align: center;
    min-height: 60px;
}

.result-item .file-name {
    margin-bottom: 6px;
    word-break: break-word;
    font-size: 0.85em;
}

.result-item .btn-download {
    padding: 5px 10px;
    text-decoration: none;
    border-radius: 3px;
    background-color: #007bff;
    color: white;
    font-size: 0.85em;
    display: inline-block;
    transition: background-color 0.3s;
}

.result-item .btn-download:hover {
    background-color: #0056b3;
    text-decoration: none;
}

/* Старые стили для обратной совместимости */
.result-item a {
    display: block;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    margin-top: 6px;
    font-size: 0.85em;
}

.result-item a:hover {
    text-decoration: underline;
}

#excelStatus {
    margin-top: 15px;
    padding: 10px;
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 5px;
    display: none;
}

.hidden {
    display: none !important;
}

/* Стили для предпросмотра */
#previewCanvas {
    border: 1px solid #ddd;
    background: white;
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
}

#previewText {
    color: #666;
    font-size: 0.85em;
    margin-top: 8px;
}
