/* ===== ОБЩИЕ СТИЛИ ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

:root {
    /* Цвета */
    --primary: #2563eb;      /* Синий */
    --success: #16a34a;      /* Зелёный */
    --danger: #dc2626;       /* Красный */
    --dark: #1f2937;         /* Тёмный серый */
    --light: #f9fafb;        /* Светлый серый */
    --border: #e5e7eb;       /* Граница */
    --text-primary: #1f2937; /* Основной текст */
    --text-secondary: #6b7280; /* Вторичный текст */
    
    /* Тени */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--light);
    color: var(--text-primary);
}

/* ===== ТИПОГРАФИЯ ===== */

h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
}

h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 6px;
}

/* ===== КНОПКИ ===== */

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

/* Первичная кнопка */
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Кнопка регенерации (зеленая для действий при смене ставки) */
.btn-regenerate {
    background: var(--success) !important;
}

.btn-regenerate:hover {
    background: #15803d !important;
}

/* Вторичная кнопка */
.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-secondary:hover {
    background: #eff6ff;
}

/* Зелёная кнопка (для действий) */
.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

/* Опасная кнопка */
.btn-danger {
    background: #fee2e2;
    color: var(--danger);
    border: none;
}

.btn-danger:hover {
    background: #fecaca;
}

/* Кнопка закрытия */
.btn-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.btn-close:hover {
    color: var(--text-primary);
}

/* Большая кнопка */
.btn-large {
    padding: 12px 24px;
    font-size: 15px;
    width: 100%;
}

/* ===== ИКОНКА КНОПКА (ICON BUTTON) ===== */

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.btn-icon:hover:not(:disabled) {
    border-color: var(--primary);
    background-color: #eff6ff;
    color: var(--primary);
}

.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* Кнопка перевода между полями */
.btn-icon-translate {
    background: none;
    border: 2px solid var(--success);
    border-radius: 6px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
    color: var(--success);
}

.btn-icon-translate:hover {
    background-color: #dcfce7;
}

.btn-icon-translate svg {
    width: 20px;
    height: 20px;
}

/* ===== УВЕДОМЛЕНИЯ ===== */

.notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    pointer-events: none;
}

.notification {
    position: relative;
    margin-bottom: 12px;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease;
    pointer-events: auto;
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--danger);
}

.notification.info {
    border-left: 4px solid var(--primary);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */

.modal-overlay {
    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;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .btn {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== ТАБЛИЦЫ ===== */

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: #f3f4f6;
    border-bottom: 1px solid var(--border);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
}

tbody tr:hover {
    background: #f9fafb;
}

/* ===== БЕЙДЖИ И СТАТУСЫ ===== */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: #dbeafe;
    color: var(--primary);
}

.badge-success {
    background: #dcfce7;
    color: var(--success);
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

.badge-gray {
    background: #f3f4f6;
    color: #6b7280;
}

/* ===== ВЫДЕЛЕНИЕ / SELECTION ===== */

::selection {
    background: #dbeafe;
    color: var(--primary);
}

input[type="checkbox"]:checked {
    background-color: var(--success);
    border-color: var(--success);
}

/* ===== УТИЛИТЫ ===== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

/* ===== СКРОЛЛБАР ===== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===== ФОРМА ВХОДА ===== */

.login-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-title {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #2563eb;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.login-form .form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.login-form .form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-block {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
}

.login-error {
    margin-top: 15px;
    padding: 12px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 14px;
    text-align: center;
}

@media (max-width: 480px) {
    .login-box {
        padding: 30px 20px;
    }

    .login-title {
        font-size: 28px;
    }

    .login-container {
        padding: 15px;
    }
}

/* ===== HTML РЕДАКТОР ===== */

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: #f5f5f5;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.editor-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    font-weight: 600;
    color: var(--text-primary);
}

.editor-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.editor-btn:active {
    background: #1d4ed8;
}

.editor-separator {
    width: 1px;
    background: var(--border);
    margin: 0 4px;
}

.editor-content {
    padding: 12px !important;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    outline: none;
}

.editor-content:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.editor-content strong,
.editor-content b {
    font-weight: 700;
}

.editor-content em,
.editor-content i {
    font-style: italic;
}

.editor-content u {
    text-decoration: underline;
}

.editor-content ul {
    margin-left: 20px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.editor-content li {
    margin-bottom: 4px;
}

/* ===== МОДАЛ РЕГЕНЕРАЦИИ ===== */

.regeneration-stage-item {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.regeneration-stage-item.active {
    color: #2563eb;
    font-weight: 600;
}

.regeneration-stage-item.completed {
    color: #16a34a;
}

.regeneration-stage-item.completed span:first-child::before {
    content: '✓';
    display: inline-block;
    width: 20px;
    text-align: center;
}

.regeneration-stage-item span:first-child {
    min-width: 20px;
    text-align: center;
}