/*--全局样式--*/
/*--登录页、文件列表页、弹窗、按钮等通用组件样式--*/

:root {
    --primary: #4A6CF7;
    --primary-hover: #3B5DE7;
    --primary-light: #EEF2FF;
    --success: #10B981;
    --success-hover: #059669;
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --warning: #F59E0B;
    --bg: #F0F2F5;
    --card: #FFFFFF;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --border: #E5E7EB;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --radius: 12px;
    --radius-sm: 8px;
}

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

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;
}

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

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

.login-card h1 {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

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

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

.form-group input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

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

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

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

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-lg {
    height: 48px;
    font-size: 16px;
    width: 100%;
}

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

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

/* ========== 顶部导航栏 ========== */
.navbar {
    height: 60px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

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

.navbar .user-info .nickname {
    font-weight: 500;
    color: var(--text);
}

/* ========== 文件列表容器 ========== */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.toolbar .spacer {
    flex: 1;
}

/* ========== 文件列表表格 ========== */
.file-table {
    width: 100%;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.file-table table {
    width: 100%;
    border-collapse: collapse;
}

.file-table th,
.file-table td {
    text-align: left;
    padding: 14px 20px;
    font-size: 14px;
}

.file-table th {
    background: #F9FAFB;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.file-table td {
    border-bottom: 1px solid #F3F4F6;
    color: var(--text);
}

.file-table tr:last-child td {
    border-bottom: none;
}

.file-table tr:hover td {
    background: #FAFBFF;
}

.file-table .file-name {
    font-weight: 500;
    color: var(--primary);
    cursor: pointer;
}
.file-table .file-name:hover {
    text-decoration: underline;
}

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

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

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

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

/* ========== 弹窗 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    width: 100%;
    max-width: 440px;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ========== 提示消息 ========== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease;
    transition: opacity 0.3s;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--primary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ========== 加载动画 ========== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ========== 编辑器页面 ========== */
.editor-navbar {
    height: 50px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1000;
}

.editor-navbar .file-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-navbar .divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

#luckysheet-container {
    width: 100%;
    height: calc(100vh - 50px);
}

/* ========== 文件类型按钮 ========== */
.type-btn {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    background: var(--white);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.type-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.type-btn.active {
    border-color: var(--primary);
    background: #EEF2FF;
    color: var(--primary);
}

/* ========== 分组标签 ========== */
.group-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 22px;
    border-radius: 8px;
    border: 2px solid #D1D5DB;
    background: var(--white);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}
.group-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #F5F3FF;
}
.group-tag.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}
.group-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: #EEF2FF;
    color: #4F46E5;
    font-size: 12px;
    font-weight: 500;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .login-card { padding: 32px 24px; }
    .container { padding: 16px 12px; }
    .file-table th, .file-table td { padding: 10px 12px; }
    .toolbar { gap: 8px; }
    .navbar { padding: 0 12px; }
}
