/* ===== CSS 变量定义 ===== */
:root {
    /* 颜色系统 */
    --primary-color: #1a73e8;
    --primary-hover: #1557b0;
    --secondary-color: #00bfa5;
    --success-color: #34a853;
    --warning-color: #fbbc04;
    --danger-color: #ea4335;
    --info-color: #4285f4;

    /* 中性色 */
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-muted: #80868b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f4;
    --border-color: #dadce0;

    /* 毛玻璃效果 */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-blur: 10px;

    /* 阴影系统 */
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3);
    --shadow-md: 0 4px 8px 0 rgba(60, 64, 67, 0.15);
    --shadow-lg: 0 8px 16px 0 rgba(60, 64, 67, 0.15);
    --shadow-xl: 0 16px 24px 0 rgba(60, 64, 67, 0.15);

    /* 布局尺寸 */
    --header-height: 64px;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --content-padding: 24px;

    /* 动画时长 */
    --transition-fast: 150ms;
    --transition-normal: 300ms;
    --transition-slow: 500ms;

    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ===== 全局样式重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    overflow: hidden;
}

/* ===== 毛玻璃效果 ===== */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

/* 降级方案 */
@supports not (backdrop-filter: blur(10px)) {
    .glass-effect {
        background: rgba(255, 255, 255, 0.95);
        box-shadow: var(--shadow-md);
    }
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal) ease;
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* ===== 顶部导航栏 ===== */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--content-padding);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast) ease;
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: var(--shadow-sm);
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-center {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border-radius: 24px;
    padding: 8px 20px;
    transition: all var(--transition-normal) ease;
}

.search-bar:focus-within {
    background: var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1);
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast) ease;
}

.header-btn:hover {
    background: var(--bg-tertiary);
}

.badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    transition: all var(--transition-fast) ease;
}

.user-avatar:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

/* ===== 主体容器 ===== */
#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-container {
    display: flex;
    flex: 1;
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
    position: relative;
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    border-right: 1px solid var(--border-color);
    transition: width var(--transition-normal) ease;
    overflow: hidden;
    position: relative;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-nav {
    padding: 16px 8px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast) ease;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.nav-item i {
    font-size: 20px;
    min-width: 20px;
}

.nav-text {
    transition: opacity var(--transition-normal) ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
}

/* ===== 内容区域 ===== */
.content-area {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary);
    position: relative;
}

.page-container {
    padding: var(--content-padding);
    max-width: 1400px;
    margin: 0 auto;
    animation: pageEnter var(--transition-normal) ease;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* ===== 按钮样式 ===== */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast) ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline-primary:hover {
    background: rgba(26, 115, 232, 0.1);
}

/* ===== 上传区域 ===== */
.upload-section {
    margin-bottom: 32px;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    background: var(--bg-primary);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(26, 115, 232, 0.02);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(26, 115, 232, 0.05);
    transform: scale(1.01);
}

.upload-placeholder i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-placeholder h5 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-placeholder p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-placeholder small {
    color: var(--text-muted);
}

/* ===== 文件预览 ===== */
.file-preview {
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    margin-top: 16px;
}

.preview-content {
    display: flex;
    gap: 20px;
}

.preview-media {
    width: 200px;
    height: 150px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-media video,
.preview-media audio {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-info {
    flex: 1;
}

.preview-info h6 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.preview-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

/* ===== 任务列表 ===== */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-normal) ease;
}

.task-item:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.task-item.processing {
    border-color: var(--primary-color);
    background: rgba(26, 115, 232, 0.02);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.task-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.task-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.task-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.task-status.pending {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.task-status.processing {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary-color);
}

.task-status.completed {
    background: rgba(52, 168, 83, 0.1);
    color: var(--success-color);
}

.task-status.failed {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger-color);
}

.task-progress {
    margin: 12px 0;
}

.progress {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width var(--transition-normal) ease;
    position: relative;
    font-size: 11px;
    line-height: 6px;
    color: white;
    text-align: center;
    white-space: nowrap;
    overflow: visible;
}

.progress-bar.progress-bar-striped {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
}

.progress-bar.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% {
        background-position: 1rem 0;
    }
    100% {
        background-position: 0 0;
    }
}

.task-item.processing {
    border-color: var(--primary-color);
    background: rgba(26, 115, 232, 0.02);
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.4);
    }
    70% {
        box-shadow: 0 0 0 4px rgba(26, 115, 232, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(26, 115, 232, 0);
    }
}

.task-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ===== 通知系统 ===== */
.notification-container {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.notification {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 12px;
    animation: slideIn var(--transition-normal) ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.fade-out {
    animation: fadeOut var(--transition-normal) ease forwards;
}

@keyframes fadeOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.success {
    background: rgba(52, 168, 83, 0.1);
    color: var(--success-color);
}

.notification-icon.error {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger-color);
}

.notification-icon.info {
    background: rgba(66, 133, 244, 0.1);
    color: var(--info-color);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.notification-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast) ease;
}

.notification-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== 全局加载遮罩 ===== */
.global-loading {
    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: 9999;
    backdrop-filter: blur(2px);
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-text {
    margin-top: 16px;
    font-size: 14px;
}

/* ===== 统计卡片 ===== */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-content h3 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.stat-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ===== 服务器状态 ===== */
.server-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.server-name {
    font-weight: 500;
    color: var(--text-primary);
}

.server-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.server-status.online {
    background: rgba(52, 168, 83, 0.1);
    color: var(--success-color);
}

.server-status.offline {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger-color);
}

.server-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-item {
    text-align: center;
}

.stat-item h4 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.stat-item p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== 分页 ===== */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

.pagination {
    display: flex;
    gap: 4px;
}

.page-item {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast) ease;
    background: var(--bg-primary);
}

.page-item:hover {
    background: var(--bg-tertiary);
}

.page-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        z-index: 999;
        box-shadow: var(--shadow-xl);
    }

    .sidebar:not(.collapsed) {
        width: var(--sidebar-width);
    }

    .content-area {
        margin-left: 0;
    }
}

/* ===== 文件上传进度 ===== */
.upload-progress {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.upload-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.upload-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.upload-controls .btn {
    font-size: 12px;
    padding: 4px 12px;
}

/* ===== 任务行样式 ===== */
.task-row {
    transition: all var(--transition-normal) ease;
}

.task-row.processing {
    background: rgba(26, 115, 232, 0.02);
}

.task-row:hover {
    background: var(--bg-tertiary);
}

.task-progress-inline {
    margin-top: 8px;
}

.task-progress-inline .progress {
    height: 4px;
    background: var(--bg-tertiary);
}

.task-progress-inline .progress-bar {
    font-size: 10px;
    line-height: 4px;
}

/* ===== 重运行徽章 ===== */
.rerun-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--warning-color);
    color: white;
    font-size: 11px;
    font-weight: 500;
    border-radius: 10px;
    margin-left: 8px;
}

/* ===== 任务操作按钮 ===== */
.task-actions {
    display: flex;
    gap: 4px;
}

.task-actions .btn {
    padding: 2px 8px;
}

/* ===== 表格响应式 ===== */
@media (max-width: 1200px) {
    .data-table {
        font-size: 13px;
    }

    .task-actions .btn {
        padding: 2px 6px;
        font-size: 12px;
    }
}

/* ===== 工具类 ===== */
.text-muted {
    color: var(--text-muted) !important;
}

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 16px;
}

.mt-4 {
    margin-top: 24px;
}

.mb-3 {
    margin-bottom: 16px;
}

.g-3 {
    gap: 16px;
}

.p-4 {
    padding: 24px;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.user-info {
  display: flex;          /* 启用弹性布局 */
  align-items: center;    /* 垂直居中 */
  gap: 1rem;              /* 元素间距 */
  padding: 1rem;
  background: #f8f9fa;    /* 浅灰背景 */
  border-radius: 8px;
  max-width: 600px;
  margin: 0 auto;
}

.user-avatar-large {
  flex-shrink: 0;
  /* 新增尺寸控制 */
  width: 1em;    /* 继承字体大小 */
  height: 1em;
  display: flex; /* 启用弹性布局 */
  align-items: center;
  justify-content: center;
}

.user-avatar-large .bi {
  font-size: 1rem;
  color: #6c757d;
  transition: transform 0.2s;
  /* 新增垂直对齐修正 */
  position: relative;
  top: 0.1em;         /* 微调图标垂直对齐 */
}

.user-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.user-name {
  font-size: 1.2rem;
  font-weight: 500;
  color: #212529;
  margin: 0;              /* 清除默认边距 */
  line-height: 1.2;
}