/* ============================================================
   小说系统 - 组件库（弹窗/表单/加载动画/移动端导航）
   ============================================================ */

/* ============================================================
   表单组件
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: #333; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px;
    font-size: 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit; background: #fff; color: #333;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: #e65540; box-shadow: 0 0 0 3px rgba(230,85,64,0.1);
}
.form-input.error, .form-select.error, .form-textarea.error { border-color: #ff4d4f; }
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }
.form-error { font-size: 12px; color: #ff4d4f; margin-top: 4px; }
.form-textarea { resize: vertical; min-height: 80px; }

/* 按钮组件 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 24px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: #e65540; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #d44a35; }
.btn-secondary { background: #ff9900; color: #fff; }
.btn-secondary:hover:not(:disabled) { background: #e68a00; }
.btn-success { background: #52c41a; color: #fff; }
.btn-success:hover:not(:disabled) { background: #49b017; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #e04345; }
.btn-outline { background: transparent; border: 2px solid #e65540; color: #e65540; }
.btn-outline:hover:not(:disabled) { background: #e65540; color: #fff; }
.btn-ghost { background: #f0f0f0; color: #333; }
.btn-ghost:hover:not(:disabled) { background: #e0e0e0; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { padding: 8px; border-radius: 50%; width: 36px; height: 36px; }

/* ============================================================
   弹窗/模态框
   ============================================================ */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 10000;
    align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff; border-radius: 12px; padding: 24px;
    max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; padding: 4px; }
.modal-close:hover { color: #333; }
.modal-body { margin-bottom: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   加载动画
   ============================================================ */
.loading-spinner {
    width: 32px; height: 32px; border: 3px solid #f0f0f0;
    border-top-color: #e65540; border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.loading-spinner-lg { width: 48px; height: 48px; border-width: 4px; }

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

/* 骨架屏 */
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%); background-size: 200% 100%; animation: skeleton 1.5s infinite; border-radius: 4px; }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-image { height: 200px; border-radius: 8px; }

@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   移动端底部导航
   ============================================================ */
.mobile-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; border-top: 1px solid #eee;
    z-index: 9999; padding-bottom: env(safe-area-inset-bottom);
}
.mobile-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 8px 0; text-decoration: none; color: #999; font-size: 11px;
    position: relative; transition: color 0.2s;
}
.mobile-nav-item.active { color: #e65540; }
.mobile-nav-item:hover { color: #e65540; }
.mobile-nav-icon { font-size: 22px; margin-bottom: 2px; }
.mobile-nav-badge {
    position: absolute; top: 2px; right: 50%; margin-left: 10px;
    background: #ff4d4f; color: #fff; font-size: 10px;
    min-width: 16px; height: 16px; line-height: 16px; text-align: center;
    border-radius: 8px; padding: 0 4px;
}

@media (max-width: 768px) {
    .mobile-nav { display: flex; }
    body { padding-bottom: 60px; } /* 为底部导航留出空间 */
}

/* ============================================================
   标签/徽章
   ============================================================ */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.badge-primary { background: #e6f7ff; color: #1890ff; }
.badge-success { background: #f6ffed; color: #52c41a; }
.badge-warning { background: #fff7e6; color: #fa8c16; }
.badge-danger { background: #fff1f0; color: #ff4d4f; }
.badge-gray { background: #f0f0f0; color: #999; }

/* ============================================================
   卡片组件
   ============================================================ */
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; margin: 0; }
.card-footer { border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 16px; }

/* ============================================================
   空状态
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; }
.empty-state-hint { font-size: 13px; color: #bbb; margin-top: 8px; }

/* ============================================================
   分割线
   ============================================================ */
.divider { height: 1px; background: #f0f0f0; margin: 20px 0; }
.divider-text { display: flex; align-items: center; gap: 12px; color: #999; font-size: 13px; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: #f0f0f0; }

/* ============================================================
   暗色模式适配
   ============================================================ */
.dark-mode .form-input, .dark-mode .form-select, .dark-mode .form-textarea {
    background: #0f0f1e; border-color: #333; color: #fff;
}
.dark-mode .form-input:focus, .dark-mode .form-select:focus, .dark-mode .form-textarea:focus {
    border-color: #e65540; box-shadow: 0 0 0 3px rgba(230,85,64,0.2);
}
.dark-mode .modal { background: #1a1a2e; }
.dark-mode .card { background: #1a1a2e; }
.dark-mode .mobile-nav { background: #1a1a2e; border-top-color: #2a2a3e; }
.dark-mode .btn-ghost { background: #2a2a3e; color: #fff; }
.dark-mode .btn-ghost:hover { background: #333; }
.dark-mode .skeleton { background: linear-gradient(90deg, #2a2a3e 25%, #333 50%, #2a2a3e 75%); }
