/* FastAdmin 后台样式 */

:root {
    --fa-primary: #4e73df;
    --fa-secondary: #858796;
    --fa-success: #1cc88a;
    --fa-info: #36b9cc;
    --fa-warning: #f6c23e;
    --fa-danger: #e74a3b;
    --fa-dark: #5a5c69;
    --fa-light: #f8f9fc;
    --sidebar-width: 220px;
    --topbar-height: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--fa-light);
}

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

.login-card {
    background: white;
    border-radius: 10px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

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

.login-header .logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--fa-primary);
}

.login-header p {
    color: var(--fa-secondary);
    margin-top: 10px;
}

.login-form .form-control {
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #d1d3e2;
    font-size: 0.95rem;
}

.login-form .form-control:focus {
    border-color: var(--fa-primary);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 221, 0.25);
}

.login-form .input-group-text {
    background: var(--fa-light);
    border: 1px solid #d1d3e2;
    border-radius: 6px 0 0 6px;
    color: var(--fa-secondary);
}

.login-form .form-control {
    border-radius: 0 6px 6px 0;
}

.login-form .btn-login {
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
}

/* 后台布局 */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.admin-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: all 0.3s;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--topbar-height);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-brand:hover {
    color: white;
}

.sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 10px 20px;
}

.sidebar-heading {
    padding: 10px 20px 5px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

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

.sidebar-nav .nav-item {
    position: relative;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    width: 24px;
    margin-right: 10px;
    text-align: center;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link .sidebar-arrow {
    margin-left: auto;
    transition: transform 0.2s;
}

.sidebar-nav .nav-item.open > .nav-link .sidebar-arrow {
    transform: rotate(90deg);
}

.sidebar-sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.1);
    display: none;
}

.sidebar-nav .nav-item.open > .sidebar-sub-menu {
    display: block;
}

.sidebar-sub-menu .nav-link {
    padding: 8px 20px 8px 54px;
    font-size: 0.85rem;
}

/* 顶部栏 */
.admin-topbar {
    height: var(--topbar-height);
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.topbar-left .sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--fa-secondary);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
}

.topbar-left .sidebar-toggle:hover {
    background: var(--fa-light);
}

.topbar-search {
    position: relative;
    margin-left: 20px;
    max-width: 300px;
}

.topbar-search input {
    border: 1px solid #d1d3e2;
    border-radius: 20px;
    padding: 6px 15px 6px 35px;
    font-size: 0.9rem;
    width: 100%;
    background: var(--fa-light);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--fa-primary);
    background: white;
}

.topbar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fa-secondary);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.topbar-nav .nav-item {
    position: relative;
}

.topbar-nav .nav-link {
    color: var(--fa-secondary);
    font-size: 1.1rem;
    padding: 8px;
    border-radius: 50%;
    position: relative;
}

.topbar-nav .nav-link:hover {
    background: var(--fa-light);
    color: var(--fa-primary);
}

.topbar-nav .badge-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fa-danger);
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
}

.user-dropdown:hover {
    background: var(--fa-light);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--fa-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info {
    line-height: 1.2;
}

.user-info .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.user-info .user-role {
    font-size: 0.7rem;
    color: var(--fa-secondary);
}

/* 内容区域 */
.admin-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 20px;
    flex: 1;
    min-width: 0;
}

/* 页面标题 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.page-header .breadcrumb {
    margin: 0;
    font-size: 0.85rem;
}

/* 统计卡片 */
.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    border-left: 4px solid;
    margin-bottom: 20px;
}

.stat-card.primary { border-left-color: var(--fa-primary); }
.stat-card.success { border-left-color: var(--fa-success); }
.stat-card.info { border-left-color: var(--fa-info); }
.stat-card.warning { border-left-color: var(--fa-warning); }
.stat-card.danger { border-left-color: var(--fa-danger); }

.stat-card .stat-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card .stat-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--fa-secondary);
    margin-bottom: 5px;
}

.stat-card .stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.stat-card .stat-card-icon {
    font-size: 2rem;
    opacity: 0.3;
}

/* 数据表格卡片 */
.data-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.data-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-card-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fa-primary);
    margin: 0;
}

.data-card-body {
    padding: 20px;
}

.data-card-footer {
    padding: 15px 20px;
    border-top: 1px solid #e3e6f0;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--fa-secondary);
    padding: 12px 15px;
    border-bottom: 2px solid #e3e6f0;
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e3e6f0;
    vertical-align: middle;
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: var(--fa-light);
}

.data-table .table-thumb {
    width: 50px;
    height: 35px;
    object-fit: cover;
    border-radius: 4px;
}

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

.status-badge.active {
    background: rgba(28, 200, 138, 0.15);
    color: var(--fa-success);
}

.status-badge.inactive {
    background: rgba(133, 135, 150, 0.15);
    color: var(--fa-secondary);
}

.status-badge.pending {
    background: rgba(246, 194, 4, 0.15);
    color: #c49a0c;
}

/* 图表区域 */
.chart-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.chart-card h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fa-primary);
    margin-bottom: 15px;
}

.chart-placeholder {
    height: 300px;
    background: linear-gradient(180deg, rgba(78, 115, 221, 0.05) 0%, rgba(78, 115, 221, 0.02) 100%);
    border-radius: 8px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 20px;
}

.chart-bar {
    width: 30px;
    background: linear-gradient(180deg, var(--fa-primary), #224abe);
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
}

/* 仪表盘趋势图 */
.chart-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.chart-card-head h5 {
    margin-bottom: 0;
}

.chart-summary {
    font-size: 12.5px;
    color: #8a94a6;
    margin-top: 4px;
}

.chart-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.chart-filters .btn {
    font-size: 12.5px;
    padding: 4px 10px;
}

.chart-custom-range {
    display: flex;
    gap: 6px;
    align-items: center;
}

.chart-custom-range[hidden] {
    display: none;
}

.chart-custom-range input {
    width: 132px;
}

.trend-chart {
    min-height: 260px;
}

.trend-svg-wrap svg {
    width: 100%;
    height: auto;
    display: block;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #8a94a6;
    margin-top: 6px;
}

.chart-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.chart-empty {
    min-height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #a0a8b8;
    text-align: center;
    background: #fafbfe;
    border: 1px dashed #e3e8f2;
    border-radius: 8px;
    padding: 24px;
}

.chart-empty i {
    font-size: 28px;
    color: #c3cad8;
}

.chart-empty p {
    margin: 0;
    font-size: 13px;
}

.chart-empty .chart-empty-title {
    font-size: 14px;
    font-weight: 600;
    color: #7b8496;
}

/* 模板下载 TOP 排行 */
.top-template-list {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.top-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.top-list li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-rank {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #eef1f8;
    color: #7b86a1;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.top-rank.top {
    background: linear-gradient(135deg, #4e73df, #224abe);
    color: #fff;
}

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

.top-name {
    font-size: 13px;
    color: #3f4759;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.top-bar-track {
    height: 7px;
    border-radius: 99px;
    background: #eef1f8;
    overflow: hidden;
}

.top-bar {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #4e73df, #6f8cf0);
    transition: width 0.35s ease;
}

.top-count {
    font-size: 12px;
    color: #8a94a6;
    flex: 0 0 auto;
}

@media (max-width: 575.98px) {
    .chart-filters {
        width: 100%;
    }

    .chart-custom-range {
        width: 100%;
    }

    .chart-custom-range input {
        flex: 1;
        width: auto;
    }
}

/* 快捷操作 */
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.quick-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    color: var(--fa-primary);
}

.quick-action .quick-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    margin-bottom: 10px;
}

.quick-action span {
    font-size: 0.85rem;
    font-weight: 600;
}

/* 表单样式 */
.form-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.form-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e3e6f0;
}

.form-card-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fa-primary);
    margin: 0;
}

.form-card-body {
    padding: 20px;
}

.form-card-footer {
    padding: 15px 20px;
    border-top: 1px solid #e3e6f0;
    text-align: right;
}

/* 响应式 */
@media (max-width: 768px) {
    .admin-sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    
    .admin-sidebar.show {
        margin-left: 0;
    }
    
    .admin-topbar {
        left: 0;
    }
    
    .admin-content {
        margin-left: 0;
    }
    
    .topbar-search {
        display: none;
    }
    
    .user-info {
        display: none;
    }
}

/* 顶栏待办通知与访客留言 */
.topbar-nav .nav-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--fa-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.admin-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: -4px;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(58, 59, 69, 0.18);
    z-index: 1000;
    overflow: hidden;
    text-align: left;
}

.admin-popover[hidden] {
    display: none;
}

.admin-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 600;
    color: #3a3b45;
    font-size: 0.9rem;
}

.admin-popover-action {
    border: none;
    background: transparent;
    color: #858796;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}

.admin-popover-action:hover {
    background: #f8f9fc;
    color: var(--fa-primary);
}

.admin-popover-body {
    max-height: 380px;
    overflow-y: auto;
}

.admin-popover-footer {
    padding: 10px 16px;
    border-top: 1px solid #e3e6f0;
    text-align: center;
    background: #fbfbfd;
}

.admin-popover-link,
.admin-popover-more {
    border: none;
    background: transparent;
    color: var(--fa-primary);
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
}

.admin-popover-empty {
    padding: 28px 16px;
    text-align: center;
    color: #858796;
    font-size: 0.85rem;
}

.admin-todo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid #f1f3f9;
    background: #fff;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.admin-todo-item:hover {
    background: #f8f9fc;
}

.admin-todo-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f8f9fc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-todo-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-todo-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #3a3b45;
}

.admin-todo-desc {
    font-size: 0.75rem;
    color: #858796;
}

.admin-todo-count {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #feeceb;
    color: var(--fa-danger);
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-popover-divider {
    padding: 8px 16px;
    background: #f8f9fc;
    color: #858796;
    font-size: 0.72rem;
    font-weight: 600;
}

.admin-order-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f3f9;
    text-decoration: none;
    color: inherit;
}

.admin-order-item:hover {
    background: #f8f9fc;
}

.admin-order-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #3a3b45;
}

.admin-order-amount {
    color: var(--fa-success);
}

.admin-order-meta {
    display: block;
    margin-top: 2px;
    font-size: 0.72rem;
    color: #858796;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-msg-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid #f1f3f9;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.admin-msg-item:hover {
    background: #f8f9fc;
}

.admin-msg-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.admin-msg-subject {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3a3b45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-msg-status {
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
}

.admin-msg-status.pending {
    background: #fff3cd;
    color: #b8860b;
}

.admin-msg-status.replied {
    background: #d4edda;
    color: #1e7e34;
}

.admin-msg-meta {
    font-size: 0.72rem;
    color: #858796;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-msg-preview {
    font-size: 0.78rem;
    color: #5a5c69;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.admin-msg-time {
    font-size: 0.68rem;
    color: #b7b9cc;
}

.admin-message-content,
.admin-message-reply {
    padding: 10px 12px;
    border-radius: 6px;
    background: #f8f9fc;
    font-size: 0.85rem;
    color: #3a3b45;
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-message-reply {
    border-left: 3px solid var(--fa-success);
    background: #f4fbf8;
}
