/**
 * 权益数卡 - 后台管理样式
 */

:root {
    --admin-primary: #4A6FFF;
    --admin-success: #10B981;
    --admin-danger: #EF4444;
    --admin-warning: #F59E0B;
    --admin-info: #3B82F6;
    --admin-bg: #F3F4F6;
    --admin-sidebar: #1F2937;
    --admin-card: #FFFFFF;
    --admin-text: #1F2937;
    --admin-text-muted: #6B7280;
    --admin-border: #E5E7EB;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 登录页面 */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--admin-sidebar) 0%, #374151 100%);
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 48px;
    background: var(--admin-card);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

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

.login-logo h1 {
    font-size: 1.75rem;
    color: var(--admin-primary);
    margin-top: 12px;
}

.login-box h2 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 8px;
}

.login-box > p {
    text-align: center;
    color: var(--admin-text-muted);
    margin-bottom: 32px;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--admin-text);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    transition: all 0.3s;
    background: var(--admin-card);
}

.form-control:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(74, 111, 255, 0.1);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--admin-text-muted);
    margin-top: 4px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--admin-primary);
    color: white;
}

.btn-primary:hover {
    background: #3B5AE0;
}

.btn-success {
    background: var(--admin-success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--admin-danger);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-warning {
    background: var(--admin-warning);
    color: white;
}

.btn-warning:hover {
    background: #D97706;
}

.btn-secondary {
    background: var(--admin-bg);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
}

.btn-secondary:hover {
    background: var(--admin-border);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

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

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: var(--admin-sidebar);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header span {
    color: var(--admin-primary);
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    transition: all 0.3s;
}

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

.nav-item.active {
    border-left: 3px solid var(--admin-primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-section {
    padding: 8px 20px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 16px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
}

/* 顶部栏 */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.topbar h2 {
    font-size: 1.5rem;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

/* 卡片 */
.card {
    background: var(--admin-card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--admin-border);
    background: var(--admin-bg);
    border-radius: 0 0 12px 12px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--admin-card);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--admin-info);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--admin-success);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--admin-warning);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--admin-danger);
}

.stat-info h4 {
    font-size: 0.85rem;
    color: var(--admin-text-muted);
    margin-bottom: 4px;
}

.stat-info .number {
    font-size: 1.75rem;
    font-weight: 700;
}

/* 表格 */
.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
}

.table th {
    background: var(--admin-bg);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background: var(--admin-bg);
}

.table img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

/* 标签 */
.badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 50px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--admin-success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--admin-danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--admin-warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--admin-info);
}

/* 操作按钮组 */
.actions {
    display: flex;
    gap: 8px;
}

.actions .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* 搜索和过滤 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.search-box {
    display: flex;
    gap: 12px;
}

.search-box input {
    width: 300px;
}

/* 分页 */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.pagination-info {
    color: var(--admin-text-muted);
    font-size: 0.9rem;
}

.pagination {
    display: flex;
    gap: 4px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--admin-text);
    transition: all 0.3s;
}

.pagination a:hover {
    border-color: var(--admin-primary);
    color: var(--admin-primary);
}

.pagination .active {
    background: var(--admin-primary);
    border-color: var(--admin-primary);
    color: white;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--admin-card);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--admin-text-muted);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--admin-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 提示消息 */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--admin-success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--admin-danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--admin-warning);
}

/* 图片上传 */
.image-upload {
    display: flex;
    align-items: center;
    gap: 16px;
}

.image-preview {
    width: 120px;
    height: 120px;
    border: 2px dashed var(--admin-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--admin-bg);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview i {
    font-size: 2rem;
    color: var(--admin-text-muted);
}

/* 开关 */
.switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--admin-border);
    border-radius: 26px;
    transition: 0.3s;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked + .switch-slider {
    background: var(--admin-success);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(22px);
}

/* 响应式 */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--admin-text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
