/* ============================================
   组件样式：卡片、按钮、表单、进度条、徽章
   ============================================ */

/* === 卡片 === */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-lg);
}

.card-accent {
    border-left: 4px solid var(--color-accent);
}

.card-warm {
    border-left: 4px solid var(--color-warm);
}

.card-hero {
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
    text-align: center;
}

/* === 按钮 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    outline: none;
    text-decoration: none;
    line-height: 1.5;
    min-height: 44px;
    max-width: 100%;
    white-space: normal;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px var(--color-accent-light);
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
    box-shadow: var(--shadow-button);
}
.btn-primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--color-accent);
    border: 1.5px solid var(--color-accent);
}
.btn-secondary:hover {
    background: var(--color-accent-light);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}
.btn-ghost:hover {
    color: var(--color-text);
    background: rgba(0,0,0,0.04);
}

.btn-large {
    padding: 16px 36px;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

.btn-block {
    width: 100%;
}

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

/* === 表单 === */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.form-hint {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: max(16px, 0.95rem);
    color: var(--color-text);
    background: var(--color-bg-card);
    transition: border-color var(--transition), box-shadow var(--transition);
    line-height: 1.6;
}

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

.form-input.error,
.form-textarea.error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px var(--color-error-light);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    overflow-wrap: anywhere;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b6b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-error {
    color: var(--color-error);
    font-size: 0.82rem;
    margin-top: var(--space-xs);
}

.form-success {
    color: var(--color-success);
    font-size: 0.82rem;
    margin-top: var(--space-xs);
}

/* === 进度条 (Stepper) === */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--space-2xl);
    min-width: 0;
}

.stepper-step {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.stepper-circle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid var(--color-border);
    color: var(--color-text-muted);
    background: var(--color-bg-card);
    transition: all var(--transition);
    flex-shrink: 0;
}

.stepper-circle.completed {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.stepper-circle.active {
    border-color: var(--color-accent);
    color: var(--color-accent);
    box-shadow: 0 0 0 4px var(--color-accent-light);
}

.stepper-label {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.stepper-line {
    width: 40px;
    height: 2px;
    background: var(--color-border);
    margin: 0 var(--space-sm);
    flex-shrink: 0;
}

.stepper-line.completed {
    background: var(--color-accent);
}

/* === 徽章 === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-success {
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.badge-pending {
    background: #f5f3f0;
    color: var(--color-text-muted);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.badge-dot.green { background: var(--color-success); }
.badge-dot.gray { background: var(--color-text-muted); }

/* === 标签 (Chips for core values) === */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.chip {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--color-accent-light);
    color: var(--color-accent);
    border: 1px solid transparent;
}

/* === 加载动画 === */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: var(--space-xl);
}

.spinner {
    width: 52px;
    height: 52px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 1.05rem;
    color: var(--color-text-secondary);
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === 微推送卡片 === */
.push-card {
    background: linear-gradient(135deg, var(--color-accent-light), var(--color-warm-light));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-lg);
    animation: fadeIn 0.4s ease;
}
.push-card-done {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
}
.push-message {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text);
    margin-bottom: var(--space-md);
}
.push-question {
    background: var(--color-bg-card);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
}
.push-rating {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}
.push-star {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-border);
    background: var(--color-bg-card);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.push-star:hover {
    border-color: var(--color-warm);
    color: var(--color-warm);
}
.push-star.active {
    background: var(--color-warm);
    border-color: var(--color-warm);
    color: #fff;
    transform: scale(1.1);
}

/* === 研究测量问卷 === */
.assessment-section {
    min-inline-size: 0;
    border: 0;
    margin: 0 0 var(--space-lg);
}

.assessment-section legend {
    padding: 0;
    font-family: var(--font-serif);
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--color-text);
}

.assessment-section-intro {
    margin: var(--space-sm) 0 var(--space-md);
}

.assessment-question {
    padding: var(--space-md) 0;
    border-top: 1px solid var(--color-border);
}

.assessment-question-title {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 600;
    line-height: 1.65;
    margin: 0 0 var(--space-sm);
}

.assessment-question-number {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    background: var(--color-accent-light);
    color: var(--color-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    line-height: 1;
}

.assessment-scale,
.assessment-ios-options {
    display: grid;
    grid-template-columns: repeat(var(--scale-columns, 7), minmax(0, 1fr));
    gap: 6px;
    max-width: 520px;
}

.assessment-choice,
.assessment-ios-choice {
    position: relative;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.assessment-choice:hover,
.assessment-ios-choice:hover {
    background: var(--color-accent-light);
}

.assessment-choice input,
.assessment-ios-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.assessment-choice-mark {
    width: 34px;
    height: 34px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-bg-card);
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    font-weight: 700;
    transition: inherit;
}

.assessment-choice input:checked + .assessment-choice-mark {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(84, 126, 111, .16);
}

.assessment-choice input:focus-visible + .assessment-choice-mark,
.assessment-ios-choice input:focus-visible + .assessment-ios-graphic {
    outline: 3px solid rgba(84, 126, 111, .42);
    outline-offset: 3px;
}

.assessment-ios-graphic {
    min-width: 40px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: inherit;
}

.assessment-ios-choice input:checked + .assessment-ios-graphic {
    background: var(--color-accent-light);
    box-shadow: 0 0 0 2px var(--color-accent);
}

.assessment-choice-number {
    font-size: .78rem;
    color: var(--color-text-secondary);
    line-height: 1;
}

.assessment-scale-endpoints {
    display: flex;
    justify-content: space-between;
    max-width: 520px;
    color: var(--color-text-muted);
    font-size: .78rem;
    line-height: 1.4;
}

/* === 微接触与研究日程 === */
.micro-contact-section {
    min-inline-size: 0;
    border: 0;
}

.micro-contact-section legend {
    padding: 0;
    font-family: var(--font-serif);
    font-size: 1.12rem;
    font-weight: 700;
}

.micro-contact-scale {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-sm);
    max-width: 400px;
}

.micro-contact-choice {
    position: relative;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-card);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.micro-contact-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.micro-contact-mark {
    font-weight: 700;
    color: var(--color-text-secondary);
}

.micro-contact-choice:hover,
.micro-contact-choice:focus-within {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
}

.micro-contact-choice input:checked + .micro-contact-mark {
    color: var(--color-accent);
}

.micro-contact-choice:has(input:checked) {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
    box-shadow: 0 0 0 3px rgba(84, 126, 111, .16);
}

.micro-contact-choice input:focus-visible + .micro-contact-mark {
    outline: 3px solid rgba(84, 126, 111, .42);
    outline-offset: 6px;
}

.study-schedule-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-sm);
}

.study-schedule-item {
    min-width: 0;
    min-height: 112px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-card);
}

.study-schedule-item.is-complete { background: var(--color-accent-light); }
.study-schedule-item.is-next { border-color: var(--color-accent); }
.study-schedule-item.is-locked { opacity: .58; }

.study-schedule-title {
    margin: 3px 0 auto;
    font-size: .8rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.study-schedule-action {
    min-height: 36px;
    margin-top: var(--space-sm);
    padding: 6px 10px;
    font-size: .8rem;
}

.study-schedule-status { margin-top: var(--space-sm); }

/* === 电子知情同意 === */
.consent-control {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
    margin: var(--space-md) 0 var(--space-lg);
    font-size: .9rem;
    line-height: 1.6;
}

.consent-control input {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    margin-top: 3px;
    accent-color: var(--color-accent);
}

.consent-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow: auto;
    overscroll-behavior: contain;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: rgba(0, 0, 0, .52);
}

.consent-modal-panel {
    width: min(100%, 760px);
    margin: max(8px, 2vh) auto;
    background: var(--color-bg-card);
    overflow-wrap: anywhere;
}

.assessment-ios .assessment-scale-endpoints {
    margin-top: 4px;
}

/* === 头像 === */
.avatar {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 4px solid var(--color-bg-card);
    box-shadow: var(--shadow-elevated);
}

.avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    background: var(--color-accent-light);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    border: 4px solid var(--color-bg-card);
    box-shadow: var(--shadow-elevated);
}

.avatar-lg {
    width: 160px;
    height: 160px;
}
.avatar-placeholder-lg {
    width: 160px;
    height: 160px;
    font-size: 64px;
}
