/* APP风格设计 - 黑绿色调，移动端优先 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* 配色方案 - 黑绿色调 */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-input: #252525;
    --accent-green: #00ff88;
    --accent-green-dark: #00d970;
    --accent-green-light: #33ffaa;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #2a2a2a;
    --border-active: #00ff88;
    --success-bg: rgba(0, 255, 136, 0.1);
    --error-bg: rgba(255, 68, 68, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-green: 0 4px 20px rgba(0, 255, 136, 0.2);
    --bottom-nav-height: 60px;
    --header-height: 120px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ========== APP风格顶部导航栏 ========== */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: env(safe-area-inset-top, 0) 0 0 0;
    width: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.header-left {
    flex: 1;
}

.app-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-green-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 700;
    font-size: 16px;
    border: 2px solid var(--bg-card);
}

.header-balance {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.balance-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-green);
}

/* ========== 主内容区 ========== */
.app-main {
    min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0));
    position: relative;
}

.app-page {
    display: none;
    padding: 20px;
    animation: slideIn 0.3s ease;
}

.app-page.active {
    display: block;
}

/* ========== 标签页和筛选 ========== */
.tabs-container {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-green);
    color: #000;
    border-color: var(--accent-green);
    font-weight: 600;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 0 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

.filter-btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-green);
    color: #000;
    border-color: var(--accent-green);
    font-weight: 600;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========== 底部导航栏 ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0)) 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    pointer-events: auto;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 12px;
    position: relative;
    z-index: 1;
    pointer-events: auto;
}

.nav-item.active {
    color: var(--accent-green);
}

.nav-icon {
    font-size: 24px;
    line-height: 1;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
}

/* ========== 表单样式 ========== */
.app-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
    background: var(--bg-card);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.reward-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.reward-symbol {
    position: absolute;
    left: 16px;
    color: var(--accent-green);
    font-size: 20px;
    font-weight: 700;
    z-index: 1;
}

.reward-input {
    padding-left: 40px;
}

/* ========== 按钮样式 ========== */
.btn {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

.btn-large {
    width: 100%;
    padding: 18px 24px;
    font-size: 17px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-green-dark) 100%);
    color: #000;
    box-shadow: var(--shadow-green);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(0, 255, 136, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    font-size: 14px;
}

.btn-success {
    background: var(--accent-green);
    color: #000;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
}

.btn-danger {
    background: #ff4444;
    color: white;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
}

/* ========== 任务列表 ========== */
.tasks-container {
    margin-top: 20px;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.task-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-green);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.task-item:active {
    transform: scale(0.98);
    background: var(--bg-input);
}

.task-item:hover::before {
    opacity: 1;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.task-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    flex: 1;
}

.task-reward {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-green);
    white-space: nowrap;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.task-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
    font-size: 14px;
}

.task-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.task-status.pending {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.task-status.accepted {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.task-status.completed {
    background: var(--success-bg);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.task-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.task-actions .btn {
    flex: 1;
    min-width: 120px;
}

.task-screenshot {
    margin: 12px 0;
}

.task-screenshot img {
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.task-screenshot img:hover {
    transform: scale(1.02);
}

/* ========== 个人中心 ========== */
.profile-header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.avatar-upload-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 16px;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-green-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 700;
    font-size: 40px;
    margin: 0 auto;
    border: 4px solid var(--bg-card);
    overflow: hidden;
    position: relative;
}

.avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-green);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 3px solid var(--bg-card);
    font-size: 18px;
    transition: all 0.3s ease;
}

.avatar-upload-btn:hover {
    background: var(--accent-green-light);
    transform: scale(1.1);
}

.avatar-upload-btn:active {
    transform: scale(0.95);
}

.profile-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.edit-nickname-btn:hover {
    background: var(--bg-input);
    color: var(--accent-green);
    transform: scale(1.1);
}

.edit-nickname-btn:active {
    transform: scale(0.95);
}

.profile-username {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.profile-type {
    color: var(--text-secondary);
    font-size: 14px;
}

.profile-menu {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:active {
    background: var(--bg-input);
}

.menu-icon {
    font-size: 24px;
    margin-right: 16px;
    width: 32px;
    text-align: center;
}

.menu-text {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
}

.menu-value {
    color: var(--accent-green);
    font-weight: 700;
    font-size: 16px;
}

.menu-arrow {
    color: var(--text-muted);
    font-size: 20px;
    margin-left: 12px;
}

/* ========== 登录页面 ========== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 48px;
}

.logo-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.logo-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-container {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 30px 24px;
    border: 1px solid var(--border-color);
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.auth-tabs .tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 500;
}

.auth-tabs .tab-btn.active {
    background: var(--bg-secondary);
    color: var(--accent-green);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.form-container {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-container.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 消息弹窗样式 ========== */
#messageModalIcon.success {
    color: var(--accent-green);
}

#messageModalIcon.error {
    color: #ff6b6b;
}

#messageModalIcon.info {
    color: var(--text-secondary);
}

/* ========== 加载和空状态 ========== */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state::before {
    /* 使用Font Awesome图标，在HTML中直接使用 */
    font-size: 64px;
    display: block;
    margin-bottom: 20px;
    opacity: 0.5;
}

.message {
    padding: 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.message.success {
    background: var(--success-bg);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.message.error {
    background: var(--error-bg);
    color: #ff6b6b;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

/* ========== 弹窗样式 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 18px;
}

.modal-close:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.modal-footer .btn {
    flex: 1;
}

.form-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ========== 统计卡片样式 ========== */
.stat-card {
    min-width: 0;
    overflow: hidden;
}

.stat-card > div:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-card > div:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== 响应式设计 ========== */
@media (min-width: 768px) {
    .app-main {
        max-width: 768px;
        margin: 0 auto;
    }
    
    .auth-wrapper {
        max-width: 480px;
    }
    
    .tasks-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 20px;
    }
    
    /* 大屏幕上统计卡片可以更大 */
    .stat-card {
        padding: 20px !important;
    }
    
    .stat-card > div:first-child {
        font-size: 36px !important;
    }
    
    .stat-card > div:last-child {
        font-size: 14px !important;
    }
}

@media (min-width: 1024px) {
    .app-main {
        max-width: 1200px;
    }
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

::selection {
    background: var(--accent-green);
    color: #000;
}

::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

*:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}
