/* ================================================
   基础资源管理系统 - 公共样式
   图标风格: 简约线性
   ================================================ */

/* CSS 变量 */
:root {
    --primary: #007aff;
    --primary-hover: #0066d6;
    --success: #34c759;
    --warning: #ff9500;
    --danger: #ff3b30;
    --info: #5ac8fa;

    --bg-page: #f5f5f7;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;

    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-placeholder: #aeaeb2;

    --border: #d2d2d7;
    --border-light: #e5e5e7;
    --border-subtle: #eef0f3;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    --transition: all 0.2s ease;
}

* {
    box-sizing: border-box;
}

/* 字体 */
body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================================
   图标样式
   ================================================ */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
}

.icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* 侧边栏图标 */
.sidebar .icon {
    width: 16px;
    height: 16px;
    margin-right: 0;
    opacity: 0.7;
}

.sidebar li a:hover .icon,
.sidebar li a.active .icon {
    opacity: 1;
}

/* 工具栏图标 */
.toolbar .icon {
    width: 14px;
    height: 14px;
    margin-right: 6px;
}

/* 操作按钮图标 */
.table-action-btn {
    padding: 4px 6px;
    font-size: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.table-action-btn .icon {
    width: 14px;
    height: 14px;
    margin: 0;
}

.table-action-btn.view { color: var(--primary); }
.table-action-btn.edit { color: var(--warning); }
.table-action-btn.delete { color: var(--danger); }

.table-action-btn:hover {
    background: rgba(0,0,0,0.06);
}

/* 菜单项 */
.sidebar .menu {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}

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

.sidebar .menu li a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    border-radius: 0;
    gap: 10px;
}

.sidebar .menu li a:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.04);
}

.sidebar .menu li a.active {
    color: var(--primary);
    background: #eef6ff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary);
}

/* 按钮图标 */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-icon .icon {
    width: 14px;
    height: 14px;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.action-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 12px;
}

.action-btn:hover {
    background: rgba(0,0,0,0.06);
}

.action-btn.view:hover { color: var(--primary); }
.action-btn.edit:hover { color: var(--warning); }
.action-btn.delete:hover { color: var(--danger); }

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

.sidebar {
    width: 200px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-logo {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.sidebar-logo h1 {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.main {
    flex: 1;
    margin-left: 200px;
    min-height: 100vh;
}

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

.header-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-user::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
}

.content {
    padding: 20px 22px;
}

/* ================================================
   页面卡片
   ================================================ */
.page-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
}

.card-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.card-header .total {
    font-size: 11px;
    color: #6b7280;
    background: #f6f8fa;
    border: 1px solid var(--border-subtle);
    padding: 4px 9px;
    border-radius: 999px;
    line-height: 1;
}

.card-body {
    padding: 16px 18px 18px;
    overflow-x: auto;
}

/* ================================================
   搜索栏
   ================================================ */
.search-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: #f8fafc;
}

.search-bar .el-input {
    --el-input-border-radius: var(--radius-sm);
}

.search-bar .el-input__wrapper,
.search-bar .el-select__wrapper {
    min-height: 32px;
    box-shadow: 0 0 0 1px #d8dee8 inset;
}

.search-bar .el-input__inner {
    font-size: 12px;
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: center;
}

/* ================================================
   智能搜索
   ================================================ */
.smart-search {
    width: 100%;
}

.search-input-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.search-input {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.search-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.search-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.suggestion-chip {
    padding: 6px 12px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0, 122, 255, 0.05);
}

.search-result {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.search-result-header {
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.search-parse-info {
    color: var(--text-placeholder);
}

.search-result-list {
    max-height: 400px;
    overflow-y: auto;
}

.result-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background: #fafafa;
}

.result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.result-meta .status-active { color: var(--success); }
.result-meta .status-inactive { color: var(--text-placeholder); }

.search-error {
    padding: 20px;
    text-align: center;
    color: var(--danger);
    font-size: 13px;
}

/* ================================================
   表格
   ================================================ */
.el-table {
    --el-table-border-color: var(--border-subtle);
    --el-table-header-bg-color: #f7f9fb;
    --el-table-row-hover-bg-color: #f8fbff;
    font-size: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 100%;
}

.el-table__body-wrapper {
    overflow-x: auto;
}

.el-table th.el-table__cell {
    font-weight: 600;
    color: #6f7785;
    font-size: 11px;
    letter-spacing: 0;
    padding: 0 14px;
    height: 40px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-subtle);
}

.el-table td.el-table__cell {
    padding: 0 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 54px;
    border-bottom: 1px solid var(--border-subtle);
}

.el-table .cell {
    line-height: 20px;
    padding: 0;
    word-break: keep-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.el-table th.el-table__cell .cell,
.el-table td.el-table__cell .cell {
    display: flex;
    align-items: center;
    min-height: inherit;
}

.el-table th.el-table__cell .cell {
    color: #7b8494;
}

.el-table td.el-table__cell .cell {
    color: #1f2937;
}

.el-table__row:hover > td {
    background: #f8fbff !important;
}

/* 斑马纹 */
.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
    background: #fbfcfe;
}

/* 状态标签 */
.status-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.status-tag.active { background: #e9f8ef; color: #147a36; }
.status-tag.inactive { background: #f2f4f7; color: #667085; }
.status-tag.warning { background: #fff5e6; color: #b45309; }
.status-tag.danger { background: #fff0f0; color: #c92a2a; }

/* 操作列 */
.table-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}


/* ================================================
   按钮
   ================================================ */
.el-button {
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
    min-height: 32px;
    padding: 7px 13px;
}

.el-button + .el-button {
    margin-left: 0;
}

.table-action-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
}

.table-action-btn:hover {
    background: #f4f7fb;
    border-color: var(--border-subtle);
}

.table-action-btn.delete:hover {
    background: #fff5f5;
}

.el-button--primary {
    background: var(--primary);
    border-color: var(--primary);
}

.el-button--primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.el-button--success {
    background: var(--success);
    border-color: var(--success);
}

.el-button--danger {
    background: var(--danger);
    border-color: var(--danger);
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    padding: 6px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.logout-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ================================================
   对话框
   ================================================ */
.el-dialog {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.el-dialog__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: #fafafa;
}

.el-dialog__title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.el-dialog__body {
    padding: 24px 20px;
}

.el-dialog__footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    background: #fafafa;
}

/* 表单项 */
.form-item {
    margin-bottom: 16px;
}

.form-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

/* ================================================
   分页
   ================================================ */
.pagination-wrap {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.el-pagination {
    --el-pagination-button-bg-color: var(--bg-card);
    --el-pagination-hover-color: var(--primary);
    font-size: 12px;
}

/* ================================================
   空状态
   ================================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

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

.empty-state p {
    font-size: 13px;
}

/* ================================================
   首页统计卡片
   ================================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 16px;
    transition: var(--transition);
    cursor: default;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card h4 {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-card .icon {
    margin-bottom: 8px;
}

.stat-card .icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

/* ================================================
   首页导航卡片
   ================================================ */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.nav-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: block;
}

.nav-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.nav-card .icon {
    margin-bottom: 8px;
}

.nav-card .icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.nav-card h5 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.nav-card p {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ================================================
   工具类
   ================================================ */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ================================================
   登录页
   ================================================ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    border-radius: var(--radius-md);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 600;
}

.login-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.login-tip {
    text-align: center;
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-placeholder);
}
