/**
 * 助力码互助平台 - 样式文件
 * 橙红色主题，移动端适配
 */

/* ========== 变量定义 ========== */
:root {
    --primary-color: #FF6000;
    --primary-dark: #E65500;
    --secondary-color: #FF8C00;
    --bg-color: #FFF7F0;
    --card-bg: #FFFFFF;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #FFE4D0;
    --success-color: #52c41a;
    --danger-color: #FF4D4F;
    --shadow: 0 2px 12px rgba(255, 96, 0, 0.1);
}

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    border: none;
    outline: none;
}

/* ========== 通用布局 ========== */
.app {
    min-height: 100vh;
    padding-bottom: 70px;
}

/* ========== 顶部导航 ========== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 680px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
}

.my-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
}

/* ========== 统计数据栏 ========== */
.stats-bar {
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 20px 15px;
    margin: 12px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 656px;
    margin-left: auto;
    margin-right: auto;
}

.stat-item {
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 22px;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border-color);
}

/* ========== 提交区域 ========== */
.submit-section {
    background: #fff;
    margin: 12px;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 656px;
    margin-left: auto;
    margin-right: auto;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.title-icon {
    font-size: 20px;
}

.submit-form {
    display: flex;
    gap: 10px;
}

.btn-ocr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    background: #f0f0f0;
    color: var(--text-primary);
    padding: 0 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    border: 2px solid var(--border-color);
}

.btn-ocr:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.input-group {
    flex: 1;
}

.code-input {
    width: 100%;
    height: 48px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0 16px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    text-align: center;
    transition: border-color 0.3s;
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    padding: 0 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-submit:hover {
    box-shadow: 0 4px 15px rgba(255, 96, 0, 0.4);
}

.btn-submit:active {
    transform: scale(0.98);
}

.submit-tip {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 12px;
}

/* ========== OCR 图片识别 ========== */
.ocr-result-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px 14px;
    background: #fff7f0;
    border-radius: 8px;
}

.ocr-result-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ocr-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.ocr-number {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--primary-color);
}

.ocr-use-btn {
    background: var(--primary-color);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.ocr-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.ocr-spinner {
    font-size: 16px;
    animation: rotate 1s linear infinite;
}

/* ========== 筛选标签 ========== */
.filter-section {
    max-width: 656px;
    margin: 0 auto;
    padding: 0 12px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    background: #fff;
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.filter-tab {
    flex: 1;
    height: 40px;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
}

.filter-tab.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
}

/* ========== 助力码列表 ========== */
.codes-section {
    max-width: 656px;
    margin: 12px auto;
    padding: 0 12px;
}

.codes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.code-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-info {
    flex: 1;
}

.code-number {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 3px;
    color: var(--text-primary);
}

.code-meta {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.status-available {
    background: #e6f7e6;
    color: var(--success-color);
}

.status-used {
    background: #fff1f0;
    color: var(--danger-color);
}

.code-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-copy {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-copy:hover {
    transform: scale(1.05);
}

.btn-copy:active {
    transform: scale(0.98);
}

.btn-mark {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-mark:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ========== 加载状态 ========== */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.loading-icon {
    display: block;
    font-size: 24px;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========== 加载更多 ========== */
.load-more {
    text-align: center;
    padding: 20px;
}

.btn-load-more {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 12px 40px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-load-more:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ========== 底部快捷操作 ========== */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 10px 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.bottom-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.3s;
}

.bottom-btn:hover,
.bottom-btn:active {
    color: var(--primary-color);
}

.btn-icon {
    font-size: 20px;
}

.admin-link {
    color: var(--text-secondary);
}

/* ========== 弹窗 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 90%;
    max-width: 340px;
}

.modal-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 18px;
    line-height: 28px;
    text-align: center;
    color: #999;
    cursor: pointer;
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
    margin-top: 8px;
}

.modal-icon {
    font-size: 40px;
}

.modal-header.success .modal-icon {
    color: var(--success-color);
}

/* ========== 公众号弹窗 ========== */
.gzh-desc {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.qrcode-placeholder {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.qrcode-box {
    width: 180px;
    height: 180px;
    background: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode-text {
    color: #999;
    font-size: 14px;
}

.gzh-tip {
    text-align: center;
    font-size: 12px;
    color: #999;
}

/* ========== 复制成功弹窗 ========== */
.copy-code {
    font-family: 'Courier New', monospace;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 4px;
    text-align: center;
    color: var(--primary-color);
    margin: 16px 0;
}

.copy-tip {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.btn-primary {
    display: block;
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ========== 分享海报 ========== */
.poster-canvas {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: block;
    border-radius: 8px;
}

.share-tip {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 12px;
}

/* ========== 我的记录页面 ========== */
.back-btn {
    font-size: 20px;
    color: #fff;
}

.header-title {
    font-size: 18px;
    color: #fff;
}

.header-right {
    width: 40px;
}

.records-section {
    max-width: 656px;
    margin: 0 auto;
    padding: 12px;
}

.record-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.record-code {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
}

.record-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.record-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== 空状态 ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 14px;
}

/* ========== 响应式适配 ========== */
@media (max-width: 375px) {
    .submit-form {
        flex-direction: column;
    }
    
    .btn-submit {
        width: 100%;
    }
    
    .stats-bar {
        padding: 15px 10px;
    }
    
    .stat-num {
        font-size: 18px;
    }
}

/* ========== 动画 ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.code-card {
    animation: fadeIn 0.3s ease-out;
}

/* ========== Toast提示 ========== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}
