* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #6e56cf; /* 主色调：深紫蓝 */
    --primary-light: #9d88ff; /* 浅主色 */
    --primary-glow: rgba(157, 136, 255, 0.5); /* 主色发光效果 */
    --secondary: #00f0ff; /* 辅助色：亮青 */
    --secondary-glow: rgba(0, 240, 255, 0.5); /* 辅助色发光效果 */
    --dark: #121218; /* 深色背景 */
    --dark-light: #1e1e2a; /* 浅深色背景 */
    --light: #f0f0ff; /* 浅色文本 */
    --gray: #8a8aa0; /* 灰色文本 */
    --success: #00ff9d; /* 成功色 */
    --danger: #ff4d6a; /* 危险色 */
    --warning: #ffcc00; /* 警告色（用于编辑按钮） */
    --warning-glow: rgba(255, 204, 0, 0.5); /* 警告色发光效果 */
    --border-radius: 12px; /* 圆角 */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 过渡动画 */
}

body {
    background: linear-gradient(135deg, var(--dark), var(--dark-light));
    min-height: 100vh;
    color: var(--light);
    padding: 20px;
    background-attachment: fixed;
    background-size: cover;
}

/* 背景动态效果 */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 30%, var(--primary-glow) 0%, transparent 50%),
                radial-gradient(circle at 70% 70%, var(--secondary-glow) 0%, transparent 50%);
    z-index: -1;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-20px, 20px) rotate(5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(30, 30, 42, 0.85);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3),
                0 0 15px var(--primary-glow);
    overflow: hidden;
    border: 1px solid rgba(110, 86, 207, 0.2);
}

.header {
    background: linear-gradient(90deg, var(--primary), #5038a0);
    padding: 25px 30px;
    position: relative;
    overflow: hidden;
}

.header::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: var(--secondary-glow);
    filter: blur(100px);
    opacity: 0.5;
}

.header h1 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 28px;
    position: relative;
    text-shadow: 0 0 10px var(--primary-glow);
}

.header p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 16px;
    position: relative;
}

.tabs {
    display: flex;
    background: var(--dark);
    border-bottom: 1px solid rgba(110, 86, 207, 0.2);
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab {
    padding: 16px 24px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    color: var(--gray);
    transition: var(--transition);
    position: relative;
}

.tab:hover {
    color: var(--secondary);
    background: rgba(30, 30, 42, 0.5);
}

.tab.active {
    color: var(--secondary);
    background: var(--dark-light);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--secondary);
    box-shadow: 0 0 10px var(--secondary-glow);
}

.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.5s ease-out forwards;
}

.tab-content.active {
    display: block;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--light);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    background: var(--dark);
    border: 1px solid rgba(110, 86, 207, 0.3);
    border-radius: 8px;
    font-size: 16px;
    color: var(--light);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--secondary);
    outline: none;
    box-shadow: 0 0 0 3px var(--secondary-glow);
}

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

/* 按钮样式 - 强烈动态反馈 */
.btn {
    padding: 14px 24px;
    background: linear-gradient(90deg, var(--primary), #5038a0);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--primary-glow);
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-danger {
    background: linear-gradient(90deg, #d13f5a, var(--danger));
}

.btn-danger:hover {
    box-shadow: 0 5px 15px rgba(255, 77, 106, 0.5);
}

/* 编辑按钮样式 */
.btn-edit {
    background: linear-gradient(90deg, #ffcc00, #e6b800);
}

.btn-edit:hover {
    box-shadow: 0 5px 15px var(--warning-glow);
}

/* 卡片样式 */
.card {
    background: var(--dark);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(110, 86, 207, 0.1);
    padding: 24px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(110, 86, 207, 0.2);
    transform: translateY(-2px);
}

.card h3 {
    color: var(--secondary);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(110, 86, 207, 0.1);
    font-size: 20px;
}

/* 用户信息样式 */
.user-info {
    background: var(--dark);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    border-left: 4px solid var(--secondary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.user-info h3 {
    color: var(--secondary);
    margin: 0 0 15px 0;
    font-size: 18px;
}

.user-info p {
    margin: 8px 0;
    color: var(--light);
}

/* 消息提示样式 */
.success-message, .error-message {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    transition: var(--transition);
}

.success-message {
    background: rgba(0, 255, 157, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.error-message {
    background: rgba(255, 77, 106, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* 商品网格样式 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.product-card {
    background: var(--dark);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    border: 1px solid rgba(110, 86, 207, 0.1);
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3),
                0 0 20px var(--primary-glow);
}

.product-image {
    height: 180px;
    background: linear-gradient(45deg, var(--dark-light), var(--dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    font-size: 24px;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.product-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.3;
}

.product-details {
    padding: 20px;
}

.product-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--light);
}

.product-desc {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.product-points {
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 8px;
}

.product-stock {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 16px;
}

.product-stock.stock-out {
    color: var(--danger);
}

.product-btn {
    width: 100%;
    padding: 12px;
}

.product-btn.disabled {
    background: #333;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

.product-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* 积分显示 */
.points-display {
    font-size: 24px;
    font-weight: bold;
    color: var(--secondary);
    text-align: center;
    margin: 20px 0 30px;
    text-shadow: 0 0 10px var(--secondary-glow);
}

/* 历史记录样式 */
.history-item {
    padding: 16px;
    border-bottom: 1px solid rgba(110, 86, 207, 0.1);
    background: var(--dark-light);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.history-item:hover {
    background: rgba(30, 30, 42, 0.8);
    transform: translateX(5px);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.history-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(110, 86, 207, 0.1);
    color: var(--gray);
    font-size: 14px;
}

.arrow-icon {
    color: var(--secondary);
    transition: var(--transition);
}

/* 管理员列表样式 */
.admin-product-item {
    padding: 20px;
    border: 1px solid rgba(110, 86, 207, 0.1);
    border-radius: 8px;
    margin-bottom: 16px;
    background: var(--dark-light);
    transition: var(--transition);
}

.admin-product-item:hover {
    border-color: rgba(110, 86, 207, 0.3);
    transform: translateX(5px);
}

.admin-product-info {
    margin-bottom: 16px;
}

.admin-product-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(110, 86, 207, 0.1);
}

th {
    background: var(--dark);
    color: var(--secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
}

tr:hover {
    background: rgba(110, 86, 207, 0.05);
}

/* 选择框样式 */
.select-all {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--secondary);
    cursor: pointer;
}

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

.status-active {
    background: rgba(0, 255, 157, 0.2);
    color: var(--success);
}

.status-inactive {
    background: rgba(138, 138, 160, 0.2);
    color: var(--gray);
}

.status-pending {
    background: rgba(0, 240, 255, 0.2);
    color: var(--secondary);
}

/* 管理列表头部 */
.user-list-header, .kami-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.user-count, .kami-count {
    color: var(--gray);
    font-size: 14px;
}

/* 操作列样式 */
.user-actions {
    display: flex;
    gap: 8px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out forwards;
}

.modal-content {
    background: var(--dark-light);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5),
                0 0 30px var(--primary-glow);
    border: 1px solid rgba(110, 86, 207, 0.3);
    animation: scaleIn 0.3s ease-out forwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(110, 86, 207, 0.1);
}

.modal-header h3 {
    margin: 0;
    color: var(--secondary);
}

.close-modal {
    cursor: pointer;
    font-size: 24px;
    color: var(--gray);
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

#change-pwd-form {
    padding: 24px;
}

/* 搜索框样式 */
.search-box {
    margin-bottom: 24px;
    position: relative;
}

.search-box input {
    padding-left: 40px;
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

/* 批量操作按钮 */
.batch-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

#change-pwd-modal {
    display: none !important;
}
#change-pwd-modal.show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 99999 !important;
}

/* 编辑模态框样式 */
#edit-product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 100000; /* 确保高于修改密码模态框的z-index */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#edit-product-modal.show {
    display: flex;
    opacity: 1;
}

#edit-product-modal .modal-content {
    background: var(--dark-light);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7),
                0 0 30px var(--primary-glow),
                0 0 15px var(--secondary-glow);
    border: 2px solid var(--primary);
    animation: modalSlideIn 0.3s ease-out forwards;
    position: relative;
    overflow: hidden;
}

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

#edit-product-modal .modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    z-index: 1;
}

#edit-product-modal .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: var(--gray);
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.3);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#edit-product-modal .close:hover {
    color: var(--danger);
    transform: rotate(90deg);
    background: rgba(255, 77, 106, 0.2);
}

#edit-product-modal h2 {
    color: var(--secondary);
    margin: 0 0 20px 0;
    padding: 20px 24px 0;
    font-size: 22px;
    text-shadow: 0 0 10px var(--secondary-glow);
}

#edit-product-form {
    padding: 0 24px 24px;
}

#edit-product-form .form-group {
    margin-bottom: 20px;
}

#edit-product-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--light);
    font-size: 14px;
}

#edit-product-form .form-group input,
#edit-product-form .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--dark);
    border: 1px solid rgba(110, 86, 207, 0.4);
    border-radius: 8px;
    font-size: 16px;
    color: var(--light);
    transition: var(--transition);
}

#edit-product-form .form-group input:focus,
#edit-product-form .form-group textarea:focus {
    border-color: var(--secondary);
    outline: none;
    box-shadow: 0 0 0 3px var(--secondary-glow);
}

#edit-product-form .form-group textarea {
    min-height: 100px;
    resize: vertical;
}

#edit-product-form button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: linear-gradient(90deg, var(--primary), #5038a0);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

#edit-product-form button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--primary-glow);
}

/* 确保修改密码模态框的z-index低于编辑模态框 */
#change-pwd-modal {
    z-index: 99999; /* 低于编辑模态框的100000 */
}

/* 移动端适配 */
@media (max-width: 768px) {
    #edit-product-modal .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    #edit-product-form {
        padding: 0 20px 20px;
    }
    
    #edit-product-modal h2 {
        padding: 15px 20px 0;
        font-size: 20px;
    }
    
    #edit-product-modal .close {
        top: 10px;
        right: 15px;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .tabs {
        padding-bottom: 5px;
    }
    
    .tab {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .user-actions {
        flex-wrap: wrap;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .tab-content {
        padding: 20px 15px;
    }
    
    /* 移动端按钮组调整 */
    .admin-product-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .admin-product-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
@media (max-width: 768px) {
    #open-change-pwd {
        width: 100% !important; /* 覆盖原有宽度 */
        padding: 16px 24px !important; /* 增大点击区域 */
        margin-top: 10px !important; /* 调整位置避免遮挡 */
        z-index: 9999 !important; /* 确保层级最高 */
    }
}

/* 以下为新增的卡密过长显示修复样式 */
/* 卡密容器允许水平滚动 */
.code-container {
    overflow-x: auto;        /* 内容过长时显示水平滚动条 */
    white-space: nowrap;     /* 禁止内容换行 */
    max-width: 100%;         /* 限制容器最大宽度为父元素宽度 */
    padding-bottom: 8px;    /* 预留滚动条空间 */
}

/* 卡密表格允许水平滚动 */
.kami-table, .codes-table, .product-code-table, .redemption-table {
    display: block;          /* 转为块级元素允许滚动 */
    overflow-x: auto;        /* 表格过宽时显示水平滚动条 */
    white-space: nowrap;     /* 表格内容不换行 */
    max-width: 100%;         /* 限制表格最大宽度为父元素宽度 */
}

/* 卡密项不换行 */
.code-item code, .code-value {
    white-space: nowrap;     /* 卡密内容不换行 */
}

/* 修复模态框内卡密显示 */
.add-codes-content, .delete-codes-content {
    overflow-x: auto;        /* 模态框内卡密过长时允许滚动 */
}

/* 商品备注和排序样式 */
.product-remark, .product-sort {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 8px;
}

.product-sort {
    color: var(--secondary);
    font-weight: 500;
}