/* ============================================
   E听说答案库 - 移动端优先设计
   ============================================ */

:root {
    --primary: #00B050;
    --primary-dark: #009940;
    --primary-light: #e8f5e9;
    --secondary: #2196F3;
    --accent: #FF5722;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-light: #666666;
    --text-muted: #999999;
    --border: #e8e8e8;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   导航栏
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow);
    z-index: 1000;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
}

.nav-brand i {
    font-size: 1.4rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   按钮
   ============================================ */
.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:active {
    background: var(--bg);
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.05rem;
    border-radius: var(--radius-lg);
}

.btn-back {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text);
    cursor: pointer;
}

/* ============================================
   页面布局
   ============================================ */
.main-content {
    padding-top: 56px;
    min-height: 100vh;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

.container {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   首页 - 试卷列表
   ============================================ */
.page-title {
    text-align: center;
    padding: 24px 0 20px;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.paper-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.paper-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.paper-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.paper-card:active {
    transform: scale(0.98);
    border-color: var(--primary);
}

.paper-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.paper-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.paper-info h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.paper-info .paper-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.paper-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ============================================
   试卷详情
   ============================================ */
.detail-header {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    padding: 0 8px;
    box-shadow: var(--shadow);
    z-index: 100;
    gap: 8px;
}

.detail-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
    padding-right: 48px;
}

.detail-content {
    padding: 120px 16px 24px;
    max-width: 800px;
    margin: 0 auto;
}

.question-group {
    margin-bottom: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.question-group-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px 20px;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.question-group-header i {
    font-size: 1.1rem;
}

.question-list {
    padding: 8px;
}

.question-item {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

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

.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    margin-right: 10px;
}

.question-content {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 12px;
    color: var(--text);
}

.question-answer {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
    padding: 12px 16px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
}

.question-answer-label {
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.question-material {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.7;
}

.question-material-label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    font-size: 0.85rem;
}

/* ============================================
   登录/注册
   ============================================ */
.auth-box {
    min-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    max-width: 400px;
    margin: 0 auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-header i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 16px;
}

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-muted);
}

.input-group {
    position: relative;
    margin-bottom: 16px;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.input-group input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--card-bg);
}

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

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

/* ============================================
   用户中心
   ============================================ */
.simple-header {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    padding: 0 8px;
    z-index: 99;
    border-bottom: 1px solid var(--border);
}

.simple-header span {
    font-size: 1.1rem;
    font-weight: 600;
    margin-left: 8px;
}

.profile-container {
    padding: 120px 16px 24px;
    max-width: 600px;
    margin: 0 auto;
}

.profile-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.avatar-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    font-weight: 700;
    margin: 0 auto 16px;
    box-shadow: 0 4px 15px rgba(0, 176, 80, 0.3);
}

.profile-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.api-key-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
    padding: 0 16px;
}

.menu-list {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

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

.menu-item:active {
    background: var(--bg);
}

.menu-item i:first-child {
    width: 32px;
    font-size: 1.2rem;
    color: var(--primary);
}

.menu-item span {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
}

.menu-item i:last-child {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.menu-item.text-danger i:first-child,
.menu-item.text-danger span {
    color: var(--accent);
}

/* ============================================
   后台管理
   ============================================ */
.admin-list {
    padding-top: 60px;
}

.admin-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-item-info h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.admin-item-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.admin-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: var(--radius);
}

.btn-danger {
    background: var(--accent);
}

/* ============================================
   通用组件
   ============================================ */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.loading i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 0.95rem;
    opacity: 0;
    transition: all 0.3s;
    z-index: 9999;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   电脑端适配
   ============================================ */
@media (min-width: 768px) {
    .container {
        max-width: 800px;
        padding: 24px;
    }

    .navbar {
        height: 64px;
        padding: 0 32px;
    }

    .nav-brand {
        font-size: 1.3rem;
    }

    .main-content {
        padding-top: 64px;
    }

    .page-title h1 {
        font-size: 2rem;
    }

    .paper-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .paper-card {
        padding: 24px;
    }

    .paper-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }

    .detail-content {
        padding-top: 80px;
        max-width: 900px;
    }

    .question-group {
        margin-bottom: 24px;
    }

    .auth-box {
        padding: 40px;
    }

    .menu-item:hover {
        background: var(--bg);
    }
}

@media (min-width: 1200px) {
    .paper-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 用户头像小图标 */
.user-avatar-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: white;
    font-weight: 700;
}
