/**
 * Default Theme - TDesign
 * 基于 TDesign 设计规范的自定义主题样式
 */

/* ========== CSS 变量定义 ========== */
:root {
    /* 品牌色 */
    --theme-primary: #0052d9;
    --theme-primary-hover: #0034b5;
    --theme-primary-active: #002a9c;
    --theme-primary-light: #ecf2fe;
    --theme-primary-light-hover: #d9e1ff;

    /* 功能色 */
    --theme-success: #2ba471;
    --theme-warning: #e37318;
    --theme-error: #d54941;
    --theme-info: #0052d9;

    /* 文字色 */
    --theme-text-primary: #1a1a1a;
    --theme-text-secondary: #4b4b4b;
    --theme-text-placeholder: #a6a6a6;
    --theme-text-disabled: #c5c5c5;
    --theme-text-white: #ffffff;

    /* 背景色 */
    --theme-bg-page: #f3f3f3;
    --theme-bg-container: #ffffff;
    --theme-bg-container-hover: #f9f9f9;
    --theme-bg-container-active: #eeeeee;

    /* 边框色 */
    --theme-border: #dcdcdc;
    --theme-border-light: #e7e7e7;

    /* 圆角 */
    --theme-radius-sm: 3px;
    --theme-radius-md: 6px;
    --theme-radius-lg: 9px;
    --theme-radius-round: 999px;

    /* 间距 */
    --theme-space-xs: 4px;
    --theme-space-sm: 8px;
    --theme-space-md: 16px;
    --theme-space-lg: 24px;
    --theme-space-xl: 32px;
    --theme-space-xxl: 48px;

    /* 字体 */
    --theme-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --theme-font-size-xs: 12px;
    --theme-font-size-sm: 13px;
    --theme-font-size-base: 14px;
    --theme-font-size-lg: 16px;
    --theme-font-size-xl: 20px;
    --theme-font-size-xxl: 24px;

    /* 行高 */
    --theme-line-height-sm: 1.3;
    --theme-line-height-base: 1.5;
    --theme-line-height-lg: 1.8;

    /* 阴影 */
    --theme-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --theme-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --theme-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);

    /* 过渡 */
    --theme-transition: 0.2s ease;

    /* 布局 */
    --theme-header-height: 56px;
    --theme-sidebar-width: 232px;
    --theme-sidebar-collapsed-width: 64px;
    --theme-content-max-width: 1200px;
    --theme-footer-height: 48px;
}

/* ========== 基础重置 ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: var(--theme-font-size-base);
    line-height: var(--theme-line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--theme-font-family);
    font-size: var(--theme-font-size-base);
    color: var(--theme-text-primary);
    background-color: var(--theme-bg-page);
}

a {
    color: var(--theme-primary);
    text-decoration: none;
    transition: color var(--theme-transition);
}

a:hover {
    color: var(--theme-primary-hover);
}

/* ========== 通用布局 ========== */
.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    height: var(--theme-header-height);
    background-color: var(--theme-bg-container);
    border-bottom: 1px solid var(--theme-border-light);
    display: flex;
    align-items: center;
    padding: 0 var(--theme-space-lg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--theme-shadow-sm);
}

.page-header .logo {
    display: flex;
    align-items: center;
    gap: var(--theme-space-sm);
    font-size: var(--theme-font-size-lg);
    font-weight: 600;
    color: var(--theme-text-primary);
}

.page-header .logo img {
    height: 28px;
    width: auto;
}

.page-header .nav {
    display: flex;
    align-items: center;
    gap: var(--theme-space-xs);
    margin-left: var(--theme-space-xl);
}

.page-header .nav-item {
    padding: var(--theme-space-sm) var(--theme-space-md);
    color: var(--theme-text-secondary);
    border-radius: var(--theme-radius-md);
    transition: all var(--theme-transition);
    font-size: var(--theme-font-size-base);
}

.page-header .nav-item:hover {
    color: var(--theme-primary);
    background-color: var(--theme-primary-light);
}

.page-header .nav-item.active {
    color: var(--theme-primary);
    font-weight: 500;
}

.page-header .header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--theme-space-md);
}

.page-body {
    flex: 1;
    display: flex;
}

.page-sidebar {
    width: var(--theme-sidebar-width);
    background-color: var(--theme-bg-container);
    border-right: 1px solid var(--theme-border-light);
    overflow-y: auto;
    flex-shrink: 0;
}

.page-content {
    flex: 1;
    padding: var(--theme-space-lg);
    overflow-x: hidden;
}

.page-footer {
    height: var(--theme-footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-text-placeholder);
    font-size: var(--theme-font-size-xs);
    border-top: 1px solid var(--theme-border-light);
    background-color: var(--theme-bg-container);
}

/* ========== 内容区域 ========== */
.content-card {
    background-color: var(--theme-bg-container);
    border-radius: var(--theme-radius-lg);
    padding: var(--theme-space-lg);
    margin-bottom: var(--theme-space-md);
    box-shadow: var(--theme-shadow-sm);
}

.content-card .card-title {
    font-size: var(--theme-font-size-lg);
    font-weight: 600;
    color: var(--theme-text-primary);
    margin: 0 0 var(--theme-space-md) 0;
    padding-bottom: var(--theme-space-md);
    border-bottom: 1px solid var(--theme-border-light);
}

.content-card .card-body {
    color: var(--theme-text-secondary);
}

/* ========== 页面标题栏 ========== */
.page-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--theme-space-lg);
}

.page-title-bar h1 {
    font-size: var(--theme-font-size-xl);
    font-weight: 600;
    color: var(--theme-text-primary);
    margin: 0;
}

.page-title-bar .breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--theme-space-xs);
    font-size: var(--theme-font-size-sm);
    color: var(--theme-text-placeholder);
}

.page-title-bar .breadcrumb a {
    color: var(--theme-text-secondary);
}

.page-title-bar .breadcrumb a:hover {
    color: var(--theme-primary);
}

/* ========== 表格增强 ========== */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--theme-space-md);
    flex-wrap: wrap;
    gap: var(--theme-space-sm);
}

.table-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--theme-space-sm);
}

.table-toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--theme-space-sm);
}

/* ========== 状态标签 ========== */
.status-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--theme-radius-round);
    font-size: var(--theme-font-size-xs);
    line-height: 1.6;
}

.status-tag--success {
    color: var(--theme-success);
    background-color: #e8f8f0;
}

.status-tag--warning {
    color: var(--theme-warning);
    background-color: #fef3e6;
}

.status-tag--error {
    color: var(--theme-error);
    background-color: #fde8e8;
}

.status-tag--info {
    color: var(--theme-info);
    background-color: var(--theme-primary-light);
}

.status-tag--default {
    color: var(--theme-text-secondary);
    background-color: var(--theme-bg-container-active);
}

/* ========== 统计卡片 ========== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--theme-space-md);
    margin-bottom: var(--theme-space-lg);
}

.stat-card {
    background-color: var(--theme-bg-container);
    border-radius: var(--theme-radius-lg);
    padding: var(--theme-space-lg);
    box-shadow: var(--theme-shadow-sm);
}

.stat-card .stat-label {
    font-size: var(--theme-font-size-sm);
    color: var(--theme-text-placeholder);
    margin-bottom: var(--theme-space-sm);
}

.stat-card .stat-value {
    font-size: var(--theme-font-size-xxl);
    font-weight: 600;
    color: var(--theme-text-primary);
}

.stat-card .stat-trend {
    font-size: var(--theme-font-size-xs);
    margin-top: var(--theme-space-xs);
}

.stat-card .stat-trend--up {
    color: var(--theme-success);
}

.stat-card .stat-trend--down {
    color: var(--theme-error);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: var(--theme-space-xxl) var(--theme-space-lg);
    color: var(--theme-text-placeholder);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: var(--theme-space-md);
    opacity: 0.4;
}

.empty-state .empty-text {
    font-size: var(--theme-font-size-base);
    margin-bottom: var(--theme-space-md);
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .page-sidebar {
        width: var(--theme-sidebar-collapsed-width);
    }
}

@media (max-width: 768px) {
    .page-header .nav {
        display: none;
    }

    .page-sidebar {
        display: none;
    }

    .page-content {
        padding: var(--theme-space-md);
    }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }

    .content-card {
        padding: var(--theme-space-md);
    }
}
