/* 管理后台页面样式 */

/* 权限未加载前隐藏受权限控制的元素；带 admin-sidebar-always-show 的侧栏项先显示，避免服务器/接口异常时看不到账户设置与角色权限 */
body:not(.admin-permissions-loaded) [data-permission-section]:not(.admin-sidebar-always-show),
body:not(.admin-permissions-loaded) [data-permission] {
    display: none !important;
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.sidebar-sticky {
    position: relative;
    top: 0;
    height: calc(100vh - 60px);
    padding-top: .5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar .nav-link {
    font-weight: 500;
    color: #333;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin: 0.125rem 0.75rem;
}

.sidebar .nav-link:hover {
    color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
}

.sidebar .nav-link.active {
    color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
}

/* 主内容区域 */
main {
    margin-left: 0;
}

@media (min-width: 768px) {
    main {
        margin-left: 240px;
    }
}

/* 统计卡片样式 */
.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

.text-xs {
    font-size: 0.7rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

/* 卡片阴影 */
.shadow {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

/* 图表容器 */
.chart-area {
    position: relative;
    height: 20rem;
    width: 100%;
}

.chart-pie {
    position: relative;
    height: 15rem;
    width: 100%;
}

/* 表格样式 */
.table th {
    border-top: none;
    font-weight: 600;
    font-size: 0.85rem;
    color: #5a5c69;
}

.table td {
    font-size: 0.85rem;
    padding: 0.75rem;
    vertical-align: middle;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
}

.status-active {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-inactive {
    background-color: #f8d7da;
    color: #842029;
}

.status-banned {
    background-color: #f8d7da;
    color: #842029;
}

.status-pending {
    background-color: #fff3cd;
    color: #664d03;
}

.status-paid {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-cancelled {
    background-color: #f8d7da;
    color: #842029;
}

.status-refunded {
    background-color: #cff4fc;
    color: #055160;
}

.status-refund_requested {
    background-color: #fff3cd;
    color: #664d03;
}

.status-refund_rejected {
    color: #dc3545;
}

.chart-equal {
    position: relative;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.chart-equal canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
    padding: 0 12px;
}

/* 用户类型标签 */
.user-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
}

.type-free {
    background-color: #e2e3e5;
    color: #41464b;
}

.type-premium {
    background-color: #d1ecf1;
    color: #0c5460;
}

.type-enterprise {
    background-color: #d4edda;
    color: #155724;
}

.admin-entitlements-timeline {
    background-color: #f8f9fa;
    border: 1px solid rgba(13, 110, 253, 0.08);
    border-radius: 10px;
    padding: 12px;
    max-height: 260px;
    overflow-y: auto;
}

.admin-entitlement-item {
    background: #ffffff;
    border-radius: 6px;
    border-left: 3px solid #0d6efd;
    padding: 10px 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.admin-entitlement-item:last-child {
    margin-bottom: 0;
}

.admin-entitlement-status {
    font-weight: 600;
    color: #0d6efd;
}

.admin-entitlement-dates {
    font-size: 0.85rem;
    color: #6c757d;
}

.admin-entitlement-order {
    font-size: 0.8rem;
    color: #adb5bd;
}

/* 操作按钮 */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

/* 内容区域切换 */
.content-section {
    display: block;
}

.content-section.d-none {
    display: none;
}

/* 响应式设计 */
@media (max-width: 767.98px) {
    .sidebar {
        position: static;
        height: auto;
        padding-top: 0;
    }
    
    main {
        margin-left: 0;
    }
    
    .chart-equal {
        height: 220px;
    }
}

/* 加载动画 */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

/* 空数据状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* 自定义滚动条 */
.sidebar-sticky::-webkit-scrollbar {
    width: 6px;
}

.sidebar-sticky::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-sticky::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar-sticky::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 卡片悬停效果 */
.card:hover {
    transform: translateY(-5px);
    transition: transform 0.3s ease;
}

/* 模态框样式 */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* 表单样式 */
.form-control:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-select:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

/* 下拉菜单样式 */
.dropdown-menu {
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

.dropdown-item {
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #0d6efd;
}

/* 分页样式 */
.pagination .page-link {
    color: #4e73df;
    border: 1px solid #dddfeb;
}

.pagination .page-link:hover {
    color: #2e59d9;
    background-color: #eaecf4;
    border-color: #dddfeb;
}

.pagination .page-item.active .page-link {
    background-color: #4e73df;
    border-color: #4e73df;
}

/* 工具栏样式 */
.btn-toolbar .btn-group {
    margin-right: 0.5rem;
}

/* 搜索框样式 */
.input-group .form-control {
    border-right: none;
}

.input-group .btn {
    border-left: none;
}

/* 表格响应式样式 */
@media (max-width: 576px) {
    .table-responsive {
        font-size: 0.75rem;
    }
    
    .btn-action {
        padding: 0.125rem 0.25rem;
        font-size: 0.7rem;
    }
}

.notification-dropdown {
    min-width: 280px;
    max-height: 360px;
    overflow-y: auto;
    box-shadow: 0 0.75rem 1.5rem rgba(15, 60, 120, 0.15);
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
}

.notification-item.unread {
    background: rgba(255, 193, 7, 0.15);
}

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

.notification-item-title {
    font-weight: 600;
    color: #1c2c4a;
    margin-bottom: 4px;
}

.notification-item-time {
    font-size: 0.75rem;
    color: #6c757d;
}

.notification-indicator {
    position: absolute;
    top: 6px;
    right: 4px;
    width: 10px;
    height: 10px;
    background: #dc3545;
    border-radius: 50%;
}

.notification-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #dc3545;
    color: #fff;
    border-radius: 999px;
    padding: 0 6px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.4;
}

.admin-logs-table th:nth-child(4),
.admin-logs-table td:nth-child(4) {
    width: 18%;
}

/* 用户管理表格列宽 */
.users-table th:nth-child(1),
.users-table td:nth-child(1) {
    width: 16%;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
    width: 16%;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
    width: 20%;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
    width: 18%;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
    width: 10%;
}

.users-table th:nth-child(6),
.users-table td:nth-child(6) {
    width: 10%;
}

.users-table th:nth-child(7),
.users-table td:nth-child(7) {
    width: 10%;
}

/* 智能体编辑：模型类型为专业版时的醒目样式 */
#agentModelTypeWrapper.model-type-high .form-select {
    border-color: #6f42c1;
    background-color: rgba(111, 66, 193, 0.08);
    color: #6f42c1;
    font-weight: 600;
}
#agentModelTypeWrapper.model-type-high .form-label {
    color: #6f42c1;
    font-weight: 600;
}