/* ============ 基础变量 ============ */
:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #E0E7FF;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --bg: #F9FAFB;
    --card-bg: #FFFFFF;
    --text: #1F2937;
    --text-light: #6B7280;
    --border: #E5E7EB;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============ 布局 ============ */
.container {
    width: 100%;
    max-width: 94%;
    margin: 0 auto;
    padding: 0 clamp(16px, 2vw, 40px);
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 8px;
}

.auth-logo p {
    color: var(--text-light);
    font-size: 14px;
}

/* ============ 表单 ============ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--card-bg);
    color: var(--text);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group .hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ============ 按钮 ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    width: 100%;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    width: auto;
}

/* ============ 导航栏 ============ */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    align-items: center;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.navbar-sponsor {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    margin-left: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.navbar-sponsor:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-light);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

/* ============ 仪表盘 ============ */
.dashboard {
    padding: 32px 0;
}

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

.dashboard-header h2 {
    font-size: 24px;
}

/* ============ 视图切换标签 ============ */
.view-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 12px;
}

.view-tab {
    padding: 8px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.view-tab.active {
    background: var(--primary-light);
    color: var(--primary);
}

.view-tab:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 24px;
    background: var(--card-bg);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-area .upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-area p {
    color: var(--text-light);
    font-size: 14px;
}

.upload-area .upload-limit {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
}

/* ============ 文件列表 ============ */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: all 0.2s;
    gap: 16px;
}

.file-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.file-icon {
    font-size: 32px;
    flex-shrink: 0;
}

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

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-meta {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.badge-shared {
    background: var(--success);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.file-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--primary-light);
}

.btn-icon.btn-danger {
    color: var(--text);
}

.btn-icon.btn-danger:hover {
    background: #FEE2E2;
    color: var(--error);
}

.btn-icon-x {
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
    display: block;
}

/* ============ 空状态 ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ============ 提示框 ============ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #93C5FD;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

/* ============ 模态框 ============ */
.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: 1000;
    padding: 20px;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}

.modal h3 {
    margin-bottom: 16px;
    font-size: 20px;
}

.modal .modal-body {
    margin-bottom: 24px;
}

.modal .modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal .modal-footer .btn {
    width: auto;
    min-width: 100px;
}

/* ============ 确认弹窗 ============ */
.confirm-modal {
    max-width: 400px;
    text-align: center;
}

.confirm-modal h3 {
    margin-bottom: 12px;
}

.confirm-message {
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

.confirm-modal .modal-footer {
    justify-content: center;
    margin-top: 8px;
}

.confirm-modal .modal-footer .btn {
    min-width: 90px;
}

/* ============ 账户管理页面 ============ */
.account-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.account-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.account-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

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

.account-label {
    color: var(--text-light);
    font-size: 14px;
}

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

.account-card .btn {
    margin-top: 8px;
}

.share-link-box {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.share-link-box input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg);
}

/* ============ Toast 通知 ============ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    min-width: 280px;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    background: #D1FAE5;
    color: #065F46;
}

.toast-error {
    background: #FEE2E2;
    color: #991B1B;
}

.toast-info {
    background: #DBEAFE;
    color: #1E40AF;
}

.toast-warning {
    background: #FEF3C7;
    color: #92400E;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* ============ 加载遮罩 ============ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    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-text {
    margin-top: 16px;
    color: var(--text-light);
    font-size: 14px;
}

/* ============ 链接和文本 ============ */
.link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
}

.link:hover {
    text-decoration: underline;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-light);
}

.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ============ 结果页 ============ */
.result-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 48px;
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.result-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.result-card h2 {
    margin-bottom: 12px;
    font-size: 24px;
}

.result-card p {
    color: var(--text-light);
    margin-bottom: 24px;
}

/* ============ 分享页面 ============ */
.share-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.share-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.share-file-icon {
    font-size: 72px;
    margin-bottom: 16px;
}

.share-file-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    word-break: break-all;
}

.share-file-meta {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ============ 设置页面 ============ */
.setup-step {
    margin-bottom: 24px;
}

.setup-step h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--primary);
}

.code-block {
    background: #1F2937;
    color: #E5E7EB;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    margin: 8px 0;
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .dashboard {
        padding: 24px 0;
    }

    .view-tabs {
        flex-wrap: wrap;
    }

    .file-card {
        flex-wrap: wrap;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .share-link-box {
        flex-wrap: wrap;
    }

    .share-link-box input {
        min-width: 100%;
    }

    .toast {
        max-width: calc(100vw - 40px);
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .auth-card {
        padding: 24px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .navbar-right {
        gap: 8px;
    }

    .user-info span {
        display: none;
    }

    .navbar-sponsor {
        display: none;
    }

    .modal {
        padding: 24px;
    }

    .result-card,
    .share-card {
        padding: 32px 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .navbar .container {
        flex-wrap: wrap;
        gap: 8px;
    }

    .file-icon {
        font-size: 26px;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    .file-meta {
        gap: 4px;
    }

    .view-tab {
        padding: 6px 12px;
        font-size: 13px;
    }

    .dashboard-header h2 {
        font-size: 20px;
    }
}
