/* 游戏点券商城 - 移动端优先样式 */

/* ========== Toast提示 ========== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: linear-gradient(135deg, #52c41a, #73d13d);
}

.toast-error {
    background: linear-gradient(135deg, #ff4d4f, #ff7875);
}

.toast-warning {
    background: linear-gradient(135deg, #faad14, #ffc53d);
}

.toast-info {
    background: linear-gradient(135deg, #1890ff, #40a9ff);
}

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========== 登录页面 ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.logo h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 5px;
}

.logo p {
    color: #666;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form input,
.login-form select {
    width: 100%;
    padding: 15px;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
    outline: none;
}

.login-form input:focus,
.login-form select:focus {
    border-color: #667eea;
}

.form-footer {
    text-align: center;
    margin-top: 20px;
}

.form-footer .link {
    color: #667eea;
    font-size: 14px;
}

/* ========== 按钮样式 ========== */
.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.btn-sm {
    padding: 8px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ========== 应用容器 ========== */
.app-container {
    max-width: 100%;
    min-height: 100vh;
    padding-bottom: 20px;
}

/* ========== 头部样式 ========== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header.compact {
    padding: 12px 15px;
}

.header h1 {
    font-size: 18px;
    flex: 1;
    text-align: center;
}

.back-btn {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.balance-mini {
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.token-balance {
    color: #ffd700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.user-detail {
    display: flex;
    flex-direction: column;
}

.role-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.role-info-row .server-name {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

.role-info-row .role-name {
    font-size: 16px;
    font-weight: bold;
    color: white;
}

.role-info-row .vip-level {
    background: linear-gradient(135deg, #ffd700, #ffb347);
    color: #8B4513;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
}

.switch-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.switch-btn:hover {
    background: rgba(255,255,255,0.35);
    transform: rotate(180deg);
}

.balance-info {
    display: flex;
    gap: 15px;
}

.balance-item {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.15);
    padding: 8px 15px;
    border-radius: 20px;
}

.balance-item .value {
    font-weight: bold;
}

/* ========== 统计区域 ========== */
.statistics {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.stat-card h4 {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
}

/* ========== 功能导航 ========== */
.function-nav {
    padding: 15px;
}

.nav-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.nav-row.single {
    grid-template-columns: 1fr;
}

.nav-item {
    background: white;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.nav-item:active {
    transform: scale(0.98);
}

.nav-item.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nav-item.week {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.nav-item.month {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.nav-icon {
    font-size: 32px;
}

.nav-text {
    font-size: 14px;
    font-weight: bold;
}

.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffd700;
    color: #333;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
}

/* ========== 底部 ========== */
.footer {
    padding: 20px;
    text-align: center;
}

.btn-logout {
    display: inline-block;
    padding: 12px 30px;
    background: #ff4757;
    color: white;
    border-radius: 25px;
    font-size: 14px;
}

/* ========== 内容区域 ========== */
.main-content {
    padding: 15px;
}

/* ========== 用户卡片 ========== */
.user-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.user-card .user-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ========== 表单 ========== */
.recharge-form {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
}

.form-group input:focus {
    border-color: #667eea;
}

.recharge-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.recharge-info p {
    margin: 8px 0;
    color: #666;
}

.highlight {
    color: #667eea;
    font-size: 20px;
    font-weight: bold;
}

/* ========== 提示 ========== */
.tips {
    background: #e7f3ff;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
}

.tips h4 {
    margin-bottom: 10px;
    color: #667eea;
}

.tips ul {
    list-style: none;
    color: #666;
}

.tips li {
    margin: 8px 0;
    padding-left: 15px;
    position: relative;
}

.tips li:before {
    content: '•';
    position: absolute;
    left: 0;
    color: #667eea;
}

/* ========== 分类标签 ========== */
.category-tabs {
    display: flex;
    padding: 15px;
    gap: 10px;
    background: white;
    margin-bottom: 5px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    background: #f0f0f0;
    border-radius: 25px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ========== 商品列表 ========== */
.goods-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 15px;
}

.goods-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.2s;
}

.goods-card:active {
    transform: scale(0.98);
}

.goods-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #f0f0f0;
}

.goods-card .goods-info {
    padding: 12px;
}

.goods-card h4 {
    font-size: 14px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.goods-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price {
    color: #ff4757;
    font-weight: bold;
}

.limit-tag {
    background: #ff4757;
    color: white;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
}

/* ========== 弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    margin: 10vh auto;
    max-height: 80vh;
    overflow-y: auto;
}

#roleModal .modal-content {
    overflow-y: hidden !important;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
}

.close {
    width: 30px;
    height: 30px;
    background: #f0f0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
}

.modal-body {
    padding: 30px;
}

.goods-detail {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.goods-detail img {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    object-fit: cover;
    background: #f0f0f0;
}

.goods-detail .goods-info {
    flex: 1;
}

.goods-price {
    font-size: 20px;
    color: #ff4757;
    font-weight: bold;
    margin-bottom: 10px;
}

.goods-items, .goods-limit {
    font-size: 14px;
    color: #666;
    margin: 5px 0;
}

.buy-form {
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.quantity-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-input button {
    width: 40px;
    height: 40px;
    border: 2px solid #eee;
    background: white;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
}

.quantity-input input {
    flex: 1;
    padding: 10px;
    text-align: center;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 16px;
}

.total-price {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 16px;
}

.total-price span {
    color: #ff4757;
    font-weight: bold;
    font-size: 20px;
}

/* ========== 角色选择 ========== */
.role-list {
    max-height: 450px;
    overflow-y: auto;
}

.role-item {
    padding: 15px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    margin-bottom: 10px;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: white;
    position: relative;
}

.role-item:hover {
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.role-item:last-child {
    margin-bottom: 0;
}

.role-item.active {
    border-color: #52c41a;
    background: linear-gradient(135deg, #f6ffed 0%, #e6fff0 100%);
    box-shadow: 0 4px 15px rgba(82, 196, 26, 0.25);
}

.role-item.active::before {
    content: '✓';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #52c41a;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.role-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.server {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 15px;
    font-weight: 500;
}

.name {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    flex: 1;
}

.vip-tag {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: #8B4513;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 10px;
}

.current-tag {
    background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(82, 196, 26, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.role-detail {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    font-size: 13px;
    color: #666;
}

.role-detail span:first-child {
    color: #ff6b6b;
    font-weight: 600;
}

.role-detail span:last-child {
    color: #51cf66;
    font-weight: 600;
}

.balance {
    color: #ff4757;
    font-weight: bold;
}

/* ========== 累计奖励 ========== */
.total-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
}

.total-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.total-value {
    font-size: 32px;
    font-weight: bold;
}

/* 累计规则说明 */
.info-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 15px 0;
}

.info-title {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

.info-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.8;
}

.info-list li {
    margin-bottom: 4px;
}

.reward-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.reward-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.reward-card.locked {
    opacity: 0.6;
}

.reward-card.available {
    border: 2px solid #667eea;
}

.reward-card.received {
    opacity: 0.5;
}

.reward-header {
    margin-bottom: 10px;
}

.reward-threshold {
    color: #667eea;
    font-weight: bold;
}

.reward-items {
    color: #666;
    margin-bottom: 15px;
}

.btn-reward {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
}

.btn-reward:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ========== 日消费信息 ========== */
.day-info-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row.highlight {
    background: #f8f9fa;
    margin: 0 -20px;
    padding: 15px 20px;
    border-radius: 0 0 15px 15px;
    border-bottom: none;
}

.info-label {
    color: #666;
}

.info-value {
    font-weight: bold;
}

.info-row.highlight .info-value {
    color: #667eea;
    font-size: 18px;
}

/* ========== 物品网格 ========== */
.item-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    overflow: hidden;
}

.item-card {
    background: white;
    border-radius: 15px;
    padding: 12px 8px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
}

.item-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.item-name {
    font-size: 11px;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
    max-width: 100%;
}

.item-num {
    font-size: 11px;
    color: #667eea;
    font-weight: bold;
    margin-bottom: 8px;
}

.item-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px;
    border-radius: 8px;
    font-size: 12px;
}

/* ========== 背包 ========== */
.bag-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bag-item {
    background: white;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.bag-item .item-icon {
    font-size: 32px;
}

.bag-item .item-info {
    flex: 1;
}

.bag-item .item-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.bag-item .item-code {
    font-size: 12px;
    color: #666;
}

.bag-item .item-num {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    margin-right: 10px;
}

/* ========== 消费记录 ========== */
.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-item {
    background: white;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.log-type {
    font-weight: bold;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 5px;
    margin-right: 10px;
}

.log-type.coupon {
    background: #ffeaa7;
    color: #333;
}

.log-type.token {
    background: #81ecec;
    color: #333;
}

.log-mark {
    color: #666;
}

.log-right {
    text-align: right;
}

.log-money {
    display: block;
    color: #ff4757;
    font-weight: bold;
}

.log-time {
    font-size: 12px;
    color: #999;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
}

.pagination span {
    color: #666;
}

/* ========== 空状态 ========== */
.empty, .loading {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.loading {
    padding: 20px;
}

/* ========== PC端适配 ========== */
@media (min-width: 768px) {
    .app-container {
        max-width: 500px;
        margin: 0 auto;
        box-shadow: 0 0 30px rgba(0,0,0,0.1);
    }
    
    .goods-list {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .nav-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .item-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========== 安全区域适配 ========== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}
