/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1890ff;
    --primary-hover: #40a9ff;
    --primary-active: #096dd9;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --error-color: #ff4d4f;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --bg-color: #f9fafb;
    --bg-white: #ffffff;
    --bg-hover: #f9fafb;
    --bg-active: #eff6ff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --sidebar-width: 240px;
    --header-height: 64px;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

input, textarea, select {
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

/* ==================== 布局 ==================== */
.layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.header {
    height: var(--header-height);
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color) 0%, #722ed1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.username {
    color: var(--text-primary);
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
}

.logout-btn {
    padding: 6px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--bg-active);
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 0;
    flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.sidebar-menu {
    list-style: none;
}

.menu-item {
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-weight: 500;
    margin: 2px 8px;
    border-radius: var(--radius-sm);
    position: relative;
}

.menu-item:hover {
    background: var(--bg-hover);
}

.menu-item.active {
    background: var(--bg-active);
    color: var(--primary-color);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 0 2px 2px 0;
}

.menu-item.has-submenu {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    margin: 2px 8px;
}

.menu-item.has-submenu > .menu-item-label {
    width: 100%;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-sm);
}

.menu-item.has-submenu > .menu-item-label:hover {
    background: var(--bg-hover);
}

.menu-item.has-submenu.active > .menu-item-label {
    background: var(--bg-active);
    color: var(--primary-color);
}

.submenu {
    list-style: none;
    width: 100%;
    display: none;
    padding-left: 8px;
}

.submenu.active {
    display: block;
}

.submenu-item {
    padding: 8px 20px 8px 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 13px;
    border-radius: var(--radius-sm);
    margin: 2px 0;
}

.submenu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.submenu-item.active {
    background: var(--bg-active);
    color: var(--primary-color);
    font-weight: 500;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-color);
}

.content-area::-webkit-scrollbar {
    width: 8px;
}

.content-area::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.content-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.page-container {
    display: none;
    animation: fadeIn 0.2s ease;
}

.page-container.active {
    display: block;
}

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

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

.login-container::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
    from {
        transform: translate(0, 0);
    }
    to {
        transform: translate(50px, 50px);
    }
}

.login-box {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary-color) 0%, #722ed1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-form-step {
    display: none;
}

.login-form-step.active {
    display: block;
}

.form-group {
    margin-bottom: 24px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    background: var(--bg-white);
    color: var(--text-primary);
}

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

.form-control.error {
    border-color: var(--error-color);
}

.form-control.error:focus {
    box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.1);
}

.error-message {
    color: var(--error-color);
    font-size: 12px;
    margin-top: 6px;
    display: none;
}

.error-message.show {
    display: block;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    padding: 8px 20px;
    box-shadow: var(--shadow-sm);
}

/* 登录页面的按钮使用全宽 */
.login-form-step .btn-primary {
    width: 100%;
    padding: 12px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    background: var(--border-color);
    color: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.back-btn {
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.back-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--bg-active);
}

/* ==================== 表格 ==================== */
.table-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-hover);
}

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

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

.table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.table tbody tr {
    transition: all 0.2s ease;
}

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

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ==================== 筛选器 ==================== */
.filters {
    background: var(--bg-white);
    padding: 20px 24px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.filter-input,
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    min-width: 150px;
    background: var(--bg-white);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

/* ==================== 按钮样式 ==================== */
.btn-group {
    display: flex;
    gap: 8px;
}

.btn-default {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    font-weight: 500;
}

.btn-default:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--bg-active);
}

.btn-success {
    background: var(--success-color);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: #73d13d;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--error-color);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: #ff7875;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 0;
    text-decoration: none;
    font-weight: 500;
}

.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ==================== 状态标签 ==================== */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-normal {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
}

.status-banned {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.status-rewarded {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #86efac;
}

.status-unrewarded {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 13px;
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

.pagination-btn {
    padding: 6px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--bg-active);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-hover);
}

/* ==================== 卡片 ==================== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.card-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==================== 表单 ==================== */
.form-section {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.required {
    color: var(--error-color);
}

/* ==================== 文件上传 ==================== */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-hover);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-active);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--bg-active);
    transform: scale(1.02);
}

.upload-file-info {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    display: none;
    border: 1px solid var(--border-color);
}

.upload-file-info.show {
    display: block;
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
}

.preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-hover);
}

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

.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.preview-remove:hover {
    background: var(--error-color);
    transform: scale(1.1);
}

/* ==================== 弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        z-index: 99;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.show {
        left: 0;
    }

    .content-area {
        margin-left: 0;
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-item {
        width: 100%;
    }

    .filter-input,
    .filter-select {
        width: 100%;
    }

    .card-content {
        grid-template-columns: 1fr;
    }
}

/* ==================== 工具类 ==================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.ml-8 {
    margin-left: 8px;
}

.mr-8 {
    margin-right: 8px;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-8 {
    gap: 8px;
}

.gap-16 {
    gap: 16px;
}
