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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-secondary);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

header {
    text-align: center;
    margin-bottom: 15px;
}

.logo-header {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.kordev-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.3s;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.logo-text {
    color: var(--text-primary);
    font-size: 1.5em;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.kordev-logo:hover {
    opacity: 0.8;
}

.kordev-logo:hover .logo-icon {
    background: var(--accent-secondary);
    transform: scale(1.05);
}

header h1 {
    color: var(--text-primary);
    font-size: 2em;
    margin-bottom: 5px;
    margin-top: 10px;
    font-weight: 700;
}

nav {
    margin-top: 15px;
}

.nav-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--accent-secondary);
}

/* Формы */
.form-section, .test-section, .results-section {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* Кнопки */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: var(--accent-primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--error);
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Тест */
.test-header {
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.3s;
    width: 0%;
}

.question-counter {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.question-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.question-card.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.question-card h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 1.15em;
    line-height: 1.4;
}

.option {
    margin-bottom: 8px;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.option:hover {
    border-color: var(--accent-primary);
    background: #f0f4ff;
}

.option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.option.selected {
    border-color: var(--accent-primary);
    background: #e8edff;
}

/* Тест - кнопки действий */
.test-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    gap: 10px;
}

/* Результаты */
.results-section {
    text-align: center;
}

.score-display {
    margin: 30px 0;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    font-weight: bold;
    margin: 0 auto 20px;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.score-details {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    display: inline-block;
    border: 1px solid var(--border-color);
}

.score-details p {
    margin: 10px 0;
    font-size: 1.1em;
    color: var(--text-primary);
}

/* Детальные результаты */
.detailed-results {
    margin-top: 30px;
    text-align: left;
}

.all-correct-message {
    padding: 20px;
    background: #f0fdf4;
    color: #166534;
    border-radius: 8px;
    font-size: 1.2em;
    text-align: center;
    margin: 20px 0;
    border: 1px solid #bbf7d0;
}

.result-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.result-card.incorrect {
    border-left: 4px solid var(--error);
}

.result-question {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: var(--text-primary);
}

.result-answer {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-item {
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95em;
}

.answer-item.incorrect-answer {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.answer-item.correct-answer {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.answer-item pre {
    margin: 10px 0 0 0;
    padding: 10px;
    background: #f3f4f6;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.9em;
}

.answer-item code {
    font-family: 'Courier New', Courier, monospace;
    color: inherit;
}

.answer-item strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1em;
}

/* Админка */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--accent-primary);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    margin-top: 20px;
}

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

.section-header h2 {
    color: var(--text-primary);
}

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

.stat-card {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card h3 {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 2em;
    font-weight: bold;
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
}

thead {
    background: var(--accent-primary);
    color: white;
}

th, td {
    padding: 12px;
    text-align: left;
    color: var(--text-primary);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: var(--bg-secondary);
}

.question-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.question-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.question-item h3 {
    color: var(--text-primary);
    flex: 1;
    margin-right: 15px;
}

.question-options {
    margin-top: 10px;
    padding-left: 20px;
}

.question-option {
    padding: 8px 0;
    color: var(--text-secondary);
}

.question-option.correct {
    color: var(--success);
    font-weight: 600;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s;
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-modal:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.option-input {
    margin-bottom: 10px;
}

/* Редактор кода */
.code-editor-container {
    margin: 20px 0;
}

.code-editor {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    background: #0d1117;
    color: #c9d1d9;
    resize: vertical;
    tab-size: 4;
    line-height: 1.5;
}

.code-editor:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.code-actions {
    margin: 15px 0;
}

.check-code-btn {
    margin-right: 10px;
}

.code-status {
    padding: 12px 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
    font-size: 16px;
}

.code-status.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.code-status.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.code-console {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 50px;
    max-height: 200px;
    overflow-y: auto;
}

.code-console.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.code-console.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.solution-container {
    margin-top: 20px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.solution-code {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.solution-code h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.solution-code pre {
    margin: 0;
    padding: 10px;
    background: #0d1117;
    color: #c9d1d9;
    border-radius: 6px;
    overflow-x: auto;
}

.solution-code code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.hint {
    padding: 10px 15px;
    background: #fffbeb;
    border-left: 4px solid var(--warning);
    border-radius: 6px;
    margin: 15px 0;
    color: #92400e;
    font-size: 14px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .kordev-logo {
        font-size: 1.2em;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    header h1 {
        font-size: 2em;
    }

    .test-actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 14px;
    }

    .code-editor {
        font-size: 12px;
    }
}
