/* ========================================
   直播辅助工具 - 主样式表
   ======================================== */

/* CSS 变量 - 主题配置 */
:root {
    /* 主色调 (Arco Design Blue) */
    --primary-color: #165DFF;
    --primary-hover: #4080FF;
    --primary-active: #0E42D2;
    --primary-light: rgba(22, 93, 255, 0.1);

    /* 背景色 (Dark Mode) */
    --bg-primary: #17171A;
    /* 极深灰 */
    --bg-secondary: #232324;
    /* 组件背景 */
    --bg-card: #232324;
    /* 卡片背景 */
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(255, 255, 255, 0.08);

    /* 文字颜色 */
    --text-primary: rgba(255, 255, 255, 0.9);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-disabled: rgba(255, 255, 255, 0.3);

    /* 边框 */
    --border-color: rgba(255, 255, 255, 0.08);
    /* 极细边框 */
    --border-radius: 4px;
    /* 标准圆角 */
    --border-radius-sm: 2px;
    /* 小圆角 */
    --border-radius-lg: 8px;
    /* 大圆角 */

    /* 状态颜色 */
    --success-color: #00B42A;
    --warning-color: #FF7D00;
    --error-color: #F53F3F;
    --info-color: #165DFF;

    /* 尺寸 */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --header-height: 60px;

    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.4);

    /* 过渡 */
    --transition-fast: 0.1s cubic-bezier(0, 0, 1, 1);
    --transition-normal: 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
}

/* 全局重置 */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
        'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   布局
   ======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   侧边栏
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition-fast);
}

/* 导航菜单 */
.nav-menu {
    list-style: none;
    padding: 1rem 0;
    overflow-y: auto;
    flex: 1;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0 0.5rem;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 500;
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 0.9375rem;
}

/* 子菜单 */
.nav-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

/* 点击展开子菜单 */
.nav-item.expanded .nav-submenu {
    max-height: 300px;
}

.nav-submenu a {
    display: block;
    padding: 0.5rem 1.25rem 0.5rem 3.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.nav-submenu a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-submenu a.active {
    color: var(--primary-color);
}

/* ========================================
   主内容区
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-header {
    height: var(--header-height);
    padding: 0 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 数据库空间显示 */
.db-usage {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.db-icon {
    font-size: 0.875rem;
}

.db-text {
    white-space: nowrap;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.content-body {
    flex: 1;
    padding: 1.5rem;
}

/* ========================================
   欢迎页面
   ======================================== */
.welcome-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height) - 3rem);
}

.welcome-card {
    text-align: center;
    max-width: 600px;
    padding: 3rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.welcome-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.welcome-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.feature-item:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.feature-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.feature-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   占位内容
   ======================================== */
.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: var(--text-secondary);
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-content h3 {
    margin-bottom: 0.5rem;
}

/* ========================================
   Toast 提示
   ======================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.error {
    border-left-color: var(--error-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   加载状态
   ======================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1rem;
    z-index: 2000;
}

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

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: var(--text-secondary);
}

/* ========================================
   响应式 - 移动端
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .content-header {
        padding: 0 1rem;
    }

    .sidebar-header {
        position: relative;
    }

    .menu-toggle {
        position: absolute;
        right: -50px;
        top: 50%;
        transform: translateY(-50%);
        background: var(--bg-secondary);
        border-radius: var(--border-radius-sm);
        padding: 0.75rem;
    }

    .sidebar.open+.main-content::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 50;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .welcome-card {
        padding: 2rem 1.5rem;
    }
}

/* ========================================
   通用组件样式（供后续功能使用）
   ======================================== */

/* 表单元素 */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-hover);
    /* Arco Dark Input Bg */
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    outline: none;
}

input:hover,
textarea:hover,
select:hover {
    background: var(--bg-active);
}

input:focus,
textarea:focus,
select:focus {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-primary:active {
    background: var(--primary-active);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* 上传区域 */
.upload-zone {
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
    background: var(--bg-hover);
}

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

.upload-zone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* 表格 */
/* 旧数据表格样式已移除，统一使用下方样式 */

.data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.data-table tr:hover {
    background: var(--bg-hover);
}

/* 表单元素 */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: var(--transition-fast);
}

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

/* 进度条 */
.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

/* ========================================
   上传页面样式
   ======================================== */
.upload-page {
    max-width: 800px;
    margin: 0 auto;
}

.upload-page .card {
    margin-bottom: 1.5rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.upload-options {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
}

.upload-mode-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.rules-box {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--primary-color);
}

.rules-box h4 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.rules-box ul {
    list-style: none;
    padding: 0;
}

.rules-box li {
    padding: 0.375rem 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.rules-box li::before {
    content: '•';
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.upload-status {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
}

.status-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.status-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.status-text {
    color: var(--text-primary);
}

.status-detail {
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.status-detail .success {
    color: var(--success-color);
}

.status-detail .error {
    color: var(--error-color);
}

.upload-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

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

/* 响应式调整 */
@media (max-width: 768px) {
    .upload-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .upload-page {
        padding: 0 0.5rem;
    }
}

/* ========================================
   三合一上传页面样式
   ======================================== */
.upload-page-combined {
    padding: 0;
}

.upload-blocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
    /* 使子元素高度一致 */
}

.upload-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.upload-block-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 数据库表名标签 */
.db-table-tag {
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 0.125rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* 可滚动区块 */
.upload-block-scrollable {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.upload-block-scrollable .upload-block-header {
    flex-shrink: 0;
}

.scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    min-height: 0;
    /* 重要：允许 flex 子元素收缩 */
}

/* 全局自定义滚动条样式 - 隐藏式灰色 */
.upload-block::-webkit-scrollbar,
.scrollable-content::-webkit-scrollbar {
    width: 4px;
}

.upload-block::-webkit-scrollbar-track,
.scrollable-content::-webkit-scrollbar-track {
    background: transparent;
}

.upload-block::-webkit-scrollbar-thumb,
.scrollable-content::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.4);
    border-radius: 2px;
}

.upload-block:hover::-webkit-scrollbar-thumb,
.scrollable-content:hover::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.6);
}

.upload-block .upload-zone {
    padding: 2rem 1.5rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-block .upload-zone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.upload-block .upload-zone p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

/* Toggle 分段切换器 */
.toggle-group {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    padding: 4px;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: calc(var(--border-radius-sm) - 2px);
    transition: all var(--transition-fast);
}

.toggle-btn:hover {
    color: var(--text-secondary);
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 上传按钮统一高度 */
.upload-block .btn-upload {
    min-height: 44px;
}

/* 最后上传时间显示 */
.last-upload-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    min-height: 1.25rem;
    line-height: 1.25rem;
}

/* 上传说明区域固定高度，统一按钮位置 */
.upload-info-section {
    flex: 1;
    overflow-y: auto;
    max-height: 280px;
}

/* 折叠面板 */
.rules-details,
.mapping-details {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.rules-details summary,
.mapping-details summary {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    user-select: none;
}

.rules-details summary:hover,
.mapping-details summary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.rules-details ul {
    list-style: none;
    padding: 0.75rem 1rem;
    margin: 0;
}

.rules-details li {
    padding: 0.25rem 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.rules-details li::before {
    content: '•';
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* 映射表格 */
.mapping-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.mapping-table th,
.mapping-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.mapping-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 500;
}

.mapping-table td:nth-child(2) {
    text-align: center;
    color: var(--primary-color);
}

/* 上传按钮 */
.btn-upload {
    width: 100%;
    margin-top: auto;
}

/* 状态显示 */
.upload-block .upload-status {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    margin: 0;
}

.upload-block .status-text {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.upload-block .progress-bar {
    height: 6px;
}

.upload-block .status-detail {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .upload-blocks-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   设置页面样式
   ======================================== */
.settings-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* 三列布局 */
.settings-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1200px) {
    .settings-grid-3 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {

    .settings-page,
    .settings-grid-3 {
        grid-template-columns: 1fr;
    }
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.settings-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.settings-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-hover);
    border-radius: var(--border-radius);
}

/* 设置子区块 */
.settings-subsection {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    padding: 0.875rem;
    margin-bottom: 0.875rem;
}

.settings-subsection h4 {
    margin: 0 0 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-hint-sm {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* 符号设置 */
.symbol-settings {
    display: flex;
    gap: 1rem;
}

.symbol-settings .settings-group {
    flex: 1;
}

.symbol-input {
    max-width: 80px !important;
    text-align: center;
    font-size: 1rem !important;
}

/* 公式排序列表 */
.formula-order-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.formula-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.375rem;
    cursor: grab;
    transition: all var(--transition-fast);
}

.formula-item:hover {
    background: var(--bg-card);
    border-color: var(--primary-color);
}

.formula-item:active {
    cursor: grabbing;
}

.formula-item.dragging {
    opacity: 0.5;
    border-color: var(--primary-color);
}

.drag-handle {
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: grab;
}

.formula-label {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.settings-group {
    margin-bottom: 1rem;
}

.settings-group label {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* 内联编辑字段 */
.inline-edit-field {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.inline-edit-field .settings-input {
    flex: 1;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--border-radius);
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

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

/* 可编辑表格 */
.mapping-table-container {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.editable-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.editable-table th,
.editable-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.editable-table th {
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    position: sticky;
    top: 0;
    background: var(--bg-card);
}

.editable-table tbody tr:hover {
    background: var(--bg-hover);
}

.table-input {
    width: 100%;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    background: var(--bg-hover);
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.table-input:focus {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    outline: none;
}

.actions-cell {
    width: 50px;
    text-align: center;
}

.btn-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.btn-delete:hover {
    opacity: 1;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem;
    font-size: 0.875rem;
}

.save-table-btn {
    margin-top: 1rem;
    width: 100%;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
}

.settings-section h3 {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
}

.settings-section h4 {
    margin: 1.5rem 0 0.75rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.settings-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.settings-group {
    margin-bottom: 1rem;
}

.settings-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.settings-input {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.mapping-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.mapping-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mapping-row input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.mapping-row input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.mapping-row span {
    color: var(--primary-color);
}

.btn-remove {
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--error-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.btn-remove:hover {
    opacity: 0.8;
}

.settings-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.result-content {
    min-height: 100px;
}

.result-summary {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
}

.result-summary p {
    margin: 0.25rem 0;
}

/* 处理说明区块样式 */
.process-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.process-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    padding: 0.875rem 1rem;
}

.process-section h4 {
    margin: 0 0 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.process-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.process-steps li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.6875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.formula-box {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.formula-box code {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    color: var(--primary-color);
}

.formula-example {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.tips-list li {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding-left: 1rem;
    position: relative;
}

.tips-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.tips-list strong {
    color: var(--primary-color);
}

.result-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.75rem 0;
}

.result-title {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* 映射显示样式 */
.mapping-display {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
}

.mapping-line {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-color);
}

.mapping-line:last-child {
    border-bottom: none;
}

.mapping-line .key {
    color: var(--primary-color);
    font-weight: 500;
}

.mapping-line .arrow {
    color: var(--text-muted);
}

.mapping-line .value {
    color: var(--text-secondary);
}

/* 编辑文本框 */
.mapping-textarea {
    width: 100%;
    min-height: 150px;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
}

.mapping-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.hint {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--text-muted);
}

/* 数据表格区域 */
.data-table-section {
    margin-top: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.data-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.header-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.data-table-header h3 {
    margin: 0;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
}

.data-table-container {
    min-height: 100px;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    /* 增加舒适度 */
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

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

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table td {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    /* 垂直居中 */
}

/* 商品缩略图 */
.thumb-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    background: var(--bg-hover);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.product-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-fast);
}

.product-thumb:hover {
    transform: scale(1.1);
}

.no-thumb {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.table-info {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.refresh-time {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.record-count {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--text-muted);
    margin-left: 0.75rem;
    padding: 0.125rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
}

/* ========================================
   排品功能页面样式
   ======================================== */

.ranking-settings-page {
    max-width: 1200px;
    margin: 0 auto;
}

.page-intro {
    margin-bottom: 1.5rem;
}

.page-intro h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.page-intro p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 数据统计 */
.ranking-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-item {
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* 排品结果 */
.result-category {
    margin-bottom: 1rem;
}

.result-category h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border-color);
}

.result-category .count {
    font-weight: normal;
    color: var(--text-muted);
}

.result-items {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    font-size: 0.8125rem;
}

.result-item .sample-number {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 2.5rem;
}

.result-item .product-name {
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 设置页面 */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setting-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.sortable-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sortable-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: background var(--transition-fast);
}

.sortable-item:hover {
    background: var(--bg-hover);
}

.sortable-item .drag-handle {
    color: var(--text-muted);
    cursor: grab;
}

.sortable-item .category-name {
    flex: 1;
    font-size: 0.875rem;
}

.settings-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .ranking-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 分类项操作按钮 */
.sortable-item .category-actions {
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.sortable-item:hover .category-actions {
    opacity: 1;
}

.btn-icon {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

/* 统计区域样式 */
/* 统计区域样式 */
.ranking-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 0;
    margin-bottom: 0;
}

.stats-row {
    display: flex;
    align-items: flex-end;
    /* 底部对齐 */
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-value {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    display: flex;
    align-items: baseline;
    justify-content: center;
    line-height: 1;
}

/* 排品设置左右分栏布局 */
.settings-split-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    height: calc(100vh - 140px);
    /* 适应屏幕高度 */
    min-height: 600px;
}

.settings-split-left {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.settings-split-right {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    overflow-y: auto;
}

.sortable-item.active .category-name-container {
    font-weight: bold;
    color: var(--primary-color);
}

.sortable-item.active {
    border-color: var(--primary-color);
    background-color: var(--bg-secondary);
}

/* 横向统计项样式（排品计算页面） */
.stat-item-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-label-sm {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.stat-value-sm {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* ========================================
   发券品处理页面样式
   ======================================== */
.coupon-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 两列均分布局 */
.coupon-upload-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* 上传说明区块 */
.coupon-info-block {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.coupon-info-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    min-height: 0;
}

/* 滚动条样式 - 与全局一致 */
.coupon-info-content::-webkit-scrollbar {
    width: 4px;
}

.coupon-info-content::-webkit-scrollbar-track {
    background: transparent;
}

.coupon-info-content::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.4);
    border-radius: 2px;
}

.coupon-info-content:hover::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.6);
}

.coupon-info-content .info-section {
    margin-bottom: 1.25rem;
}

.coupon-info-content .info-section:last-child {
    margin-bottom: 0;
}

.coupon-info-content .info-section strong {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.coupon-info-content .info-section ul {
    margin: 0;
    padding: 0 0 0 1.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.coupon-info-content .info-section li {
    margin-bottom: 0.375rem;
}

.coupon-info-content .mapping-table {
    width: 100%;
    font-size: 0.8125rem;
    border-collapse: collapse;
}

.coupon-info-content .mapping-table th,
.coupon-info-content .mapping-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.coupon-info-content .mapping-table th {
    color: var(--text-secondary);
    font-weight: 600;
}

.coupon-info-content .mapping-table td {
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .coupon-upload-row {
        grid-template-columns: 1fr;
    }
}

.coupon-product-list-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
}

.coupon-product-list-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.coupon-product-list-section .section-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.coupon-product-list-section .section-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.match-stats {
    font-size: 0.875rem;
}

.product-table-container {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.product-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.product-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.product-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.product-table tbody tr:hover {
    background: var(--bg-hover);
}

/* 未匹配行高亮 */
.product-table .unmatched-row {
    background: rgba(245, 63, 63, 0.1);
}

.product-table .unmatched-row:hover {
    background: rgba(245, 63, 63, 0.15);
}

/* 图片单元格 */
.product-table .image-cell {
    text-align: center;
}

.product-table .product-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.product-table .no-image {
    display: inline-block;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ID单元格 */
.product-table .id-cell .matched-id {
    font-family: 'SF Mono', Monaco, monospace;
    color: var(--success-color);
}

.product-table .id-cell .id-input {
    width: 120px;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    border: 1px solid var(--error-color);
    background: rgba(245, 63, 63, 0.1);
}

.product-table .id-cell .id-input:focus {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

/* 名称单元格 */
.product-table .name-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 操作单元格 */
.product-table .action-cell {
    text-align: center;
}

.product-table .btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.product-table .btn-delete:hover {
    background: rgba(245, 63, 63, 0.2);
}

/* 响应式 */
@media (max-width: 768px) {
    .coupon-product-list-section .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .coupon-product-list-section .section-actions {
        width: 100%;
        justify-content: space-between;
    }

    .product-table .name-cell {
        max-width: 150px;
    }

    .product-table .id-cell .id-input {
        width: 100px;
    }
}

/* ========================================
   分页组件样式
   ======================================== */
.pagination {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not([disabled]) {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.pagination-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

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

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 0.25rem;
}

/* 已上传数据统计样式 */
.uploaded-stats {
    font-size: 0.875rem;
    color: var(--text-muted);
}