/* --- 全局变量 --- */
:root {
    --brand-purple: #6B4FF0;
    --brand-purple-dark: #5a42d9;
    --safe-blue: #0056D2;
    --alert-orange: #FF5722;
    --warm-red: #E91E63;
    --success-green: #10B981;
    --bg-dark: #0B0F19;
    --bg-card: #151A25;
    --bg-sidebar: #0A0E16;
    --text-light: #FFFFFF;
    --text-gray: #9CA3AF;
    --border-color: rgba(255, 255, 255, 0.1);
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

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

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- 布局结构 --- */
body {
    display: flex;
    min-height: 100vh;
}

/* --- 侧边栏 --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 32px;
}

.brand {
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, var(--brand-purple) 0%, #9D7EFF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(107, 79, 240, 0.1);
    color: var(--text-light);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(107, 79, 240, 0.2) 0%, transparent 100%);
    color: var(--brand-purple);
    border-left: 3px solid var(--brand-purple);
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 15px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--brand-purple) 0%, #9D7EFF 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
}

.user-role {
    font-size: 12px;
    color: var(--text-gray);
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 87, 34, 0.1);
    border: 1px solid rgba(255, 87, 34, 0.3);
    border-radius: 8px;
    color: var(--alert-orange);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255, 87, 34, 0.2);
}

/* --- 主内容区 --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- 顶部导航 --- */
.top-bar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.btn-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-gray);
    cursor: pointer;
    padding: 8px;
}

.search-box {
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--brand-purple);
}

.top-actions {
    display: flex;
    gap: 12px;
}

.btn-icon {
    position: relative;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--alert-orange);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* --- 页面容器 --- */
.page-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.date-filter select {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-title {
    font-size: 14px;
    color: var(--text-gray);
}

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

.stat-icon.blue { background: rgba(0, 86, 210, 0.2); }
.stat-icon.purple { background: rgba(107, 79, 240, 0.2); }
.stat-icon.red { background: rgba(233, 30, 99, 0.2); }
.stat-icon.green { background: rgba(16, 185, 129, 0.2); }

.stat-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
}

.stat-change {
    display: flex;
    gap: 8px;
    font-size: 13px;
}

.stat-change.positive { color: var(--success-green); }
.stat-change.negative { color: var(--alert-orange); }

/* --- 图表区域 --- */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 16px;
}

.chart-filter {
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

.chart-body {
    height: 300px;
}

/* --- 最近动态 --- */
.recent-activities {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.recent-activities h3 {
    font-size: 16px;
    margin-bottom: 20px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-gray);
    min-width: 50px;
}

.activity-icon {
    font-size: 20px;
}

.activity-text {
    flex: 1;
    font-size: 14px;
}

/* --- 表格容器 --- */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

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

.data-table thead {
    background: rgba(255, 255, 255, 0.05);
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
}

.data-table td {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- 按钮样式 --- */
.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--brand-purple) 0%, #9D7EFF 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 79, 240, 0.4);
}

.btn-secondary {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-edit, .btn-delete {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit {
    background: rgba(0, 86, 210, 0.2);
    color: var(--safe-blue);
    margin-right: 8px;
}

.btn-edit:hover {
    background: rgba(0, 86, 210, 0.3);
}

.btn-delete {
    background: rgba(255, 87, 34, 0.2);
    color: var(--alert-orange);
}

.btn-delete:hover {
    background: rgba(255, 87, 34, 0.3);
}

/* --- 状态标签 --- */
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge.active, .badge.confirmed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-green);
}

.badge.inactive {
    background: rgba(156, 163, 175, 0.2);
    color: var(--text-gray);
}

.badge.pending {
    background: rgba(255, 87, 34, 0.2);
    color: var(--alert-orange);
}

.badge.processed {
    background: rgba(0, 86, 210, 0.2);
    color: var(--safe-blue);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-gray);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-purple);
}

.form-group textarea {
    resize: vertical;
}

/* --- 公益摘要 --- */
.charity-summary {
    margin-bottom: 24px;
}

.summary-card {
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.1) 0%, rgba(255, 145, 0, 0.1) 100%);
    border: 1px solid rgba(233, 30, 99, 0.3);
    border-radius: 16px;
    padding: 24px;
}

.summary-card h3 {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 8px;
}

.goal-amount {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warm-red) 0%, #FF9100 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 13px;
    color: var(--warm-red);
    font-weight: 500;
}

/* --- 广告卡片 --- */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.ad-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
}

.ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ad-title {
    font-size: 15px;
    font-weight: 500;
}

.ad-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
}

.ad-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-green);
}

.ad-badge.inactive {
    background: rgba(156, 163, 175, 0.2);
    color: var(--text-gray);
}

.ad-content {
    margin-bottom: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.ad-content p {
    font-size: 14px;
    color: var(--text-gray);
}

.ad-contact {
    color: var(--brand-purple);
    font-weight: 500;
}

.ad-actions {
    display: flex;
    gap: 12px;
}

.btn-toggle {
    padding: 8px 16px;
    background: rgba(156, 163, 175, 0.2);
    border: none;
    border-radius: 6px;
    color: var(--text-gray);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-toggle:hover {
    background: rgba(156, 163, 175, 0.3);
}

/* --- 筛选组 --- */
.filter-group {
    display: flex;
    gap: 12px;
}

.filter-group select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

/* --- 设置容器 --- */
.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.settings-section h3 {
    font-size: 16px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* --- 模态框 --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h3 {
    font-size: 18px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-gray);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.btn-close:hover {
    color: var(--text-light);
}

.modal-body {
    padding: 24px;
}

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

/* --- 响应式设计 --- */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .btn-menu-toggle {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .filter-group {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-group select {
        width: 100%;
    }
    
    .settings-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-container {
        padding: 16px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .chart-card,
    .recent-activities {
        padding: 16px;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 600px;
    }
}

/* --- 遮罩层 --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: none;
}

.modal-overlay.show {
    display: block;
}
