/* ========================================
   ПЕРЕМЕННЫЕ ТЕМ
   ======================================== */

:root {
    /* Тёмная тема (по умолчанию) */
    --bg-primary: #0a0e1a;
    --bg-secondary: #141b2d;
    --bg-card: #1a2338;
    --bg-hover: #243a5a;
    --bg-input: #1a2338;
    --bg-table: #1a2338;
    --bg-table-hover: #243a5a;
    --bg-answer: #1a2338;
    --bg-answer-hover: #243a5a;
    --bg-success: #1a2a1a;
    --bg-error: #2a1a1a;
    --bg-pending: #2a2a1a;
    
    --text-primary: #e0e0e0;
    --text-secondary: #a0c4ff;
    --text-muted: #5a7a9a;
    --text-light: #b0c4de;
    --text-dark: #d0d0d0;
    
    --border-color: #2a3a5a;
    --border-light: rgba(36, 224, 202, 0.15);
    --border-input: #2a3a5a;
    
    --accent-color: #24e0ca;
    --accent-hover: #1a9a8a;
    --accent-shadow: rgba(36, 224, 202, 0.3);
    
    --shadow-color: rgba(36, 224, 202, 0.1);
    
    --success-color: #4caf50;
    --error-color: #dc3545;
    --warning-color: #ff9800;
    
    --card-gradient: linear-gradient(135deg, #1a2338 0%, #243a5a 100%);
    --button-gradient: linear-gradient(135deg, #24e0ca 0%, #1a9a8a 100%);
    --progress-gradient: linear-gradient(90deg, #24e0ca, #1a9a8a);
    
    --scrollbar-track: #1a2338;
    --scrollbar-thumb: #24e0ca;
}

/* Светлая тема */
[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e8edf3;
    --bg-input: #ffffff;
    --bg-table: #ffffff;
    --bg-table-hover: #f8f9fa;
    --bg-answer: #f8f9fa;
    --bg-answer-hover: #e9ecef;
    --bg-success: #d4edda;
    --bg-error: #f8d7da;
    --bg-pending: #fff3cd;
    
    --text-primary: #1a1a2e;
    --text-secondary: #2d3748;
    --text-muted: #718096;
    --text-light: #4a5568;
    --text-dark: #2d3748;
    
    --border-color: #e2e8f0;
    --border-light: rgba(36, 224, 202, 0.3);
    --border-input: #e2e8f0;
    
    --accent-color: #24e0ca;
    --accent-hover: #1a9a8a;
    --accent-shadow: rgba(36, 224, 202, 0.3);
    
    --shadow-color: rgba(0, 0, 0, 0.1);
    
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ff9800;
    
    --card-gradient: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    --button-gradient: linear-gradient(135deg, #24e0ca 0%, #1a9a8a 100%);
    --progress-gradient: linear-gradient(90deg, #24e0ca, #1a9a8a);
    
    --scrollbar-track: #f1f1f1;
    --scrollbar-thumb: #24e0ca;
}

/* ========================================
   ОСНОВНЫЕ СТИЛИ
   ======================================== */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

/* ========================================
   СКРОЛЛБАР
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

/* ========================================
   КОНТЕЙНЕРЫ
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px var(--shadow-color);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.admin-container {
    max-width: 1400px;
}

/* ========================================
   ЗАГОЛОВКИ
   ======================================== */

h1 {
    color: var(--accent-color);
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 3px solid var(--accent-color);
    padding-bottom: 15px;
    font-size: 32px;
    text-shadow: 0 0 20px var(--accent-shadow);
    transition: all 0.3s ease;
}

h2 {
    color: var(--accent-color);
    margin: 20px 0 15px;
    transition: color 0.3s ease;
}

h3 {
    color: var(--text-secondary);
    margin: 10px 0;
    transition: color 0.3s ease;
}

/* ========================================
   КНОПКА ПЕРЕКЛЮЧЕНИЯ ТЕМЫ
   ======================================== */

.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--button-gradient);
    color: #0a0e1a;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--accent-shadow);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(20deg);
    box-shadow: 0 6px 30px var(--accent-shadow);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* ========================================
   ГЛАВНАЯ СТРАНИЦА
   ======================================== */

.welcome-box {
    text-align: center;
    padding: 20px;
}

.welcome-box ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.welcome-box ul li {
    padding: 8px;
    font-size: 16px;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.welcome-box ul li::before {
    content: "✦ ";
    color: var(--accent-color);
}

/* ========================================
   ФОРМЫ
   ======================================== */

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-shadow);
}

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

.form-group textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

/* ========================================
   КНОПКИ
   ======================================== */

.btn-start,
.btn-submit,
.btn-retry,
.btn-check {
    background: var(--button-gradient);
    color: #0a0e1a;
    border: none;
    padding: 14px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-start:hover,
.btn-submit:hover,
.btn-retry:hover,
.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 30px var(--accent-shadow);
}

.btn-start {
    width: 100%;
    margin-top: 10px;
}

.btn-submit {
    width: 100%;
    margin-top: 20px;
}

.btn-check {
    width: 100%;
    margin-top: 20px;
    font-size: 16px;
}

/* ========================================
   ВОПРОСЫ
   ======================================== */

.question-block {
    background: var(--bg-card);
    padding: 25px;
    margin: 20px 0;
    border-radius: 12px;
    border-left: 4px solid var(--accent-color);
    transition: all 0.3s ease;
}

.question-block:hover {
    border-left-color: var(--accent-hover);
    box-shadow: 0 0 20px var(--shadow-color);
}

.question-text {
    font-size: 17px;
    color: var(--text-primary);
    margin: 10px 0;
    line-height: 1.6;
}

.question-type {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 15px;
}

/* ========================================
   ОТВЕТЫ
   ======================================== */

.answer-options {
    margin: 15px 0;
}

.answer-option {
    display: block;
    padding: 12px 18px;
    margin: 8px 0;
    background: var(--bg-answer);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.answer-option:hover {
    background: var(--bg-answer-hover);
    border-color: var(--accent-color);
    transform: translateX(5px);
}

.answer-option input {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.answer-option.custom-answer {
    background: var(--bg-card);
    border-color: var(--accent-color);
}

.answer-option.custom-option {
    background: var(--bg-pending);
    border-color: var(--warning-color);
}

.custom-input {
    width: 100%;
    padding: 10px;
    background: var(--bg-input);
    border: 2px dashed var(--accent-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.custom-input:focus {
    outline: none;
    border-color: var(--accent-hover);
    box-shadow: 0 0 15px var(--accent-shadow);
}

.custom-badge {
    background: var(--accent-color);
    color: #0a0e1a;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 5px;
}

.hint {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 10px;
}

/* ========================================
   ШАПКА ТЕСТА
   ======================================== */

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.user-info {
    font-size: 18px;
    color: var(--text-secondary);
}

.user-info strong {
    color: var(--accent-color);
}

/* ========================================
   РЕЗУЛЬТАТЫ
   ======================================== */

.result-wrapper {
    text-align: center;
    padding: 20px 0;
}

.success-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.result-card {
    text-align: center;
    padding: 40px;
    background: var(--card-gradient);
    border-radius: 15px;
    color: var(--text-primary);
    margin: 30px auto;
    max-width: 500px;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.result-card h2 {
    color: var(--accent-color);
    margin-bottom: 15px;
}

.score-display {
    font-size: 48px;
    margin: 20px 0;
}

.score-number {
    font-weight: 700;
    color: var(--accent-color);
}

.score-total {
    font-size: 24px;
    opacity: 0.7;
}

.percentage {
    font-size: 20px;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background: var(--bg-card);
    border-radius: 15px;
    overflow: hidden;
    margin: 15px 0;
    border: 1px solid var(--border-light);
}

.progress-fill {
    height: 100%;
    background: var(--progress-gradient);
    transition: width 1.5s ease;
    border-radius: 15px;
    box-shadow: 0 0 20px var(--accent-shadow);
}

.submitted-at {
    margin-top: 15px;
    opacity: 0.7;
    font-size: 14px;
}

.status-message {
    margin-top: 20px;
    font-size: 16px;
}

.checked-status {
    color: var(--success-color);
    font-weight: 600;
}

.pending-status {
    color: var(--warning-color);
    font-weight: 600;
}

.info-message {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

/* ========================================
   АДМИНКА
   ======================================== */

.admin-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.admin-nav a {
    padding: 10px 25px;
    background: var(--bg-card);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--accent-color);
    color: #0a0e1a;
    border-color: var(--accent-color);
    box-shadow: 0 0 20px var(--accent-shadow);
}

.form-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin: 20px 0;
    transition: all 0.3s ease;
}

.answer-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0;
}

.answer-row input[type="text"] {
    flex: 1;
    padding: 10px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.answer-row input[type="text"]:focus {
    border-color: var(--accent-color);
    outline: none;
}

.answer-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    color: var(--text-secondary);
}

.answer-row input[type="checkbox"] {
    accent-color: var(--accent-color);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-add-answer {
    background: var(--accent-color);
    color: #0a0e1a;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px 0;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-add-answer:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

/* ========================================
   СПИСОК ВОПРОСОВ
   ======================================== */

.questions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.question-preview {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.question-preview:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 20px var(--shadow-color);
}

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

.question-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.question-id {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 14px;
}

.question-type-badge {
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.question-type-badge.single {
    background: #1a3a5a;
    color: #4a9aff;
}

[data-theme="light"] .question-type-badge.single {
    background: #dbeafe;
    color: #1e40af;
}

.question-type-badge.multiple {
    background: #3a1a5a;
    color: #b47aff;
}

[data-theme="light"] .question-type-badge.multiple {
    background: #ede9fe;
    color: #6d28d9;
}

.question-type-badge.text {
    background: #3a3a1a;
    color: #d4a020;
}

[data-theme="light"] .question-type-badge.text {
    background: #fef3c7;
    color: #92400e;
}

.question-text-preview {
    color: var(--text-primary);
    margin: 10px 0;
    line-height: 1.5;
}

.answers-list {
    list-style: none;
    padding: 0;
    margin-top: 10px;
}

.answers-list li {
    padding: 5px 0;
    color: var(--text-light);
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.answers-list li:last-child {
    border-bottom: none;
}

.answers-list .correct-answer {
    color: var(--accent-color);
    font-weight: 500;
}

.btn-delete {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-delete:hover {
    background: #c82333;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.3);
}

/* ========================================
   ТАБЛИЦЫ
   ======================================== */

.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-table);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-hover);
    color: var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

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

.pending-badge {
    background: var(--warning-color);
    color: #0a0e1a;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.action-buttons a {
    text-decoration: none;
    padding: 5px 15px;
    border-radius: 5px;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-view {
    background: var(--accent-color);
    color: #0a0e1a;
}

.btn-view:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.delete-btn {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.delete-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* ========================================
   ПРОВЕРКА ОТВЕТОВ
   ======================================== */

.answer-check {
    background: var(--bg-card);
    padding: 20px;
    margin: 15px 0;
    border-radius: 10px;
    border-left: 4px solid var(--warning-color);
    transition: all 0.3s ease;
}

.answer-check.checked {
    border-left-color: var(--success-color);
}

.answer-check.pending {
    border-left-color: var(--warning-color);
}

.answer-text {
    background: var(--bg-primary);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid var(--border-color);
}

.score-options {
    display: flex;
    gap: 15px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.score-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-primary);
}

.score-options label:hover {
    border-color: var(--accent-color);
    background: var(--bg-hover);
}

.score-options input[type="radio"] {
    accent-color: var(--accent-color);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.score-options label.selected {
    border-color: var(--accent-color);
    background: var(--bg-hover);
    box-shadow: 0 0 20px var(--accent-shadow);
}

.status-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.badge-pending {
    background: var(--warning-color);
    color: #0a0e1a;
}

.badge-checked {
    background: var(--success-color);
    color: #0a0e1a;
}

/* ========================================
   УВЕДОМЛЕНИЯ
   ======================================== */

.error {
    background: var(--bg-error);
    color: var(--error-color);
    padding: 12px 18px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid var(--error-color);
}

.success {
    background: var(--bg-success);
    color: var(--success-color);
    padding: 12px 18px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid var(--success-color);
}

/* ========================================
   ДЕТАЛИ ОТВЕТОВ
   ======================================== */

.answer-detail {
    padding: 20px;
    margin: 15px 0;
    border-radius: 10px;
    border-left: 4px solid var(--border-color);
}

.answer-detail.correct {
    background: var(--bg-success);
    border-color: var(--success-color);
}

.answer-detail.incorrect {
    background: var(--bg-error);
    border-color: var(--error-color);
}

.answer-detail.manual-check {
    background: var(--bg-pending);
    border-color: var(--warning-color);
}

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

.incorrect-text {
    color: var(--error-color);
    font-weight: 600;
}

.manual-review {
    color: var(--warning-color);
    font-weight: 600;
}

.points-badge {
    background: var(--warning-color);
    color: #0a0e1a;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 5px;
}

/* ========================================
   ИЗОБРАЖЕНИЯ
   ======================================== */

.question-image {
    margin: 10px 0;
    text-align: center;
}

.question-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 20px var(--shadow-color);
}

/* ========================================
   РАЗДЕЛИТЕЛИ
   ======================================== */

hr {
    margin: 30px 0;
    border: none;
    border-top: 2px solid var(--border-color);
}

/* ========================================
   ССЫЛКИ
   ======================================== */

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.back-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ========================================
   АДАПТИВНОСТЬ
   ======================================== */

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .test-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .answer-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .admin-nav {
        flex-direction: column;
    }
    
    .admin-nav a {
        text-align: center;
    }
    
    .questions-list {
        grid-template-columns: 1fr;
    }
    
    .score-options label {
        width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    .action-buttons a {
        text-align: center;
    }
    
    .question-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .score-display {
        font-size: 36px;
    }
    
    .result-card {
        padding: 25px;
        margin: 15px;
    }
    
    .theme-toggle {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .btn-start,
    .btn-submit,
    .btn-retry {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .question-block {
        padding: 15px;
    }
    
    .score-display {
        font-size: 28px;
    }
    
    .theme-toggle {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}