/* ============================================
   卡密管理系统 - 浅色商务风格
   基于深色版结构1:1复刻
   ============================================ */

:root {
    --primary: #1c1c1e;
    --primary-light: #f36b2b;
    --primary-dark: #111214;
    --secondary: #f36b2b;
    --bg: #f7f8fa;
    --bg-card: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.96);
    --border-color: rgba(224, 228, 234, 0.92);
    --text-light: #1c1c1e;
    --text-gray: #6b7280;
    --success: #0f9f69;
    --warning: #c06f1a;
    --error: #d14343;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #fffaf7 0%, #f7f8fa 60%, #f2f4f7 100%);
    color: var(--text-light);
    overflow-x: hidden;
}

.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

/* 背景装饰 */
.bg-decoration {
    position: fixed;
    z-index: -1;
    opacity: 0.4;
}

.bg-circle-1 {
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    filter: blur(120px);
    top: -300px;
    right: -300px;
}

.bg-circle-2 {
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-light) 100%);
    filter: blur(100px);
    bottom: -200px;
    left: -200px;
}

/* 主容器 */
.main-container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

/* 欢迎头 */
.welcome-header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 10px;
}

.welcome-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-light) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.welcome-subtitle {
    font-size: 13px;
    color: var(--text-gray);
    font-weight: 400;
}

/* 模块通用样式 */
.module {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(17, 18, 20, 0.05);
}

.module-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.module-body {
    padding: 20px;
}

/* 合并模块布局 */
.merged-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.user-info-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .user-info-section {
        grid-template-columns: 1fr;
    }
}

/* 用户信息卡片 */
.user-card {
    background: rgba(241, 245, 249, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(203, 213, 225, 0.4);
}

.user-info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.user-info-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-gray);
}

.user-info-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
}

.user-info-value.highlight {
    color: var(--primary);
}

/* 到期状态卡片 */
.expiry-card-merged {
    background: linear-gradient(135deg, rgba(241, 245, 249, 0.7) 0%, rgba(226, 232, 240, 0.7) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
}

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

.expiry-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
}

.expiry-status-merged {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expiry-status-merged.active {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.expiry-status-merged.expiring {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.expiry-status-merged.expired {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.expiry-status-merged.permanent {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.expiry-details-merged {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.expiry-date-merged {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
}

.expiry-days-merged {
    font-size: 12px;
    color: var(--text-gray);
}

/* 游戏统计区域 */
.game-stats-merged {
    margin-top: 10px;
}

.game-stats-title {
    font-size: 11px;
    color: var(--text-gray);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.game-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

@media (max-width: 768px) {
    .game-stats-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.game-stat-merged {
    background: rgba(241, 245, 249, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    transition: all 0.3s ease;
}

.game-stat-merged:hover {
    border-color: var(--primary);
    background: rgba(241, 245, 249, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
}

.game-name-merged {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-count-merged {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 2px;
}

.user-count-label-merged {
    font-size: 11px;
    color: var(--text-gray);
    margin-bottom: 8px;
}

/* 进度条 */
.progress-merged-container {
    width: 100%;
    height: 4px;
    background: rgba(203, 213, 225, 0.5);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
    position: relative;
}

.progress-merged-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 2px;
    transition: width 1s ease-out;
}

.progress-merged-percentage {
    position: absolute;
    top: -18px;
    right: 0;
    font-size: 10px;
    color: var(--text-gray);
    font-weight: 500;
}

.progress-merged-info {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}

.progress-merged-info span {
    font-size: 10px;
    color: var(--text-gray);
}

/* 公告模块 */
.announcement-merged {
    background: rgba(241, 245, 249, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
}

.announcement-title-merged {
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.announcement-list-merged {
    list-style: none;
    padding: 0;
    margin: 0;
}

.announcement-list-merged li {
    padding: 6px 0;
    color: var(--text-gray);
    font-size: 13px;
    border-bottom: 1px solid rgba(203, 213, 225, 0.3);
    line-height: 1.5;
}

.announcement-list-merged li:last-child {
    border-bottom: none;
}

.announcement-list-merged li strong {
    color: var(--error);
    font-weight: 600;
}

/* 操作按钮 */
.action-buttons-merged {
    display: flex;
    gap: 12px;
}

@media (max-width: 640px) {
    .action-buttons-merged {
        flex-direction: column;
    }
}

/* 红色重置按钮 */
#resetMachineBtn {
    background: var(--error);
    border: 1px solid var(--error);
    color: #fff;
}

#resetMachineBtn:hover {
    background: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.action-btn-merged {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn-merged:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

.action-btn-merged.secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-light);
}

.action-btn-merged.secondary:hover {
    background: rgba(241, 245, 249, 0.8);
    border-color: var(--primary);
}

/* 页脚 */
.page-footer-merged {
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
}

.footer-text-merged {
    font-size: 11px;
    color: var(--text-gray);
}

.logout-link-merged {
    color: var(--text-gray);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 11px;
    transition: color 0.3s ease;
}

.logout-link-merged:hover {
    color: var(--error);
}

/* 登录信息 */
.login-info-merged {
    font-size: 11px;
    color: var(--text-gray);
    text-align: center;
    margin-top: 8px;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.module {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

.module:nth-child(1) { animation-delay: 0.1s; }
.module:nth-child(2) { animation-delay: 0.2s; }

@keyframes progressExpand {
    from {
        width: 0;
    }
}

#resetModal > div {
    max-height: 90vh;
    overflow-y: auto;
}

/* ============================================
   补充通用组件（兼容其他页面）
   ============================================ */

/* 登录/管理容器 */
.login-container {
    max-width: 440px;
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-container {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

/* 卡片通用 */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 14px 34px rgba(17, 18, 20, 0.05);
}

/* 按钮通用 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-light);
}
.btn-secondary:hover {
    background: rgba(241, 245, 249, 0.8);
}

.btn-danger {
    background: var(--error);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}
.btn-warning:hover {
    background: #d97706;
}

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover {
    background: #059669;
}

.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn-block { width: 100%; }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-gray);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-light);
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #94a3b8;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2394A3B8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: flex;
    gap: 14px;
}

.form-row .form-group {
    flex: 1;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* 警告提示 */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

.alert-info {
    background: #eef2ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

/* 禁用横幅 */
.disabled-banner {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #92400e;
}

/* 模态框 */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 28px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.modal-content h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 18px;
}

/* 表格 */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(203, 213, 225, 0.4);
}

.data-table th {
    background: rgba(241, 245, 249, 0.5);
    font-weight: 600;
    color: var(--text-gray);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.data-table tbody tr.expired td {
    color: #94a3b8;
}

/* 管理头部 */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 14px 20px;
}

/* 统计面板 */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px;
}

.stat-card h3 {
    font-size: 11px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.stat-card p {
    padding: 3px 0;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

/* 筛选面板 */
.filter-panel {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
}

.filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-form select,
.filter-form input {
    padding: 8px 12px;
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-light);
    outline: none;
}

.filter-form select:focus,
.filter-form input:focus {
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
    }
    .filter-form select,
    .filter-form input {
        width: 100%;
    }
}

/* 登录卡片 */
.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 36px 30px;
    box-shadow: 0 14px 34px rgba(17, 18, 20, 0.05);
    width: 100%;
}

.login-card h2 {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    color: var(--text-light);
    margin-bottom: 4px;
}

.login-card .subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 24px;
}

.login-footer {
    margin-top: 18px;
    text-align: center;
}

.login-footer a {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 13px;
}

.login-footer a:hover {
    color: var(--primary);
}

.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    color: #94a3b8;
    font-size: 11px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-error { background: #fee2e2; color: #991b1b; }

/* 滚动条 */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* 响应式 */
@media (max-width: 768px) {
    .page-container {
        padding: 14px;
    }
    .stats-panel {
        grid-template-columns: 1fr;
    }
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 20px;
        width: 95%;
    }
    .welcome-title {
        font-size: 22px;
    }
    .login-card {
        padding: 24px 18px;
    }
}

/* 工具类 */
.text-center { text-align: center; }
.text-muted { color: var(--text-gray); }

::selection {
    background: rgba(79, 70, 229, 0.12);
    color: var(--text-light);
}