/* ==========================================
   StockX 系统 - 设计系统样式表
   复刻CRM界面风格
   ========================================== */

:root {
    /* 主色调 */
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;

    /* 中性色 - 匹配CRM截图 */
    --bg-primary: #ffffff;
    /* 纯白 - 主内容区背景 */
    --bg-secondary: #f7f8fa;
    /* 浅灰 - 左侧边栏背景 */
    --bg-tertiary: #f3f4f6;
    /* 表格头部背景 */
    --bg-hover: #f5f5ff;
    /* 悬停背景 */

    /* 文字颜色 */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-link: #6366f1;

    /* 边框 - 更淡的颜色 */
    --border-color: #e5e7eb;
    --border-color-light: #f0f1f3;
    /* 更淡的边框 */
    --border-radius: 6px;
    --border-radius-lg: 8px;

    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* 标签颜色 */
    --tag-b2c-bg: #d1fae5;
    --tag-b2c-text: #065f46;
    --tag-b2b-bg: #fef3c7;
    --tag-b2b-text: #92400e;
    --tag-saas-bg: #dbeafe;
    --tag-saas-text: #1e40af;
    --tag-enterprise-bg: #e9d5ff;
    --tag-enterprise-text: #6b21a8;
    --tag-finance-bg: #fce7f3;
    --tag-finance-text: #9f1239;
    --tag-tech-bg: #ccfbf1;
    --tag-tech-text: #115e59;
    --tag-media-bg: #fed7aa;
    --tag-media-text: #9a3412;
    --tag-internet-bg: #bfdbfe;
    --tag-internet-text: #1e40af;

    /* 操作按钮颜色 */
    --action-buy: #10b981;
    --action-hold: #f59e0b;
    --action-sell: #ef4444;

    /* 尺寸 */
    --sidebar-width: 220px;
    --header-height: 64px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
}

/* ==================== 全局样式 ==================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    /* 改为白色 */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== 布局 ==================== */

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    /* 灰色背景 */
    border-right: 1px solid var(--border-color-light);
    /* 更淡的边框 */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.sidebar-nav {
    padding: 16px 8px;
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    padding: 0 12px;
    margin-bottom: 8px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

.nav-item.active {
    background-color: var(--bg-hover);
    color: var(--primary-color);
    font-weight: 500;
}

.nav-item-icon {
    margin-right: 12px;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部栏 */
.top-bar {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color-light);
    /* 更淡的边框 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title h1 {
    font-size: 20px;
    font-weight: 600;
}

.page-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.top-bar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 内容区域 */
.content-area {
    flex: 1;
    padding: 12px 24px;
    /* 减小顶部padding */
    overflow-y: auto;
    background: var(--bg-primary);
    /* 白色背景 */
}

.content-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: none;
    /* 移除阴影 */
    border: none;
    /* 移除边框 */
}

/* ==================== 工具栏 ==================== */

/* ==================== 新版工具栏样式 ==================== */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.toolbar-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px 12px 4px;
    /* 左侧减小以对齐 */
    border-bottom: none;
}

/* 全选/统计控件 */
.selection-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.master-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 10px;
    /* 左侧微调 */
    background: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.master-selector:hover {
    background: #e5e7eb;
}

.count-text {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

/* 批量删除按钮 */
.btn-batch-delete {
    padding: 6px 12px;
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fda4af;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.2s ease-in-out;
}

.btn-batch-delete:hover {
    background: #ffe4e6;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

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

/* 顶部操作按钮组 */
.actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action-tool {
    padding: 6px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    /* Fix: 改为 inline-flex 允许并排 */
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.btn-action-tool:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.icon-blue {
    font-family: "Segoe UI Emoji";
    color: #3b82f6;
    font-size: 14px;
}

.icon-orange {
    font-family: "Segoe UI Emoji";
    color: #f97316;
    font-size: 14px;
}

.icon-purple {
    font-family: "Segoe UI Emoji";
    color: #8b5cf6;
    font-size: 14px;
}

.icon-green {
    font-family: "Segoe UI Emoji";
    color: #10b981;
    font-size: 14px;
}

.icon-gray {
    font-family: "Segoe UI Emoji";
    color: #6b7280;
    font-size: 14px;
}

.btn-ghost-border {
    padding: 6px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-ghost-border:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.toolbar-row-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #f3f4f6;
}


.controls-left {
    display: flex;
    gap: 8px;
}

.control-btn {
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: #4b5563;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    border-radius: 4px;
}

.control-btn:hover {
    background: #f3f4f6;
}

.control-btn .icon {
    font-size: 14px;
    color: #6b7280;
}

.control-btn .badge {
    background: #eff6ff;
    color: #3b82f6;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    height: 18px;
    line-height: 18px;
    display: inline-block;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-input-group {
    display: flex;
    align-items: center;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0 8px;
    background: white;
    height: 32px;
    width: 240px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-prefix {
    font-size: 12px;
    color: #6b7280;
    padding-right: 8px;
    border-right: 1px solid #e5e7eb;
    margin-right: 8px;
    white-space: nowrap;
}

.search-input-group input {
    border: none;
    outline: none;
    font-size: 13px;
    width: 100%;
    color: #374151;
}

.btn-create {
    padding: 6px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #111827;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    height: 32px;
}

.btn-create:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* ==================== 全网格表格样式 (像素级复刻) ==================== */

.table-container {
    overflow-x: auto;
    border-top: 1px solid #e5e7eb;
    width: 100%;
}

.data-table {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    color: #111827;

    /* 固定布局防止折行不可控 */
}

/* 表头样式 */
.data-table thead tr {
    background: #ffffff;
}

.data-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #f3f4f6;
    /* 竖向极淡边框 */
    white-space: nowrap;
    /* 不折行 */
    height: 40px;
    vertical-align: middle;
}

/* 单元格样式 */
.data-table tbody tr {
    background: #ffffff;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    /* 竖向极淡边框 */
    vertical-align: middle;
    white-space: nowrap;
    /* 内容不折行 */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 最后一列去掉右边框 */
.data-table th:last-child,
.data-table td:last-child {
    border-right: none;
}

/* 复选框列严格对齐 */
.data-table th.col-checkbox,
.data-table td.col-checkbox {
    width: 44px;
    /* 固定宽度 */
    min-width: 44px;
    max-width: 44px;
    text-align: center !important;
    padding: 0 !important;
    /* 移除所有padding影响 */
    vertical-align: middle;
    box-sizing: border-box;
}

/* 复选框输入框样式 */
.data-table th.col-checkbox input[type="checkbox"],
.data-table td.col-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    margin: 0 auto;
    /* 确保自身居中 */
    display: inline-block;
    position: relative;
    top: 1px;
    /* 对齐微调 */
}

.col-id {
    color: #6b7280;
    text-align: right;
    /* ID靠右对齐，通常数字靠右 */
    padding-right: 16px !important;
}

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

.action-link {
    color: #6b7280;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
}

.action-link:hover {
    color: #111827;
    text-decoration: underline;
}

.market-filter-link {
    color: #6b7280;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.market-filter-link:hover {
    color: var(--primary-color);
}

.market-filter-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* ==================== 标签 ==================== */

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin: 2px;
}

.tag-b2c {
    background: var(--tag-b2c-bg);
    color: var(--tag-b2c-text);
}

.tag-b2b {
    background: var(--tag-b2b-bg);
    color: var(--tag-b2b-text);
}

.tag-saas {
    background: var(--tag-saas-bg);
    color: var(--tag-saas-text);
}

.tag-enterprise {
    background: var(--tag-enterprise-bg);
    color: var(--tag-enterprise-text);
}

.tag-finance {
    background: var(--tag-finance-bg);
    color: var(--tag-finance-text);
}

.tag-tech {
    background: var(--tag-tech-bg);
    color: var(--tag-tech-text);
}

.tag-media {
    background: var(--tag-media-bg);
    color: var(--tag-media-text);
}

.tag-internet {
    background: var(--tag-internet-bg);
    color: var(--tag-internet-text);
}

/* 操作状态标签 */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    gap: 6px;
}

.status-badge.buy {
    background: #d1fae5;
    color: var(--action-buy);
}

.status-badge.hold {
    background: #fef3c7;
    color: var(--action-hold);
}

.status-badge.sell {
    background: #fee2e2;
    color: var(--action-sell);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-badge.buy .status-indicator {
    background: var(--action-buy);
}

.status-badge.hold .status-indicator {
    background: var(--action-hold);
}

.status-badge.sell .status-indicator {
    background: var(--action-sell);
}

/* ==================== 加载状态 ==================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 空状态 ==================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

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

.empty-state h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ==================== 系统设置样式 ==================== */

.settings-section {
    margin-bottom: 40px;
}

.settings-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.settings-group {
    display: grid;
    gap: 24px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-label {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    transition: all 0.2s;
    font-family: inherit;
}

.setting-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.setting-hint {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-top: 4px;
}

select.setting-input {
    cursor: pointer;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ==================== 响应式 ==================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        z-index: 1000;
        transition: left 0.3s;
    }

    .sidebar.open {
        left: 0;
    }

    .search-box {
        width: 200px;
    }
}

/* ==================== 工具类 ==================== */

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

.text-light {
    color: var(--text-tertiary);
}

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

.text-success {
    color: var(--action-buy);
}

.text-warning {
    color: var(--action-hold);
}

.text-danger {
    color: var(--action-sell);
}

.fw-medium {
    font-weight: 500;
}

.fw-semibold {
    font-weight: 600;
}

.fw-bold {
    font-weight: 700;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 16px;
}

.mb-4 {
    margin-bottom: 24px;
}

/* ==================== 修复按钮样式 - 统一风格 ==================== */
button {
    font-family: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    /* 统一圆角 */
    font-weight: 500;
    font-size: 13px;
    /* 统一字体大小 */
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* 统一阴影 */
}

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

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

.btn-secondary {
    background-color: white;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

/* 分析结果表格中的详情按钮 - 迷你版工具栏按钮 */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    /* 统一圆角 */
    background-color: white;
    border: 1px solid #e5e7eb;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* 统一阴影 */
}

.action-btn:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    color: var(--primary-color);
    text-decoration: none;
}

/* ==================== 分页样式 ==================== */
.pagination-container {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
}

.pagination {
    display: inline-flex;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-left: -1px;
    user-select: none;
    transition: all 0.2s;
}

.page-item:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    margin-left: 0;
}

.page-item:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.page-item:hover:not(.disabled):not(.active) {
    background-color: #f9fafb;
    color: var(--primary-color);
    z-index: 2;
}

.page-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    z-index: 3;
}

.page-item.disabled {
    color: #d1d5db;
    cursor: not-allowed;
    background-color: #f9fafb;
}

/* Auth Pages */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f3f4f6;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    width: 400px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}


/* UI Optimizations */
#auth-page .auth-box {
    width: 360px;
    /* Make it slimmer */
    padding: 30px;
    /* Reduce padding slightly */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#auth-page h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
}

#auth-page input[type='text'],
#auth-page input[type='password'] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-top: 4px;
    font-size: 14px;
    box-sizing: border-box;
    /* Fix input overflow */
}

#auth-page input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

#auth-page #auth-btn {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    font-size: 14px;
    transition: background-color 0.2s;
}

#auth-page #auth-btn:hover {
    background-color: var(--primary-hover);
}

/* Fix Register/Login Switch */
#auth-page .switch-link {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 500;
}

#auth-page .input-group {
    margin-bottom: 16px;
}


/* UI Optimizations - Step 2 */
#auth-page .setting-input {
    height: 44px;
    padding: 10px 14px;
    font-size: 15px;
}

#auth-page .btn-create {
    height: 48px;
    font-size: 16px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    font-weight: 600;
}

#auth-page .switch-link:hover {
    text-decoration: underline;
}


/* UI Fixes for Auth Flow */
#auth-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f0f2f5;
    z-index: 9999;
    display: flex;
    /* Ensure it is flex */
    justify-content: center;
    align-items: center;
}

#main-app {
    display: none;
    /* Hidden by default */
    width: 100%;
    height: 100vh;
}

/* Ensure Sidebar and Main Content layout matches original design */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

.sidebar {
    width: 250px;
    background: #fff;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 20px;
}



/* Page Content Base Styles */
.page-content {
    display: none;
    width: 100%;
    min-height: 500px;
    padding: 20px;
    box-sizing: border-box;
}

/* ==================== 加载动画 ==================== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 设置页Tab样式 ==================== */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    background: #fff;
    padding: 0 24px;
}

.settings-tab-item {
    padding: 16px 24px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.settings-tab-item:hover {
    color: var(--primary-color);
    background: var(--bg-hover);
}

.settings-tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
}

.settings-tab-pane {
    display: none;
    padding: 0 24px 32px 24px;
    animation: fadeIn 0.3s ease;
}

.settings-tab-pane.active {
    display: block;
}

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

.btn-save {
    background: var(--primary-color);
    color: white;
    padding: 8px 24px;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

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

.icon-white {
    font-family: "Segoe UI Emoji";
    color: #ffffff;
    font-size: 14px;
}

/* ==================== 响应式移动端适配 (H5) ==================== */

/* 移动端菜单按钮 (默认隐藏) */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    margin-right: 8px;
}

/* 移动端底部导航 (默认隐藏) */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid var(--border-color-light);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    gap: 4px;
    flex: 1;
}

.mobile-nav-item.active {
    color: var(--primary-color);
}

.mobile-nav-icon {
    font-size: 20px;
}

.mobile-nav-text {
    font-size: 11px;
    font-weight: 500;
}

@media (max-width: 768px) {

    /* 侧边栏保持为抽屉式 */
    .sidebar {
        position: fixed;
        left: -230px;
        /* 彻底移除出屏幕 (略大于宽度 220px) */
        top: 0;
        bottom: 0;
        z-index: 2000;
        transition: left 0.3s ease;
        box-shadow: 10px 0 20px rgba(0, 0, 0, 0.1);
        height: 100vh;
        background: #fff;
        display: flex !important;
    }

    .sidebar.active {
        left: 0;
    }

    /* 关键：允许整个应用铺开，不强制自适应宽度 */
    .app-container {
        display: flex;
        width: fit-content;
        /* 根据内部 PC 宽度内容自动展开 */
        min-width: 1200px;
        /* 强制锁定 PC 端最小宽度 */
        height: 100vh;
        overflow-x: auto;
        /* 启用浏览器原生水平滚动条 */
    }

    .main-content {
        flex: 1;
        min-width: 1000px;
        /* 确保右侧内容区物理宽度不变 */
    }

    /* 显示菜单按钮 */
    .mobile-menu-btn {
        display: block !important;
    }

    /* 恢复 PC 端的内容区域间距 */
    .content-area {
        padding: 12px 24px;
        overflow: visible;
    }

    /* 撤销之前的移动端 UI 干扰，全部恢复 PC 模式 */
    .db-grid-4,
    .db-grid-2,
    .toolbar,
    .actions-group {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 20px !important;
    }

    .db-card,
    .btn-action-tool {
        flex: none !important;
        /* 强制不拉伸不挤压 */
        min-width: fit-content;
    }

    /* 隐藏不再需要的底部导航 */
    .mobile-nav {
        display: none !important;
    }
}


@media (max-width: 480px) {
    .db-grid-4 {
        grid-template-columns: 1fr;
    }

    .page-title h1 {
        font-size: 16px;
    }

    .logo span {
        font-size: 16px;
    }
}