
/* ========== 全局样式 ========== */
:root {
    --primary: #ff5000;
    --primary-dark: #e64500;
    --primary-light: #ff7a26;
    --success: #52c41a;
    --success-bg: #f6ffed;
    --success-border: #b7eb8f;
    --error: #ff4d4f;
    --error-bg: #fff2f0;
    --error-border: #ffccc7;
    --text-primary: #262626;
    --text-secondary: #8c8c8c;
    --text-tertiary: #bfbfbf;
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f5f5f5;
    --border: #e8e8e8;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #fff5f0 0%, #ffe8e0 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== 顶部导航 ========== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 16px;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.header-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

.stat-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
}

/* ========== 主内容 ========== */
.main {
    padding: 24px 0 40px;
}

/* ========== 信息卡片 ========== */
.info-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.info-details {
    cursor: pointer;
}

.info-details summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none;
    user-select: none;
}

.info-details summary::-webkit-details-marker {
    display: none;
}

.info-icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.info-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.info-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-list li {
    font-size: 13px;
    color: var(--text-secondary);
    padding-left: 16px;
    position: relative;
}

.info-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* ========== 提交卡片 ========== */
.submit-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.submit-form {
    display: flex;
    gap: 12px;
    position: relative;
}

.code-input {
    flex: 1;
    height: 44px;
    padding: 0 14px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.code-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 80, 0, 0.1);
}

.code-input.error {
    border-color: var(--error);
}

.code-input.success {
    border-color: var(--success);
}

.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.input-hint {
    font-size: 11px;
    margin-top: 6px;
    min-height: 0;
    transition: var(--transition);
}

.input-hint.error {
    color: var(--error);
}

.input-hint.success {
    color: var(--success);
}

.submit-btn {
    height: 44px;
    padding: 0 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(255, 80, 0, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 80, 0, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

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

/* ========== 列表卡片 ========== */
.list-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.list-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.list-filter {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 5px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    background: var(--bg-tertiary);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.list-content {
    display: grid;
    gap: 12px;
}

/* ========== 列表项 ========== */
.code-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    border: 2px solid transparent;
}

.code-item.available {
    background: var(--success-bg);
    border-color: var(--success-border);
}

.code-item.used {
    background: var(--bg-secondary);
    border-color: var(--border);
    opacity: 0.7;
}

.code-item:hover {
    transform: translateX(4px);
}

.code-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    text-align: center;
}

.code-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.used-badge {
    padding: 4px 10px;
    background: var(--text-tertiary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
}

.help-btn {
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(255, 80, 0, 0.3);
    white-space: nowrap;
}

.help-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 80, 0, 0.4);
}

.help-btn:active {
    transform: translateY(0);
}

/* ========== 加载状态 ========== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-state p {
    margin-top: 16px;
    font-size: 14px;
}

/* ========== 空状态 ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
}

/* ========== 加载更多 ========== */
.load-more {
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 24px;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-md);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 90%;
    word-break: break-word;
}

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

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .header .container {
        padding: 16px 20px 12px;
    }
    
    .logo-text {
        font-size: 18px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .main {
        padding: 20px 0 32px;
    }
    
    .submit-card,
    .list-card,
    .info-card {
        padding: 16px;
    }
    
    .submit-form {
        flex-direction: row;
    }
    
    .code-input {
        flex: 1;
        min-width: 0;
    }
    
    .submit-btn {
        width: auto;
        flex-shrink: 0;
    }
    
    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .filter-btn {
        font-size: 12px;
        padding: 4px 12px;
    }
}

/* ========== 复制弹窗 ========== */
.modal-overlay {
    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: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 20px;
    text-align: center;
}

.modal-subtitle {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.modal-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.modal-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.step-num {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-text {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.modal-code {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 4px;
    font-family: 'Courier New', monospace;
    padding: 16px;
    background: #fff5f0;
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.modal-copied {
    font-size: 13px;
    color: var(--success);
    font-weight: 600;
}
