/**
 * WP Survey System - 前端样式
 *
 * @package WP_Survey
 * @version 1.0.0
 */

/* ==================== 变量定义 ==================== */
:root {
    --wpsurvey-primary: #1a73e8;
    --wpsurvey-accent: #00bcd4;
    --wpsurvey-button: #0d47a1;
    --wpsurvey-bg: #f5f7fa;
    --wpsurvey-card-bg: #ffffff;
    --wpsurvey-text: #333333;
    --wpsurvey-text-light: #666666;
    --wpsurvey-border: #e0e0e0;
    --wpsurvey-success: #4caf50;
    --wpsurvey-error: #f44336;
    --wpsurvey-warning: #ff9800;
}

/* ==================== 基础样式 ==================== */
.wpsurvey-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--wpsurvey-text);
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
}

.wpsurvey-card {
    background: var(--wpsurvey-card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 30px;
    margin-bottom: 20px;
}

/* ==================== 问卷头部 ==================== */
.wpsurvey-header {
    text-align: center;
    margin-bottom: 30px;
}

.wpsurvey-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--wpsurvey-text);
    margin: 0 0 15px 0;
}

.wpsurvey-header .description {
    color: var(--wpsurvey-text-light);
    font-size: 15px;
}

/* ==================== 进度条 ==================== */
.wpsurvey-progress {
    margin-bottom: 30px;
}

.wpsurvey-progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.wpsurvey-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--wpsurvey-primary), var(--wpsurvey-accent));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.wpsurvey-progress-text {
    text-align: center;
    font-size: 13px;
    color: var(--wpsurvey-text-light);
    margin-top: 8px;
}

/* ==================== 题目样式 ==================== */
.wpsurvey-question {
    margin-bottom: 30px;
}

.wpsurvey-question:last-child {
    margin-bottom: 0;
}

.wpsurvey-question-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
    color: var(--wpsurvey-text);
}

.wpsurvey-question-title .required {
    color: var(--wpsurvey-error);
    margin-left: 4px;
}

.wpsurvey-question-hint {
    font-size: 13px;
    color: var(--wpsurvey-text-light);
    margin-bottom: 10px;
}

/* ==================== 选项样式 ==================== */
.wpsurvey-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wpsurvey-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.wpsurvey-option input[type="radio"],
.wpsurvey-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0 12px 0 0;
    accent-color: var(--wpsurvey-primary);
}

.wpsurvey-option-label {
    flex: 1;
}

/* ==================== 文本输入 ==================== */
.wpsurvey-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--wpsurvey-border);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.wpsurvey-input:focus {
    outline: none;
    border-color: var(--wpsurvey-primary);
}

.wpsurvey-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--wpsurvey-border);
    border-radius: 8px;
    font-size: 15px;
    min-height: 120px;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

/* ==================== 下拉选择 ==================== */
.wpsurvey-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--wpsurvey-border);
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    cursor: pointer;
}

.wpsurvey-select:focus {
    outline: none;
    border-color: var(--wpsurvey-primary);
}

/* ==================== 评分题 ==================== */
.wpsurvey-rating {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wpsurvey-rating-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.wpsurvey-rating-item:hover {
    background: #fff3e0;
    border-color: var(--wpsurvey-warning);
}

.wpsurvey-rating-item.selected {
    background: var(--wpsurvey-warning);
    color: #fff;
    border-color: var(--wpsurvey-warning);
}

.wpsurvey-rating-item .star {
    color: #ccc;
}

.wpsurvey-rating-item.selected .star {
    color: #fff;
}

/* 数字评分模式 */
.wpsurvey-rating-numeric .wpsurvey-rating-item {
    width: auto;
    padding: 0 16px;
    font-weight: 600;
}

/* ==================== 矩阵题 ==================== */
.wpsurvey-matrix {
    overflow-x: auto;
}

.wpsurvey-matrix table {
    width: 100%;
    border-collapse: collapse;
}

.wpsurvey-matrix th,
.wpsurvey-matrix td {
    padding: 12px 8px;
    text-align: center;
    border: 1px solid var(--wpsurvey-border);
}

.wpsurvey-matrix th {
    background: #f5f7fa;
    font-weight: 600;
    font-size: 14px;
}

.wpsurvey-matrix td:first-child {
    text-align: left;
    font-weight: 500;
    background: #fafafa;
}

.wpsurvey-matrix input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--wpsurvey-primary);
}

/* ==================== 按钮 ==================== */
.wpsurvey-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--wpsurvey-border);
}

.wpsurvey-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.wpsurvey-btn-primary {
    background: var(--wpsurvey-button);
    color: #fff;
}

.wpsurvey-btn-primary:hover {
    background: #0a3570;
    transform: translateY(-1px);
}

.wpsurvey-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.wpsurvey-btn-secondary {
    background: #f0f0f0;
    color: var(--wpsurvey-text);
}

.wpsurvey-btn-secondary:hover {
    background: #e0e0e0;
}

/* ==================== 完成页面 ==================== */
.wpsurvey-complete {
    text-align: center;
    padding: 40px 20px;
}

.wpsurvey-complete-icon {
    width: 80px;
    height: 80px;
    background: var(--wpsurvey-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
}

.wpsurvey-complete-icon .dashicons {
    font-size: 40px;
    width: 40px;
    height: 40px;
    color: #fff;
}

.wpsurvey-complete h2 {
    font-size: 22px;
    color: var(--wpsurvey-text);
    margin: 0 0 15px 0;
}

.wpsurvey-complete p {
    color: var(--wpsurvey-text-light);
    margin: 0;
}

/* ==================== 错误和提示 ==================== */
.wpsurvey-error {
    color: var(--wpsurvey-error);
    font-size: 14px;
    margin-top: 8px;
}

.wpsurvey-message {
    text-align: center;
    padding: 40px 20px;
}

.wpsurvey-message .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: var(--wpsurvey-warning);
    margin-bottom: 15px;
}

.wpsurvey-message p {
    margin: 0 0 20px 0;
    font-size: 16px;
}

.wpsurvey-access-denied {
    background: var(--wpsurvey-card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 30px;
}

.wpsurvey-btn-login {
    display: inline-block;
    padding: 12px 28px;
    background: var(--wpsurvey-primary);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s;
}

.wpsurvey-btn-login:hover {
    background: #1557b0;
}

/* ==================== 加载状态 ==================== */
.wpsurvey-loading {
    text-align: center;
    padding: 40px 20px;
}

.wpsurvey-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: var(--wpsurvey-primary);
    border-radius: 50%;
    animation: wpsurvey-spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

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

/* ==================== 逐步展示模式 ==================== */
.wpsurvey-step-mode .wpsurvey-question {
    display: none;
}

.wpsurvey-step-mode .wpsurvey-question.active {
    display: block;
    animation: wpsurvey-fadeIn 0.3s ease;
}

@keyframes wpsurvey-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 响应式 ==================== */
@media (max-width: 600px) {
    .wpsurvey-container {
        padding: 15px;
    }
    
    .wpsurvey-card {
        padding: 20px;
        border-radius: 8px;
    }
    
    .wpsurvey-header h1 {
        font-size: 20px;
    }
    
    .wpsurvey-buttons {
        flex-direction: column;
    }
    
    .wpsurvey-btn {
        width: 100%;
    }
    
    .wpsurvey-rating {
        justify-content: center;
    }
    
    .wpsurvey-matrix {
        font-size: 14px;
    }
    
    .wpsurvey-matrix th,
    .wpsurvey-matrix td {
        padding: 8px 4px;
    }
}

/* ==================== 暗色模式支持（可选） ==================== */
@media (prefers-color-scheme: dark) {
    .wpsurvey-dark-mode .wpsurvey-card {
        background: #1e1e1e;
        color: #e0e0e0;
    }
}
