/* 摇一摇应用样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #07c160;
    --primary-dark: #06ae56;
    --secondary-color: #576b95;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-secondary: #888888;
    --border-color: #e5e5e5;
    --danger-color: #e64340;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
}

/* 页面切换 */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* 登录页面 */
#login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.login-container {
    background: var(--card-bg);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 360px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo .shake-icon {
    font-size: 60px;
    animation: shake 2s infinite;
}

.logo h1 {
    font-size: 28px;
    margin: 10px 0 5px;
    color: var(--primary-color);
}

.logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(-15deg); }
    20% { transform: rotate(15deg); }
    30% { transform: rotate(-15deg); }
    40% { transform: rotate(15deg); }
    50%, 100% { transform: rotate(0deg); }
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-tip {
    margin-top: 15px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-block {
    width: 100%;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

/* 头部 */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h3 {
    font-size: 18px;
}

.header-right {
    position: relative;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* 摇一摇区域 */
.shake-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 20px;
}

/* 位置信息 */
.location-info {
    padding: 15px 20px;
    background: var(--card-bg);
    margin: 0 15px 15px;
    border-radius: 12px;
    text-align: center;
}

.location-info #location-status {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.location-info .btn {
    max-width: 200px;
    margin: 0 auto;
}

.shake-btn {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(7, 193, 96, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
}

.shake-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(7, 193, 96, 0.4);
}

.shake-btn:active {
    transform: scale(0.95);
}

.shake-btn.shaking {
    animation: shake 0.5s ease-in-out;
}

.shake-inner {
    text-align: center;
    color: white;
}

.shake-icon-large {
    font-size: 60px;
}

.shake-inner p {
    margin-top: 10px;
    font-size: 18px;
}

.shake-hint {
    margin-top: 30px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* 用户列表 */
.section {
    padding: 20px;
}

.section h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--text-secondary);
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.user-item:hover {
    background: #f0f0f0;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-right: 15px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 16px;
    font-weight: 500;
}

.user-distance {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 20px;
}

/* 匹配用户 */
.matched-user {
    text-align: center;
    padding: 20px 0;
}

.matched-user .user-avatar {
    width: 80px;
    height: 80px;
    font-size: 36px;
    margin: 0 auto 15px;
}

.matched-user .user-name {
    font-size: 20px;
    margin-bottom: 5px;
}

.matched-user .user-distance {
    font-size: 14px;
}

.match-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.match-actions .btn {
    flex: 1;
}

/* 用户详情 */
.user-detail {
    text-align: center;
    padding: 10px 0;
}

.user-detail .user-avatar {
    width: 80px;
    height: 80px;
    font-size: 36px;
    margin: 0 auto 15px;
}

.user-actions {
    margin-top: 20px;
}

/* 发送消息 */
#message-to-user {
    text-align: center;
    padding: 10px 0;
    margin-bottom: 15px;
}

#message-content {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    resize: none;
    margin-bottom: 15px;
}

/* 消息页面 */
.message-tabs {
    display: flex;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.message-list {
    padding: 15px;
}

.message-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.message-from {
    font-weight: 500;
}

.message-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.message-content {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.reply-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.reply-btn:hover {
    background: var(--primary-dark);
}

.message-unread {
    position: relative;
}

.message-unread::after {
    content: '';
    position: absolute;
    top: 15px;
    right: 15px;
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
}

/* 加载 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 60px;
    margin-bottom: 15px;
}

/* 问答页面 */
#quiz-page {
    display: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    min-height: 100vh;
    padding: 20px;
}

.quiz-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    margin: 40px auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-right: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    border-radius: 4px;
    transition: width 0.3s;
}

#question-count {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

.question-card {
    margin-bottom: 30px;
}

#question-text {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 25px;
    line-height: 1.6;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.option-item:hover {
    background: #f0f0f0;
}

.option-item.selected {
    background: rgba(7, 193, 96, 0.1);
    border-color: var(--primary-color);
}

.option-item .option-index {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.option-item.selected .option-index {
    background: var(--primary-color);
    color: white;
}

.option-item .option-text {
    flex: 1;
    font-size: 16px;
}