/**
 * 后台管理系统 - 样式
 * 参考 TailAdmin 设计规范
 */

/* ===== 基础布局 ===== */
body { font-family: 'Outfit', 'Inter', system-ui, sans-serif; }

.admin-sidebar {
    width: 210px;
    min-width: 210px;
    background: #1e293b;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.admin-sidebar.collapsed {
    width: 64px;
    min-width: 64px;
}

/* ===== 侧边栏菜单 ===== */
.sidebar-menu-label {
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #6b7a90;
    padding: 0 12px;
    margin-bottom: 12px;
    margin-top: 24px;
}
.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #b0bdd0;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    margin-bottom: 2px;
    position: relative;
}
.sidebar-menu-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidebar-menu-item.active {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
}
.sidebar-menu-item.active::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: #2563eb;
    border-radius: 0 3px 3px 0;
}
.sidebar-menu-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.sidebar-submenu {
    padding-left: 32px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}
.sidebar-submenu.open {
    max-height: 500px;
}
.sidebar-submenu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #8899ad;
    font-size: 0.8125rem;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    margin-bottom: 2px;
}
.sidebar-submenu-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}
.sidebar-submenu-item.active {
    color: #60a5fa;
}

/* ===== 顶部导航 ===== */
.admin-header {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 40;
}

/* ===== 内容区 ===== */
.admin-content {
    background: #f9fafb;
    min-height: calc(100vh - 64px);
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ===== 通用卡片 ===== */
.admin-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.admin-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.admin-card-body {
    padding: 20px;
}

/* ===== 数据表格 ===== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.admin-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}
.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
}
.admin-table tr:hover td {
    background: #f9fafb;
}
.admin-table tr:last-child td {
    border-bottom: none;
}

/* ===== 按钮 ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f3f4f6;
    color: #374151;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #fecaca;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 4px 10px; font-size: 0.8125rem; }

/* ===== 表单 ===== */
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
.form-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    padding-right: 36px;
    cursor: pointer;
}
.form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ===== 徽章 ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-yellow { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

/* ===== 统计卡片 ===== */
.stat-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}
.stat-label {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 2px;
}

/* ===== 弹窗 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.modal-box {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.2s;
}
.modal-overlay.show .modal-box {
    transform: translateY(0) scale(1);
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-body { padding: 20px; }
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pagination button {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.8125rem;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}
.pagination button:hover { background: #f3f4f6; }
.pagination button.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #9ca3af;
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ===== 滚动条 ===== */
.admin-sidebar { scrollbar-width: none; -ms-overflow-style: none; }
.admin-sidebar::-webkit-scrollbar { display: none; }
.admin-content::-webkit-scrollbar { width: 6px; }
.admin-content::-webkit-scrollbar-track { background: transparent; }
.admin-content::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* ===== 系统管理 Tab ===== */
.sys-tab {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.sys-tab:hover { color: #2563eb; }
.sys-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}
