:root[data-theme="light"] {
    --bg-color: #f5f7fa;
    --text-color: #333;
    --card-bg: white;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0,0,0,0.1);
    --code-bg: #f8fafc;
    --btn-bg: #e2e8f0;
    --btn-text: #2d3748;
    --primary-btn-bg: #4299e1;
    --primary-btn-text: white;
    --heading-color: #2d3748;
}

:root[data-theme="dark"] {
    --bg-color: #1a202c;
    --text-color: #e2e8f0;
    --heading-color: #90cdf4;
    --card-bg: #2d3748;
    --border-color: #4a5568;
    --shadow-color: rgba(0,0,0,0.3);
    --code-bg: #2d3748;
    --btn-bg: #4a5568;
    --btn-text: #e2e8f0;
    --primary-btn-bg: #4299e1;
    --primary-btn-text: white;
}

/* Базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Контейнер */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Заголовки */
h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--heading-color);
}

h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 1.5rem 0 1rem;
    color: var(--heading-color);
}

/* Поля ввода и кнопки */
.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

#migx-name {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#migx-name:focus {
    border-color: #4299e1;
}

.buttons-group {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #e2e8f0;
    color: #2d3748;
}

.btn.primary {
    background: #4299e1;
    color: white;
}

.btn:hover {
    opacity: 0.9;
}

/* Поля */
.field {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.field:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.field.dragging {
    opacity: 0.5;
    background: #f8fafc;
}

.field input,
.field select {
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

.drag-handle {
    cursor: move;
    color: #a0aec0;
    padding: 0.5rem;
    font-size: 1.2rem;
}

/* Вывод */
.outputs {
    margin-top: 2rem;
}

.output-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

.output-container {
    position: relative;
}

.output {
    background: var(--code-bg);
    padding: 1rem;
    border-radius: 0.375rem;
    font-family: monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    overflow-x: auto;
    color: var(--text-color);
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.copy-btn:hover {
    opacity: 1;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
    }

    .input-group {
        flex-direction: column;
    }

    .buttons-group {
        width: 100%;
    }

    .btn {
        flex: 1;
    }

    .field {
        padding: 1rem;
    }

    .field > div {
        flex-direction: column;
        gap: 0.5rem;
    }

    .field input,
    .field select {
        width: 100%;
        margin-right: 0;
    }

    .output {
        font-size: 0.75rem;
    }
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.field {
    animation: fadeIn 0.3s ease-out;
}

/* Добавить новые стили: */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--btn-bg);
}

:root[data-theme="light"] .dark-icon,
:root[data-theme="dark"] .light-icon {
    display: none;
}

.instructions {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.instruction-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.instruction-card h4 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.instruction-card ul {
    list-style-type: none;
    padding: 0;
}

.instruction-card li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.instruction-card strong {
    color: var(--primary-btn-bg);
}

@media (max-width: 768px) {
    .instruction-grid {
        grid-template-columns: 1fr;
    }
}

/* Обновим стили заголовков */
h1, h2, h3, h4 {
    color: var(--heading-color);
}

.output-section h3 {
    color: var(--heading-color);
    font-weight: 500;
    margin-bottom: 1rem;
}

.sub-field {
    position: relative;
    cursor: move;
    background: var(--bg-color);
    border: 1px solid transparent;
    padding: 10px;
    margin-bottom: 5px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    z-index: 1;
}

.sub-field:hover {
    border-color: var(--border-color);
}

.sub-field.dragging {
    opacity: 0.5;
    border: 2px dashed var(--border-color);
}

.sub-field .drag-handle {
    cursor: move;
    color: var(--text-color);
    opacity: 0.5;
    user-select: none;
}

.sub-field:hover .drag-handle {
    opacity: 1;
}

.subfields-container {
    min-height: 50px;
    padding: 10px 0;
}

.dragging-parent {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 10px;
    margin: 10px 0;
}

.dragging-parent .migx-subfields {
    background: var(--bg-color);
    border-radius: 5px;
    transition: all 0.2s ease;
}

.instructions-link {
    position: fixed;
    top: 20px;
    right: 80px;
    background: var(--primary-btn-bg);
    color: white;
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.instructions-link:hover {
    background: var(--primary-btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.generate-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 30px;
    background: var(--primary-btn-bg);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.generate-btn.scrolled {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
}

.generate-btn.scrolled span {
    display: none;
}

.generate-btn.scrolled::before {
    content: '⚡';
    font-size: 24px;
}

.generate-btn:hover {
    background: var(--primary-btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.instructions {
    scroll-margin-top: 20px;
}

.instruction-content {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 30px;
}

.instruction-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.instruction-content li {
    margin: 5px 0;
}

html {
    scroll-behavior: smooth;
}
