/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 15px rgba(0,0,0,0.1);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

/* ==================== 头部 ==================== */
.header {
    background: white;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    text-align: center;
}

/* ==================== 标签页 ==================== */
.tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 20px;
}

.tab-btn {
    flex: 1;
    padding: 14px 0;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    position: relative;
    cursor: pointer;
    transition: color 0.2s;
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* ==================== 表单 ==================== */
.form-section {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-of-type {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 16px;
    background: white;
    color: var(--gray-900);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

textarea.form-input {
    resize: none;
    min-height: 80px;
}

/* ==================== 文件上传 ==================== */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    background: var(--gray-50);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.upload-area:active {
    background: var(--gray-100);
}

.upload-area input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    background: var(--gray-200);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.upload-text {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 12px;
    color: var(--gray-400);
}

/* 已选文件 */
.file-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #EEF2FF;
    border-radius: var(--radius);
    border: 1px solid #C7D2FE;
}

.file-icon {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.file-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
}

.file-remove:active {
    background: var(--gray-200);
}

/* ==================== 按钮 ==================== */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
}

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

.btn-primary:active {
    background: #4338CA;
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

/* ==================== 进度条 ==================== */
.progress-section {
    margin-top: 20px;
    display: none;
}

.progress-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
    border-radius: 3px;
}

.progress-text {
    font-size: 13px;
    color: var(--gray-500);
    text-align: center;
    margin-top: 10px;
}

/* ==================== 上传结果 ==================== */
.result-card {
    margin-top: 20px;
    padding: 24px;
    background: white;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.result-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: #ECFDF5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.result-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.result-qr {
    display: inline-block;
    padding: 12px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    margin-bottom: 16px;
}

.result-qr img {
    display: block;
    width: 160px;
    height: 160px;
}

.result-link {
    font-size: 12px;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 10px 12px;
    border-radius: 8px;
    word-break: break-all;
    margin-bottom: 16px;
}

.btn-copy {
    display: inline-block;
    padding: 10px 24px;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
}

.result-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: #FEF2F2;
    border-radius: 10px;
    color: var(--danger);
    font-size: 14px;
    margin-top: 20px;
}

/* ==================== 应用列表 ==================== */
.app-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-content {
    flex: 1;
    min-width: 0;
}

.app-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.app-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.app-badge.ios {
    background: #DBEAFE;
    color: #1D4ED8;
}

.app-badge.android {
    background: #D1FAE5;
    color: #047857;
}

.app-action {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    background: var(--gray-100);
    color: var(--gray-700);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 14px;
}

/* ==================== 下载页面 ==================== */
.download-page {
    min-height: 100vh;
    background: white;
}

.download-header {
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    padding: 40px 20px;
    text-align: center;
}

.download-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    overflow: hidden;
}

.download-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.download-title {
    font-size: 22px;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
}

.download-version {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
}

.download-body {
    padding: 20px;
    margin-top: -20px;
}

.info-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--gray-500);
}

.info-value {
    color: var(--gray-900);
    font-weight: 500;
}

.install-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 20px;
    padding: 16px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.install-btn:active {
    transform: scale(0.98);
}

/* 安装提示 */
.tips-card {
    margin: 0 20px 20px;
    padding: 16px;
    background: #FFFBEB;
    border-radius: var(--radius);
    border: 1px solid #FDE68A;
}

.tips-title {
    font-size: 13px;
    font-weight: 600;
    color: #92400E;
    margin-bottom: 10px;
}

.tips-list {
    font-size: 13px;
    color: #78350F;
    padding-left: 18px;
    margin: 0;
}

.tips-list li {
    margin-bottom: 6px;
    line-height: 1.5;
}

.tips-warning {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #FDE68A;
    font-size: 12px;
    color: #B45309;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 二维码 */
.qr-section {
    text-align: center;
    padding: 24px 20px;
    margin: 0 20px 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.qr-title {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.qr-code {
    display: inline-block;
    padding: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.qr-code img {
    display: block;
    width: 140px;
    height: 140px;
}

/* ==================== 密码页面 ==================== */
.password-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.password-card {
    width: 100%;
    max-width: 320px;
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
}

.password-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.password-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.password-desc {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 24px;
}

.password-error {
    background: #FEF2F2;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

/* ==================== 加载状态 ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--gray-400);
    gap: 10px;
}

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

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

/* ==================== 底部 ==================== */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: var(--gray-400);
}
/* ==================== 应用列表补充样式 ==================== */
.app-card {
    transition: all 0.3s ease;
}

.app-bundle {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
    word-break: break-all;
}

.app-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.app-btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.app-btn.view {
    background: var(--primary);
    color: white;
}

.app-btn.view:active {
    background: #4338CA;
}

.app-btn.delete {
    background: var(--gray-100);
    color: var(--danger);
}

.app-btn.delete:active {
    background: #FEE2E2;
}

/* 列表项动画 */
.app-card {
    animation: slideIn 0.3s ease;
}

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