/* ==========================================================================
   WP Quiz Plugin — Frontend Styles
   ========================================================================== */

/* Контейнер */
.wqp-quiz-container {
    max-width: 720px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
}

/* Кнопки */
.wqp-btn {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

.wqp-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.wqp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wqp-btn-primary {
    background: #2271b1;
    color: #fff;
}

.wqp-btn-primary:hover {
    background: #135e96;
    color: #fff;
}

.wqp-btn-success {
    background: #00a32a;
    color: #fff;
}

.wqp-btn-success:hover {
    background: #008a20;
    color: #fff;
}

.wqp-btn-danger {
    background: #d63638;
    color: #fff;
}

.wqp-btn-danger:hover {
    background: #b32d2e;
    color: #fff;
}

/* Стартовый экран */
.wqp-quiz-start {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.wqp-quiz-title {
    font-size: 24px;
    margin: 0 0 12px 0;
    color: #1d2327;
}

.wqp-quiz-description {
    color: #50575e;
    margin-bottom: 20px;
    font-size: 15px;
}

.wqp-quiz-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.wqp-meta-item {
    font-size: 14px;
    color: #646970;
    background: #f0f0f1;
    padding: 6px 14px;
    border-radius: 20px;
}

/* Прогресс-бар */
.wqp-progress-bar-wrapper {
    margin-bottom: 24px;
}

.wqp-progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.wqp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2271b1, #00a32a);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.wqp-progress-text {
    font-size: 13px;
    color: #646970;
}

/* Область вопроса */
.wqp-quiz-question {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.wqp-question-text {
    font-size: 18px;
    color: #1d2327;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

/* Варианты ответов */
.wqp-answers-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wqp-answer-option {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    font-size: 15px;
    color: #1d2327;
}

.wqp-answer-option:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.wqp-answer-option.wqp-selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.wqp-answer-option.wqp-correct {
    border-color: #00a32a;
    background: #edfaef;
    cursor: default;
}

.wqp-answer-option.wqp-incorrect {
    border-color: #d63638;
    background: #fcf0f1;
    cursor: default;
}

.wqp-answer-option.wqp-show-correct {
    border-color: #00a32a;
    background: #edfaef;
}

.wqp-answer-option.wqp-disabled {
    cursor: default;
    opacity: 0.8;
}

.wqp-answer-option.wqp-disabled:hover {
    border-color: #e0e0e0;
    background: #fff;
}

.wqp-answer-option.wqp-correct:hover,
.wqp-answer-option.wqp-incorrect:hover,
.wqp-answer-option.wqp-show-correct:hover {
    transform: none;
    box-shadow: none;
}

.wqp-answer-radio {
    width: 20px;
    height: 20px;
    border: 2px solid #c3c4c7;
    border-radius: 50%;
    margin-right: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.wqp-answer-option.wqp-selected .wqp-answer-radio {
    border-color: #2271b1;
    background: #2271b1;
    color: #fff;
}

.wqp-answer-option.wqp-correct .wqp-answer-radio {
    border-color: #00a32a;
    background: #00a32a;
    color: #fff;
}

.wqp-answer-option.wqp-incorrect .wqp-answer-radio {
    border-color: #d63638;
    background: #d63638;
    color: #fff;
}

.wqp-answer-text-label {
    flex: 1;
}

/* Обратная связь */
.wqp-feedback {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
}

.wqp-feedback-correct {
    background: #edfaef;
    color: #00a32a;
    border: 1px solid #00a32a;
}

.wqp-feedback-incorrect {
    background: #fcf0f1;
    color: #d63638;
    border: 1px solid #d63638;
}

.wqp-feedback .wqp-correct-answer-hint {
    display: block;
    margin-top: 6px;
    font-weight: 400;
    font-size: 14px;
}

/* Кнопка следующий вопрос */
.wqp-question-actions {
    margin-top: 20px;
    text-align: right;
}

/* Результаты */
.wqp-quiz-results {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.wqp-results-header {
    text-align: center;
    margin-bottom: 28px;
}

.wqp-results-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.wqp-results-title {
    font-size: 24px;
    margin: 0 0 8px 0;
}

.wqp-results-title.wqp-passed {
    color: #00a32a;
}

.wqp-results-title.wqp-failed {
    color: #d63638;
}

.wqp-results-score {
    font-size: 48px;
    font-weight: 700;
    margin: 12px 0;
}

.wqp-results-score.wqp-passed {
    color: #00a32a;
}

.wqp-results-score.wqp-failed {
    color: #d63638;
}

.wqp-results-passing {
    font-size: 14px;
    color: #646970;
}

.wqp-results-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.wqp-stat-item {
    text-align: center;
}

.wqp-stat-value {
    font-size: 28px;
    font-weight: 700;
    display: block;
}

.wqp-stat-label {
    font-size: 13px;
    color: #646970;
}

/* Детальные результаты */
.wqp-results-details {
    margin-top: 28px;
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

.wqp-results-details h4 {
    font-size: 16px;
    margin-bottom: 16px;
}

.wqp-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f1;
}

.wqp-result-item:last-child {
    border-bottom: none;
}

.wqp-result-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.wqp-result-content {
    flex: 1;
}

.wqp-result-question-text {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.wqp-result-answer-text {
    font-size: 13px;
    color: #646970;
}

.wqp-result-answer-text.wqp-wrong {
    color: #d63638;
    text-decoration: line-through;
}

.wqp-result-correct-text {
    font-size: 13px;
    color: #00a32a;
    font-weight: 500;
}

/* Кнопка повтора */
.wqp-results-actions {
    text-align: center;
    margin-top: 24px;
}

/* Авторизация */
.wqp-login-required {
    text-align: center;
    padding: 40px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
}

/* Ошибка */
.wqp-error {
    color: #d63638;
    text-align: center;
    padding: 20px;
    background: #fcf0f1;
    border: 1px solid #d63638;
    border-radius: 8px;
}

/* Загрузка */
.wqp-loading {
    text-align: center;
    padding: 40px;
    color: #646970;
}

.wqp-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: wqp-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes wqp-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Адаптивность
   ========================================================================== */

@media screen and (max-width: 600px) {
    .wqp-quiz-container {
        margin: 10px;
    }

    .wqp-quiz-start,
    .wqp-quiz-question,
    .wqp-quiz-results {
        padding: 20px;
        border-radius: 8px;
    }

    .wqp-quiz-title {
        font-size: 20px;
    }

    .wqp-question-text {
        font-size: 16px;
    }

    .wqp-answer-option {
        padding: 12px 14px;
        font-size: 14px;
    }

    .wqp-btn {
        padding: 10px 20px;
        font-size: 15px;
        width: 100%;
    }

    .wqp-results-score {
        font-size: 36px;
    }

    .wqp-results-stats {
        gap: 16px;
    }

    .wqp-quiz-meta {
        flex-direction: column;
        gap: 8px;
    }
}

@media screen and (max-width: 400px) {
    .wqp-quiz-start,
    .wqp-quiz-question,
    .wqp-quiz-results {
        padding: 16px;
    }
}
