/* 现代化后台管理系统样式 */
:root {
    --primary-color: #1677ff;
    --primary-hover: #4096ff;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --error-color: #ff4d4f;
    --text-primary: #262626;
    --text-secondary: #8c8c8c;
    --border-color: #d9d9d9;
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-sidebar: #001529;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    /* 默认深色底（略提亮），登录区单独铺渐变 */
    background: #131b26;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* 登录页面 */
#loginPage {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 45%, #312e81 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.required {
    color: var(--error-color);
}

.error-message {
    margin-top: 16px;
    padding: 12px;
    background: #fff2f0;
    border: 1px solid #ffccc7;
    border-radius: var(--radius-sm);
    color: var(--error-color);
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #f0f0f0;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background: #ff7875;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 主页面 */
#mainPage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.user-icon {
    font-size: 18px;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    color: white;
    overflow-y: auto;
    flex-shrink: 0;
}

.nav-menu {
    list-style: none;
    padding: 16px 0;
}

.nav-item {
    padding: 12px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background: rgba(22, 119, 255, 0.2);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-icon {
    font-size: 18px;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

/* 内容区 */
.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}

.filter-select,
.date-input,
.input-field {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 150px;
}

.filter-select:focus,
.date-input:focus,
.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}

.input-group {
    display: flex;
    gap: 8px;
    flex: 1;
}

.input-group .input-field {
    flex: 1;
}

/* 表格 */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: #fafafa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px !important;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: #fff7e6;
    color: #d46b08;
}

.status-paid {
    background: #f6ffed;
    color: #389e0d;
}

.status-cancelled {
    background: #fff2f0;
    color: #cf1322;
}

.status-failed {
    background: #fff1f0;
    color: #cf1322;
}

.status-delivered {
    background: #e6f7ff;
    color: #0958d9;
}

/* 退款状态 */
.status-refund-none {
    background: #f5f5f5;
    color: #595959;
}

.status-refunding {
    background: #fff7e6;
    color: #d46b08;
}

.status-refunded {
    background: #f6ffed;
    color: #389e0d;
}

.status-refund-failed {
    background: #fff2f0;
    color: #cf1322;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.page-info {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Tab内容 */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 200px;
    }

    .nav-menu {
        display: flex;
        overflow-x: auto;
    }

    .nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-item.active {
        border-left: none;
        border-bottom-color: var(--primary-color);
    }

    .header {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 12px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box,
    .filter-select,
    .date-input,
    .input-field {
        width: 100%;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: #bfbfbf;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8c8c8c;
}

/* Toast 提示框样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    min-width: 320px;
    max-width: 420px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    border-left: 4px solid;
    position: relative;
}

.toast.toast-success {
    border-left-color: var(--success-color);
}

.toast.toast-success .toast-icon {
    color: var(--success-color);
}

.toast.toast-error {
    border-left-color: var(--error-color);
}

.toast.toast-error .toast-icon {
    color: var(--error-color);
}

.toast.toast-warning {
    border-left-color: var(--warning-color);
}

.toast.toast-warning .toast-icon {
    color: var(--warning-color);
}

.toast.toast-info {
    border-left-color: var(--primary-color);
}

.toast.toast-info .toast-icon {
    color: var(--primary-color);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast.toast-hiding {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.toast-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    transition: all 0.3s;
    margin-top: -2px;
}

.toast-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* 确认框样式 */
.confirm-modal {
    max-width: 400px;
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.confirm-icon {
    font-size: 24px;
}

.confirm-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.confirm-body {
    padding: 24px;
}

.confirm-body p {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.confirm-actions .btn {
    min-width: 80px;
}

/* ========== 游戏风运营后台（#mainPage.game-admin）========== */
#mainPage.game-admin {
    background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(45, 212, 191, 0.07), transparent 50%),
        linear-gradient(180deg, #1a2432 0%, #141c28 100%);
    color: #e2e8f0;
}

#mainPage.game-admin .header {
    background: linear-gradient(90deg, #243044 0%, #2f3f52 100%);
    border-bottom: 1px solid rgba(45, 212, 191, 0.22);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.22);
}

#mainPage.game-admin .logo {
    color: #fcd34d;
    text-shadow: none;
    font-weight: 600;
}

#mainPage.game-admin .subtitle {
    color: #94a3b8;
}

#mainPage.game-admin .user-info {
    color: #cbd5e1;
}

#mainPage.game-admin .sidebar {
    background: linear-gradient(180deg, #1a2332 0%, #151d2b 100%);
    border-right: 1px solid rgba(45, 212, 191, 0.12);
}

#mainPage.game-admin .nav-item {
    color: #94a3b8;
}

#mainPage.game-admin .nav-item:hover {
    background: rgba(45, 212, 191, 0.08);
    color: #e2e8f0;
}

#mainPage.game-admin .nav-item.active {
    background: rgba(45, 212, 191, 0.12);
    border-left-color: #2dd4bf;
    color: #5eead4;
}

#mainPage.game-admin .content {
    background: transparent;
}

#mainPage.game-admin .page-header h2 {
    color: #f1f5f9;
    letter-spacing: 0.02em;
}

#mainPage.game-admin .page-header p {
    color: #64748b;
}

#mainPage.game-admin .card {
    background: rgba(30, 41, 55, 0.88);
    border: 1px solid rgba(100, 116, 139, 0.4);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(6px);
}

#mainPage.game-admin .orders-toolbar-top {
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

#mainPage.game-admin .orders-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 10px 12px;
    margin-bottom: 16px;
}

#mainPage.game-admin .orders-filter-grid .filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#mainPage.game-admin .orders-filter-grid .filter-field label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

#mainPage.game-admin .filter-input-sm {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #475569;
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: #f1f5f9;
    color: #0f172a;
}

#mainPage.game-admin .filter-input-sm::placeholder {
    color: #64748b;
}

#mainPage.game-admin .filter-input-sm:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

#mainPage.game-admin .toolbar .search-input,
#mainPage.game-admin .toolbar .filter-select,
#mainPage.game-admin .toolbar .date-input,
#mainPage.game-admin .toolbar .input-field {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

#mainPage.game-admin .toolbar .search-input::placeholder {
    color: #64748b;
}

#mainPage.game-admin .search-icon {
    color: #64748b;
}

#mainPage.game-admin .search-input:focus,
#mainPage.game-admin .filter-select:focus,
#mainPage.game-admin .date-input:focus,
#mainPage.game-admin .input-field:focus {
    border-color: #2dd4bf;
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.2);
}

#mainPage.game-admin .btn-primary {
    background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
    border: 1px solid rgba(45, 212, 191, 0.4);
}

#mainPage.game-admin .btn-primary:hover {
    background: linear-gradient(180deg, #2dd4bf 0%, #14b8a6 100%);
}

#mainPage.game-admin .btn-secondary {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

#mainPage.game-admin .btn-secondary:hover {
    background: #334155;
    border-color: #2dd4bf;
    color: #5eead4;
}

#mainPage.game-admin .btn-danger {
    border: 1px solid rgba(248, 113, 113, 0.35);
}

/* 渠道 / 渠道包 / 服务器列表头略加宽，便于阅读配置文案 */
#mainPage.game-admin .orders-table th.col-op-wide,
#mainPage.game-admin .players-table th.col-op-wide {
    min-width: 7.5rem;
}

#mainPage.game-admin .data-table thead {
    background: rgba(15, 23, 42, 0.95);
}

#mainPage.game-admin .data-table th {
    color: #94a3b8;
    border-bottom-color: rgba(45, 212, 191, 0.35);
    font-size: 13px;
    text-transform: none;
}

#mainPage.game-admin .data-table td {
    border-bottom-color: rgba(51, 65, 85, 0.6);
    color: #e2e8f0;
}

#mainPage.game-admin .data-table tbody tr:hover {
    background: rgba(45, 212, 191, 0.06);
}

#mainPage.game-admin .td-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: #cbd5e1;
}

#mainPage.game-admin .td-amount {
    color: #fbbf24;
    font-weight: 600;
}

#mainPage.game-admin .td-time {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

#mainPage.game-admin .cell-product-desc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
}

#mainPage.game-admin .product-buy-text {
    color: #e2e8f0;
}

#mainPage.game-admin .icon-diamond {
    flex-shrink: 0;
    filter: drop-shadow(0 0 4px rgba(94, 234, 212, 0.5));
}

#mainPage.game-admin .td-actions {
    white-space: nowrap;
}

#mainPage.game-admin .td-actions .btn {
    margin-right: 6px;
    margin-bottom: 4px;
}

#mainPage.game-admin .status-badge {
    border: 1px solid transparent;
}

#mainPage.game-admin .status-paid {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.35);
}

#mainPage.game-admin .status-pending {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
}

#mainPage.game-admin .status-cancelled {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.3);
}

#mainPage.game-admin .status-failed {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.35);
}

#mainPage.game-admin .status-delivered {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
}

#mainPage.game-admin .status-refund-none {
    background: rgba(71, 85, 105, 0.35);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.25);
}

#mainPage.game-admin .status-refunding {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
}

#mainPage.game-admin .status-refunded {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.35);
}

#mainPage.game-admin .status-refund-failed {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.3);
}

#mainPage.game-admin .page-info {
    color: #94a3b8;
}

#mainPage.game-admin .empty-state {
    color: #64748b;
}