@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #dce8f2 0%, #ffffff 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 61, 122, 0.12);
    padding: 40px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    padding-bottom: 30px;
    border-bottom: 2px solid #e8f0f8;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2rem;
    color: #003d7a;
    margin-bottom: 10px;
}

header p {
    color: #5a7a9a;
    font-size: 1.1rem;
}

.progress-container {
    margin-bottom: 30px;
    background: #e8f0f8;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    height: 30px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #003d7a 0%, #007bff 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

#progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #4a6a8a;
    font-size: 0.85rem;
}

#question-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

#question-text {
    font-size: 1.3rem;
    color: #003d7a;
    margin-bottom: 25px;
    line-height: 1.6;
}

#options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-option {
    background: #f5f9fc;
    color: #1a3a5a;
    border: 2px solid #dce8f2;
    text-align: left;
    padding: 16px 20px;
}

.btn-option:hover {
    background: #e8f2fc;
    border-color: #007bff;
    transform: translateX(5px);
}

.btn-option:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #007bff;
    color: white;
    margin-top: 20px;
}

.btn-primary:hover {
    background: #0069d9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
}

.btn-success {
    background: #28a745;
    color: white;
    padding: 12px 30px;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 12px 30px;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

#result-container {
    animation: fadeIn 0.5s ease;
}

.result-card {
    background: #f5f9fc;
    border-radius: 15px;
    padding: 25px;
    margin: 15px 0;
    border: 2px solid #dce8f2;
}

.result-card h3 {
    color: #4a6a8a;
    font-size: 1rem;
    margin-bottom: 10px;
}

.score-value {
    font-size: 3rem;
    font-weight: bold;
    color: #003d7a;
    text-align: center;
}

.interpretation-text {
    font-size: 1.2rem;
    color: #1a3a5a;
    line-height: 1.6;
}

.feedback-section {
    margin-top: 30px;
    padding: 25px;
    background: #f5f9fc;
    border-radius: 15px;
    border: 2px solid #dce8f2;
}

.feedback-section h3 {
    color: #003d7a;
    margin-bottom: 15px;
}

#feedback-buttons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

#feedback-detail-container {
    margin-top: 20px;
}

#feedback-detail-container label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #4a6a8a;
}

#feedback-detail-container textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #dce8f2;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

#feedback-detail-container textarea:focus {
    outline: none;
    border-color: #007bff;
}

.success-message {
    margin-top: 15px;
    padding: 15px;
    background: #d4edda;
    border-radius: 10px;
    color: #155724;
    font-weight: 500;
}

#results-stats {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e8f0f8;
}

#results-stats h3 {
    color: #003d7a;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.stat-item {
    background: #f5f9fc;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.stat-label {
    display: block;
    color: #5a7a9a;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #003d7a;
}

#interpretations-list {
    margin-top: 15px;
}

#interpretations-list h4 {
    color: #4a6a8a;
    margin-bottom: 10px;
}

.interpretation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #dce8f2;
}

.badge {
    background: #007bff;
    color: white;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

/* Мобильная адаптация */
@media (max-width: 600px) {
    .container {
        padding: 16px;
        margin: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

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

    #question-text {
        font-size: 1.1rem;
    }

    .btn {
        padding: 12px 18px;
        font-size: 0.9rem;
    }

    #feedback-buttons {
        flex-direction: column;
    }

    .btn-success, .btn-danger {
        width: 100%;
        text-align: center;
    }
}

/* ===== Сетка вопросов (авто-адаптивная) ===== */
#questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.question-card {
    background: #f5f9fc;
    border: 2px solid #dce8f2;
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.question-card:hover {
    border-color: #b8d4f0;
}

.question-card.answered {
    border-color: #007bff;
    background: #e8f4fd;
}

.question-title {
    font-size: 1rem;
    font-weight: 600;
    color: #003d7a;
    margin-bottom: 15px;
    line-height: 1.5;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== Radio-кнопки ===== */
.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #dce8f2;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.radio-label:hover {
    border-color: #007bff;
    background: #f5f9fc;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #b8d4f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
}

.radio-custom::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #007bff;
    transform: scale(0);
    transition: transform 0.2s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: #007bff;
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    transform: scale(1);
}

.radio-label input[type="radio"]:checked ~ .radio-text {
    color: #007bff;
    font-weight: 600;
}

.radio-label:has(input[type="radio"]:checked) {
    border-color: #007bff;
    background: #e8f4fd;
}

.radio-text {
    font-size: 0.95rem;
    color: #4a6a8a;
    transition: color 0.2s ease;
}

/* ===== Адаптация для мобильных ===== */
@media (max-width: 768px) {
    #questions-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .question-card {
        padding: 16px;
    }

    .question-title {
        font-size: 0.95rem;
    }

    .radio-label {
        padding: 8px 12px;
    }

    .radio-text {
        font-size: 0.9rem;
    }
}

/* ===== Адаптация для очень узких экранов ===== */
@media (max-width: 400px) {
    #questions-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Карточка результата (отличается от вопросов) ===== */
.result-card-style {
    border: none;
    background: linear-gradient(135deg, #003d7a 0%, #007bff 100%);
    box-shadow: 0 8px 25px rgba(0, 61, 122, 0.3);
    color: white;
    position: relative;
    overflow: hidden;
}

.result-card-style::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.result-card-style .result-title {
    color: white;
    font-size: 1.15rem;
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.25);
    margin-bottom: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.result-score-display,
.result-interp-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.result-score-label,
.result-interp-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-score-value {
    font-size: 2.2rem;
    font-weight: bold;
    color: white;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.result-interp-value {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.5;
}

.result-feedback-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.result-feedback-question {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 12px;
    line-height: 1.4;
}

.result-feedback-section .feedback-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.result-feedback-section .feedback-detail-box {
    margin-top: 12px;
}

.result-feedback-section .feedback-detail-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
}

.result-feedback-section .feedback-detail-box textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transition: border-color 0.3s ease;
}

.result-feedback-section .feedback-detail-box textarea:focus {
    outline: none;
    border-color: white;
}

.result-error {
    text-align: center;
    padding: 15px;
    color: #dc3545;
    font-weight: 500;
}

.result-card-style .success-message {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    text-align: center;
}

/* Маленькие кнопки для карточки результата */
.btn-sm {
    padding: 8px 18px;
    font-size: 0.85rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-sm.btn-success {
    background: #28a745;
    color: white;
}

.btn-sm.btn-success:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-sm.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-sm.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-sm.btn-primary {
    background: white;
    color: #003d7a;
    margin-top: 8px;
    font-weight: 600;
}

.btn-sm.btn-primary:hover {
    background: #f0f5fa;
    transform: translateY(-1px);
}

/* Кнопка сброса */
.btn-sm.btn-reset {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
}

.btn-sm.btn-reset:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* Ссылка на админку внизу главной страницы */
.footer-admin-link {
    text-align: center;
    padding: 10px 0 5px;
    font-size: 0.8rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.footer-admin-link:hover {
    opacity: 1;
}

.footer-admin-link a {
    color: #5a7a9a;
    text-decoration: none;
}

.footer-admin-link a:hover {
    color: #003d7a;
    text-decoration: underline;
}

/* ===== Административные страницы ===== */

/* Форма входа */
.admin-form-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 20px 0;
}

.admin-login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-weight: 600;
    color: #003d7a;
    font-size: 0.95rem;
}

.form-group input[type="password"] {
    padding: 14px 16px;
    border: 2px solid #dce8f2;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
    background: white;
}

.form-group input[type="password"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.admin-error {
    background: #f8d7da;
    color: #721c24;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    border: 1px solid #f5c6cb;
}

.admin-back-link {
    text-align: center;
    margin-top: 20px;
}

.admin-back-link a {
    color: #5a7a9a;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.admin-back-link a:hover {
    color: #003d7a;
}

/* Блокировка входа */
.admin-blocked {
    background: #fff3cd;
    color: #856404;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    border: 2px solid #ffc107;
}

.blocked-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.blocked-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #533f03;
    margin-bottom: 8px;
}

.blocked-text {
    font-size: 0.95rem;
    color: #856404;
    margin-bottom: 12px;
}

.blocked-timer {
    font-size: 2.5rem;
    font-weight: 700;
    color: #dc3545;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
}

.btn-full {
    width: 100%;
    text-align: center;
    padding: 14px 24px;
    font-size: 1.05rem;
}

/* Навигация в админке */
.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e8f0f8;
    flex-wrap: wrap;
}

.admin-nav-link {
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: #4a6a8a;
    background: #f5f9fc;
    border: 1px solid #dce8f2;
    transition: all 0.2s ease;
}

.admin-nav-link:hover {
    background: #e8f2fc;
    border-color: #007bff;
    color: #003d7a;
}

.admin-nav-link.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.admin-nav-logout {
    margin-left: auto;
    color: #dc3545;
    border-color: #f5c6cb;
}

.admin-nav-logout:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.admin-nav-home {
    color: #28a745;
    border-color: #c3e6cb;
}

.admin-nav-home:hover {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

/* Сводка статистики */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.summary-card {
    background: #f5f9fc;
    border: 2px solid #dce8f2;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.3s ease;
}

.summary-card:hover {
    border-color: #007bff;
}

.summary-label {
    font-size: 0.85rem;
    color: #5a7a9a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.summary-value {
    font-size: 2rem;
    font-weight: bold;
    color: #003d7a;
}

/* Секции статистики */
.stats-section {
    margin-bottom: 30px;
}

.stats-section h3 {
    color: #003d7a;
    margin-bottom: 16px;
    font-size: 1.15rem;
}

/* График-распределение */
.interpretations-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-label {
    flex: 0 0 200px;
    font-size: 0.9rem;
    color: #4a6a8a;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-bar-track {
    flex: 1;
    height: 28px;
    background: #e8f0f8;
    border-radius: 6px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #003d7a, #007bff);
    border-radius: 6px;
    transition: width 0.5s ease;
    min-width: 4px;
}

.chart-count {
    flex: 0 0 40px;
    font-weight: bold;
    color: #003d7a;
    font-size: 0.95rem;
    text-align: center;
}

.no-data {
    color: #5a7a9a;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Таблица результатов */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 2px solid #dce8f2;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th {
    background: #003d7a;
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.results-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e8f0f8;
    color: #333;
}

.results-table tr:last-child td {
    border-bottom: none;
}

.results-table tr:hover td {
    background: #f5f9fc;
}

.cell-score {
    font-weight: bold;
    color: #003d7a;
    text-align: center;
}

/* Страница экспорта */
.export-container {
    max-width: 600px;
    margin: 0 auto;
}

.export-card {
    background: #f5f9fc;
    border: 2px solid #dce8f2;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
}

.export-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.export-card h3 {
    color: #003d7a;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.export-card p {
    color: #5a7a9a;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.export-features {
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 0 auto 24px;
    max-width: 400px;
}

.export-features li {
    padding: 8px 0;
    color: #4a6a8a;
    font-size: 0.9rem;
    border-bottom: 1px solid #e8f0f8;
}

.export-features li:last-child {
    border-bottom: none;
}

.btn-export {
    font-size: 1.1rem;
    padding: 16px 40px;
    margin-top: 0;
}

.btn-export:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.export-status {
    margin-top: 16px;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
}

.export-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.export-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .admin-nav {
        flex-direction: column;
    }

    .admin-nav-logout {
        margin-left: 0;
    }

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

    .chart-label {
        flex-basis: 120px;
        font-size: 0.8rem;
    }

    .export-card {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .stats-summary {
        grid-template-columns: 1fr;
    }
}