/* ========== Flask-Admin 左侧菜单布局 - ZJPB焦提示词 ========== */

/* TDesign 色彩系统 */
:root {
    --td-brand-color: #0052D9;
    --td-brand-color-hover: #266FE8;
    --td-brand-color-active: #0034B5;
    --td-brand-color-light: #ECF2FE;
    --td-success-color: #00A870;
    --td-warning-color: #E37318;
    --td-error-color: #D54941;
    --td-bg-color-page: #F5F7FA;
    --td-bg-color-container: #FFFFFF;
    --td-bg-color-container-hover: #F5F5F5;
    --td-text-color-primary: #000000;
    --td-text-color-secondary: #606266;
    --td-text-color-placeholder: #C0C4CC;
    --td-border-color: #DCDFE6;
    --td-border-color-light: #E4E7ED;
    --td-border-radius: 3px;
    --td-border-radius-medium: 6px;
    --td-shadow-1: 0 1px 4px rgba(0, 0, 0, .05);
    --td-shadow-2: 0 2px 12px rgba(0, 0, 0, .08);
    --sidebar-width: 240px;
}

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.admin-sidebar-layout {
    background: var(--td-bg-color-page);
    color: var(--td-text-color-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* ========== 左侧边栏 ========== */
.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--td-bg-color-container);
    border-right: 1px solid var(--td-border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--td-border-color);
}

.sidebar-logo .logo-icon {
    font-size: 32px;
    color: var(--td-brand-color);
}

.sidebar-logo .logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--td-text-color-primary);
    font-family: 'Space Grotesk', sans-serif;
}

/* 导航区域 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

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

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

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

.nav-item {
    margin: 2px 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--td-text-color-secondary);
    text-decoration: none;
    border-radius: var(--td-border-radius-medium);
    transition: all 0.2s cubic-bezier(0.38, 0, 0.24, 1);
}

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

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

.nav-icon {
    font-size: 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-text {
    flex: 1;
    font-size: 14px;
}

/* 用户信息 */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--td-border-color);
    background: var(--td-bg-color-page);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--td-brand-color-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--td-brand-color);
}

.user-avatar .material-symbols-outlined {
    font-size: 24px;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--td-text-color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: var(--td-text-color-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* 顶部导航 */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--td-bg-color-container);
    border-bottom: 1px solid var(--td-border-color);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--td-shadow-1);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-link {
    color: var(--td-text-color-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: var(--td-brand-color);
    text-decoration: none;
}

.breadcrumb-separator {
    color: var(--td-text-color-placeholder);
}

.breadcrumb-current {
    color: var(--td-text-color-primary);
    font-weight: 500;
}

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

.search-box {
    position: relative;
    width: 300px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--td-text-color-placeholder);
    font-size: 20px;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 40px;
    border: 1px solid var(--td-border-color);
    border-radius: var(--td-border-radius);
    font-size: 14px;
    background: var(--td-bg-color-page);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--td-brand-color);
    box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
}

.header-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--td-border-radius);
    color: var(--td-text-color-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.header-btn .material-symbols-outlined {
    font-size: 20px;
}

/* 页面内容 */
.admin-content {
    flex: 1;
    padding: 32px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--td-text-color-primary);
    margin: 0 0 8px 0;
    font-family: 'Space Grotesk', sans-serif;
}

.page-description {
    font-size: 14px;
    color: var(--td-text-color-secondary);
    margin: 0;
}

/* ========== 表格样式 ========== */
.table {
    background: var(--td-bg-color-container);
    border-radius: var(--td-border-radius-medium);
    overflow: hidden;
    box-shadow: var(--td-shadow-1);
    border: 1px solid var(--td-border-color);
}

.table thead th {
    background: var(--td-bg-color-page);
    border: none;
    color: var(--td-text-color-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px;
    border-bottom: 1px solid var(--td-border-color);
}

.table tbody tr {
    border-bottom: 1px solid var(--td-border-color-light);
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background: var(--td-bg-color-page);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table td {
    padding: 16px;
    vertical-align: middle;
    color: var(--td-text-color-primary);
    border: none;
}

/* ========== 表单样式 ========== */
.form-control {
    background: var(--td-bg-color-container);
    border: 1px solid var(--td-border-color);
    border-radius: var(--td-border-radius);
    padding: 8px 12px;
    font-size: 14px;
    color: var(--td-text-color-primary);
    transition: all 0.2s cubic-bezier(0.38, 0, 0.24, 1);
}

.form-control:focus {
    border-color: var(--td-brand-color);
    box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--td-text-color-placeholder);
}

label, .form-label {
    color: var(--td-text-color-primary);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 8px;
}

/* ========== 按钮样式 ========== */
.btn {
    padding: 8px 16px;
    border-radius: var(--td-border-radius);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.38, 0, 0.24, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--td-brand-color);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--td-brand-color-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 82, 217, 0.2);
}

.btn-success {
    background: var(--td-success-color);
    color: #FFFFFF;
}

.btn-warning {
    background: var(--td-warning-color);
    color: #FFFFFF;
}

.btn-danger {
    background: var(--td-error-color);
    color: #FFFFFF;
}

.btn-secondary, .btn-default {
    background: var(--td-bg-color-container);
    border: 1px solid var(--td-border-color);
    color: var(--td-text-color-primary);
}

.btn-secondary:hover, .btn-default:hover {
    background: var(--td-bg-color-container-hover);
}

/* ========== 卡片样式 ========== */
.card, .panel {
    background: var(--td-bg-color-container);
    border: 1px solid var(--td-border-color);
    border-radius: var(--td-border-radius-medium);
    box-shadow: var(--td-shadow-1);
    margin-bottom: 16px;
}

.card-header, .panel-heading {
    background: transparent;
    border-bottom: 1px solid var(--td-border-color);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 16px;
}

.card-body, .panel-body {
    padding: 20px;
}

/* ========== 警告框 ========== */
.alert {
    border-radius: var(--td-border-radius-medium);
    border: none;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.alert-success {
    background: rgba(0, 168, 112, 0.1);
    color: var(--td-success-color);
}

.alert-danger {
    background: rgba(213, 73, 65, 0.1);
    color: var(--td-error-color);
}

.alert-info {
    background: rgba(0, 82, 217, 0.1);
    color: var(--td-brand-color);
}

.alert-warning {
    background: rgba(227, 115, 24, 0.1);
    color: var(--td-warning-color);
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    gap: 4px;
    margin: 20px 0;
}

.pagination .page-link {
    background: var(--td-bg-color-container);
    border: 1px solid var(--td-border-color);
    color: var(--td-text-color-primary);
    border-radius: var(--td-border-radius);
    padding: 6px 12px;
    transition: all 0.2s;
}

.pagination .page-link:hover {
    background: var(--td-brand-color-light);
    border-color: var(--td-brand-color);
    color: var(--td-brand-color);
    text-decoration: none;
}

.pagination .page-item.active .page-link {
    background: var(--td-brand-color);
    border-color: var(--td-brand-color);
    color: #FFFFFF;
}

.pagination .page-item.disabled .page-link {
    background: var(--td-bg-color-page);
    border-color: var(--td-border-color);
    color: var(--td-text-color-placeholder);
    cursor: not-allowed;
}

/* ========== 模态框 ========== */
.modal-content {
    background: var(--td-bg-color-container);
    border: 1px solid var(--td-border-color);
    border-radius: var(--td-border-radius-medium);
    box-shadow: var(--td-shadow-2);
}

.modal-header {
    border-bottom: 1px solid var(--td-border-color);
    padding: 20px 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--td-text-color-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--td-border-color);
    padding: 16px 24px;
}

/* ========== 下拉菜单 ========== */
.dropdown-menu {
    background: var(--td-bg-color-container);
    border: 1px solid var(--td-border-color);
    border-radius: var(--td-border-radius-medium);
    box-shadow: var(--td-shadow-2);
}

.dropdown-item {
    color: var(--td-text-color-primary);
    padding: 8px 16px;
    font-size: 14px;
}

.dropdown-item:hover {
    background: var(--td-brand-color-light);
    color: var(--td-brand-color);
}

/* ========== Select2 ========== */
.select2-container--bootstrap4 .select2-selection {
    background: var(--td-bg-color-container);
    border: 1px solid var(--td-border-color);
    border-radius: var(--td-border-radius);
}

.select2-dropdown {
    background: var(--td-bg-color-container);
    border: 1px solid var(--td-border-color);
    border-radius: var(--td-border-radius-medium);
    box-shadow: var(--td-shadow-2);
}

.select2-results__option {
    color: var(--td-text-color-primary);
    padding: 8px 12px;
}

.select2-results__option--highlighted {
    background: var(--td-brand-color-light);
    color: var(--td-brand-color);
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--td-bg-color-page);
}

::-webkit-scrollbar-thumb {
    background: var(--td-border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--td-text-color-placeholder);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

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

    .search-box {
        display: none;
    }
}
