/* ============================================
 * AI视频解说大师 - 主样式表 app.css
 * 蓝白科技风 + 深色模式
 * Bootstrap 5 之上的自定义样式
 * ============================================ */

:root {
  --app-primary: #1e6fff;
  --app-primary-dark: #0a58e6;
  --app-primary-light: #e8f0ff;
  --app-secondary: #475569;
  --app-success: #10b981;
  --app-danger: #ef4444;
  --app-warning: #f59e0b;
  --app-info: #06b6d4;
  --app-bg: #f5f7fb;
  --app-surface: #ffffff;
  --app-border: #e2e8f0;
  --app-text: #0f172a;
  --app-text-muted: #64748b;
  --app-sidebar-bg: #0f172a;
  --app-sidebar-text: #cbd5e1;
  --app-sidebar-hover: #1e293b;
  --app-sidebar-active: var(--app-primary);
  --app-header-bg: #ffffff;
  --app-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  --app-shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.1);
  --app-radius: 10px;
  --app-radius-lg: 14px;
}

/* 深色模式变量覆盖 */
[data-theme="dark"] {
  --app-primary: #3b82f6;
  --app-primary-dark: #2563eb;
  --app-primary-light: rgba(59,130,246,0.15);
  --app-bg: #0b1220;
  --app-surface: #111827;
  --app-border: #1f2937;
  --app-text: #e5e7eb;
  --app-text-muted: #9ca3af;
  --app-sidebar-bg: #060b16;
  --app-sidebar-text: #9ca3af;
  --app-sidebar-hover: #111827;
  --app-header-bg: #111827;
  --app-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --app-shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
}

/* ---------- 全局 ---------- */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--app-bg);
  color: var(--app-text);
  -webkit-font-smoothing: antialiased;
}
body { overflow-x: hidden; }
a { color: var(--app-primary); text-decoration: none; }
a:hover { color: var(--app-primary-dark); }

.btn-primary {
  background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-primary-dark) 100%);
  border-color: transparent !important;
  box-shadow: 0 4px 12px rgba(30, 111, 255, 0.25);
  transition: all .25s;
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(30,111,255,0.35); }

[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .offcanvas {
  background: var(--app-surface);
  color: var(--app-text);
  border-color: var(--app-border);
}
[data-theme="dark"] .text-muted { color: var(--app-text-muted) !important; }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: #0b1220;
  border-color: var(--app-border);
  color: var(--app-text);
}
[data-theme="dark"] .table { --bs-table-color: var(--app-text); color: var(--app-text); }
[data-theme="dark"] .table th { background: #0b1220; border-color: var(--app-border); }
[data-theme="dark"] .table td { border-color: var(--app-border); }
[data-theme="dark"] .alert { color: inherit; }

/* ---------- 应用布局 ---------- */
.app-wrap { display: flex; min-height: 100vh; }

/* 侧栏 */
.app-sidebar {
  width: 240px;
  background: var(--app-sidebar-bg);
  color: var(--app-sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width .25s;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.app-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  letter-spacing: .5px;
}
.app-sidebar .brand .logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e6fff, #06b6d4);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 900; font-size: 18px;
  box-shadow: 0 4px 12px rgba(30,111,255,.4);
}
.app-sidebar .menu { padding: 10px 0; flex: 1; }
.app-sidebar .menu .menu-title {
  padding: 10px 22px 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.app-sidebar .menu a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 22px;
  color: var(--app-sidebar-text);
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all .2s;
  position: relative;
}
.app-sidebar .menu a i { font-size: 18px; width: 20px; text-align: center; }
.app-sidebar .menu a:hover { background: var(--app-sidebar-hover); color: #fff; }
.app-sidebar .menu a.active {
  background: linear-gradient(90deg, rgba(30,111,255,0.2), transparent);
  color: #fff;
  border-left-color: var(--app-sidebar-active);
}
.app-sidebar .menu a .badge {
  margin-left: auto;
  background: var(--app-primary);
  color: #fff;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 10px;
}

/* 主内容区 */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-header {
  background: var(--app-header-bg);
  border-bottom: 1px solid var(--app-border);
  height: 60px;
  display: flex; align-items: center;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 50;
  gap: 14px;
}
.app-header .menu-toggle {
  border: 0; background: transparent; color: var(--app-text);
  font-size: 20px; cursor: pointer;
}
.app-header .breadcrumb { margin: 0; font-size: 13px; }
.app-header .breadcrumb-item + .breadcrumb-item::before { color: var(--app-text-muted); }
.app-header .spacer { flex: 1; }
.app-header .header-actions { display: flex; align-items: center; gap: 10px; }
.app-header .header-actions .icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--app-text-muted);
  cursor: pointer; transition: all .2s; position: relative; border: 0;
}
.app-header .header-actions .icon-btn:hover { background: var(--app-bg); color: var(--app-text); }
.app-header .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg,#1e6fff,#06b6d4);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; overflow: hidden;
}

.app-content { flex: 1; padding: 22px; max-width: 1800px; width: 100%; }
.app-content .page-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.app-content .page-title small { font-size: 13px; color: var(--app-text-muted); font-weight: 400; margin-left: 8px; }

/* 卡片 */
.card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
  margin-bottom: 18px;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--app-border);
  padding: 14px 18px;
  font-weight: 600;
  border-radius: var(--app-radius-lg) var(--app-radius-lg) 0 0 !important;
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 18px; }

/* 统计卡 */
.stat-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  padding: 18px;
  display: flex; gap: 14px; align-items: center;
  transition: all .25s;
  box-shadow: var(--app-shadow);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--app-shadow-lg); }
.stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-icon.primary { background: rgba(30,111,255,0.1); color: #1e6fff; }
.stat-icon.success { background: rgba(16,185,129,0.1); color: #10b981; }
.stat-icon.warning { background: rgba(245,158,11,0.1); color: #f59e0b; }
.stat-icon.danger  { background: rgba(239,68,68,0.1);  color: #ef4444; }
.stat-icon.info    { background: rgba(6,182,212,0.1);   color: #06b6d4; }
.stat-card .stat-info { flex: 1; }
.stat-card .stat-num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-card .stat-label { font-size: 12px; color: var(--app-text-muted); margin-top: 4px; }

/* 表格 */
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--app-text-muted); font-weight: 600; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--app-bg); }
.table .btn-table { padding: 2px 8px; font-size: 12px; }

/* 状态标签 */
.badge-status { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-status.pending   { background: rgba(148,163,184,0.15); color: #64748b; }
.badge-status.waiting   { background: rgba(245,158,11,0.15); color: #d97706; }
.badge-status.processing{ background: rgba(59,130,246,0.15); color: #2563eb; }
.badge-status.paused    { background: rgba(139,92,246,0.15); color: #7c3aed; }
.badge-status.completed { background: rgba(16,185,129,0.15); color: #059669; }
.badge-status.failed    { background: rgba(239,68,68,0.15);  color: #dc2626; }
.badge-status.cancelled { background: rgba(100,116,139,0.15); color: #475569; }

/* 进度条 */
.progress { height: 8px; border-radius: 10px; background: rgba(148,163,184,0.2); overflow: hidden; }
.progress-bar {
  background: linear-gradient(90deg, #1e6fff, #06b6d4);
  border-radius: 10px;
  transition: width .4s ease;
}

/* 骨架屏 */
.skeleton { display: inline-block; position: relative; overflow: hidden; background: var(--app-border); border-radius: 6px; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: shimmer 1.4s infinite;
}
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* Toast */
.app-toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; min-width: 280px; max-width: 420px;
}
.app-toast {
  padding: 12px 16px; border-radius: 10px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow-lg);
  border: 1px solid var(--app-border);
  display: flex; gap: 10px; align-items: flex-start;
  animation: slide-in .28s ease;
  color: var(--app-text);
}
.app-toast .toast-icon { font-size: 18px; line-height: 1.2; }
.app-toast.success { border-left: 4px solid var(--app-success); } .app-toast.success .toast-icon { color: var(--app-success); }
.app-toast.error   { border-left: 4px solid var(--app-danger);  } .app-toast.error   .toast-icon { color: var(--app-danger); }
.app-toast.warning { border-left: 4px solid var(--app-warning); } .app-toast.warning .toast-icon { color: var(--app-warning); }
.app-toast.info    { border-left: 4px solid var(--app-info);    } .app-toast.info    .toast-icon { color: var(--app-info); }
@keyframes slide-in { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Loading 遮罩 */
.app-loading-mask {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(15, 23, 42, 0.35);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.app-spinner {
  width: 48px; height: 48px; border: 4px solid rgba(255,255,255,0.3);
  border-top-color: var(--app-primary); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 页内小loading */
.loading-sm { display: inline-block; width: 14px; height: 14px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.btn .loading-sm { margin-right: 6px; }

/* 分页 */
.pagination .page-link {
  background: var(--app-surface); color: var(--app-text);
  border-color: var(--app-border);
}
.pagination .page-link:hover { background: var(--app-bg); }
.pagination .page-item.active .page-link {
  background: var(--app-primary); border-color: var(--app-primary);
}

/* ---------- 登录布局 ---------- */
.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(30,111,255,.18), transparent 60%),
    radial-gradient(900px 500px at 110% 120%, rgba(6,182,212,.18), transparent 60%),
    linear-gradient(135deg, #f0f5ff 0%, #ffffff 100%);
  display: flex; align-items: center; justify-content: center; padding: 30px;
}
[data-theme="dark"] .auth-page {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(30,111,255,.25), transparent 60%),
    radial-gradient(900px 500px at 110% 120%, rgba(6,182,212,.22), transparent 60%),
    #0b1220;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 20px;
  padding: 36px 34px;
  box-shadow: var(--app-shadow-lg);
}
.auth-card .auth-logo { text-align: center; margin-bottom: 20px; }
.auth-card .auth-logo .logo {
  width: 60px; height: 60px; margin: 0 auto 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1e6fff, #06b6d4);
  color: #fff; font-weight: 900; font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(30,111,255,.35);
}
.auth-card .auth-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.auth-card .auth-subtitle { color: var(--app-text-muted); font-size: 13px; margin: 0 0 24px; }

.auth-card .form-label { font-size: 13px; font-weight: 600; }
.auth-card .form-control, .auth-card .form-select {
  padding: 11px 14px;
  border-radius: 10px;
  border-color: var(--app-border);
}
.auth-card .form-control:focus, .auth-card .form-select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(30,111,255,.15);
}
.auth-card .btn-primary { padding: 11px; border-radius: 10px; font-weight: 600; }
.auth-card .form-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; margin-top: 14px;
}
.auth-card .divider {
  position: relative; text-align: center; margin: 18px 0 10px;
  color: var(--app-text-muted); font-size: 12px;
}
.auth-card .divider::before, .auth-card .divider::after {
  content: ''; position: absolute; top: 50%; width: 38%; height: 1px;
  background: var(--app-border);
}
.auth-card .divider::before { left: 0; }
.auth-card .divider::after  { right: 0; }

/* ---------- 上传区域 ---------- */
.upload-dropzone {
  border: 2px dashed var(--app-border);
  border-radius: var(--app-radius-lg);
  padding: 60px 20px;
  text-align: center;
  transition: all .25s;
  cursor: pointer;
  background: var(--app-surface);
}
.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--app-primary);
  background: var(--app-primary-light);
}
.upload-dropzone .dz-icon {
  width: 72px; height: 72px; margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--app-primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--app-primary); font-size: 32px;
}
.upload-dropzone .dz-title { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.upload-dropzone .dz-hint  { color: var(--app-text-muted); font-size: 13px; margin: 0 0 18px; }

/* ---------- 响应式 ---------- */
@media (max-width: 992px) {
  .app-sidebar { width: 76px; }
  .app-sidebar .brand span, .app-sidebar .menu a span, .app-sidebar .menu-title { display: none; }
  .app-sidebar .menu a { justify-content: center; padding: 12px 0; border-left-width: 0; border-top: 3px solid transparent; }
  .app-sidebar .menu a.active { border-top-color: var(--app-sidebar-active); border-left-color: transparent; }
}
@media (max-width: 768px) {
  .app-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 80;
    transform: translateX(-100%);
    box-shadow: var(--app-shadow-lg);
    width: 240px;
  }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 70;
  }
  .app-sidebar .brand span, .app-sidebar .menu a span, .app-sidebar .menu-title { display: inline; }
  .app-sidebar .menu a { justify-content: flex-start; padding: 10px 22px; border-left: 3px solid transparent; border-top: 0; }
  .app-sidebar .menu a.active { border-left-color: var(--app-sidebar-active); border-top-color: transparent; }
  .app-content { padding: 14px; }
  .app-header { padding: 0 14px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,.4); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.6); }
::-webkit-scrollbar-track { background: transparent; }
