/**
 * 我的Token - 主样式文件
 * 移动端优先设计
 */

* {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overscroll-behavior: none;
    height: 100%;
}

:root {
    --tabbar-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --fab-size: 56px;
}

body {
    -webkit-touch-callout: none;
    -webkit-text-size-adjust: none;
    -webkit-user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    height: 100vh;
    margin: 0;
    padding: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    text-size-adjust: none;
    width: 100%;
    background-color: #edf3ff;
    color: #1c2733;
    overflow: hidden;
}

/* 页面容器 */
.page {
    display: none;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background-color: #edf3ff;
}

.page.active {
    display: flex;
}

/* 页面头部 */
.page-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: #f9fbff;
    border-bottom: 1px solid #d0e4ff;
    position: relative;
    min-height: 56px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.back-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.back-btn:active {
    background-color: rgba(0,0,0,0.05);
    border-radius: 50%;
}

.page-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: 600;
    color: #1c2733;
    margin: 0;
}

/* 页面内容 */
.page-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px 96px; /* 预留底部TAB + FAB空间 */
}

/* 页面底部 */
.page-footer {
    padding: 16px;
    background-color: #f9fbff;
    border-top: 1px solid #d0e4ff;
    box-shadow: 0 -2px 8px rgba(15, 52, 96, 0.08);
}

/* 浮动新增按钮（FAB） */
.fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 16px);
    width: var(--fab-size);
    height: var(--fab-size);
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4da1ff, #0a84ff);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(10, 132, 255, 0.30);
    z-index: 10000; /* 高于tab-bar */
}

.fab:active {
    transform: scale(0.96);
    box-shadow: 0 6px 16px rgba(10, 132, 255, 0.28);
}

/* 登录页样式 */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 20px 20px;
    min-height: 100%;
}

.logo-section {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    padding-top: 20px;
}

.logo-img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.login-form {
    width: 100%;
    max-width: 400px;
}

/* 表单样式 */
.form-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: 20px;
}

/* 验证码输入框和按钮同一行 */
.code-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
}

.code-input {
    flex: 1;
}

.btn-get-code {
    flex-shrink: 0;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #4da1ff, #0a84ff);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    min-width: 100px;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    user-select: none;
}

.btn-get-code:hover:not(:disabled) {
    background: linear-gradient(135deg, #3b8ae6, #006fe0);
}

.btn-get-code:active:not(:disabled) {
    background: linear-gradient(135deg, #2f6fb8, #0052aa);
    transform: scale(0.98);
}

.btn-get-code:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

.input-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-field {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #ffffff;
    color: #333;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}

.input-field::placeholder {
    color: #999;
}

.select-field {
    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 fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    padding-right: 40px;
    cursor: pointer;
}

/* 按钮样式 */
.btn {
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    user-select: none;
    text-align: center;
    display: block;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #4da1ff, #0a84ff);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b8ae6, #006fe0);
}

.btn-primary:active {
    background: linear-gradient(135deg, #2f6fb8, #0052aa);
    transform: scale(0.98);
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-large {
    padding: 16px;
    font-size: 18px;
    min-height: 56px;
}
/* Token列表样式 */
.token-list {
    width: 100%;
}

/* 左滑容器：右侧操作按钮在底层，主内容可横向滑动 */
.token-swipe-row {
    position: relative;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    -webkit-touch-callout: none; /* 禁止iOS长按菜单 */
    -webkit-user-select: none; /* 禁止文本选择 */
    user-select: none;
}

.token-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 144px; /* 2 * 72 */
    display: -webkit-box; /* 兼容旧版iOS */
    display: -webkit-flex; /* 兼容WebKit */
    display: flex;
    -webkit-box-align: stretch; /* 旧版垂直拉伸 */
    -webkit-align-items: stretch; /* WebKit垂直拉伸 */
    align-items: stretch;
    -webkit-box-pack: end; /* 旧版右对齐 */
    -webkit-justify-content: flex-end; /* WebKit右对齐 */
    justify-content: flex-end;
    z-index: 1;
}

.token-action {
    width: 72px;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    -webkit-appearance: none; /* 移除默认样式 */
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.2); /* 移动端点击反馈 */
}

.token-action-edit {
    background: linear-gradient(135deg, #59b0ff, #0a84ff);
    background: -webkit-linear-gradient(135deg, #59b0ff, #0a84ff); /* iOS兼容 */
    background: -moz-linear-gradient(135deg, #59b0ff, #0a84ff); /* Firefox兼容 */
}

.token-action-del {
    background: linear-gradient(135deg, #ff6b6b, #ff3b30);
    background: -webkit-linear-gradient(135deg, #ff6b6b, #ff3b30); /* iOS兼容 */
    background: -moz-linear-gradient(135deg, #ff6b6b, #ff3b30); /* Firefox兼容 */
}

/* 主内容区域 - 优化滑动体验 */
.token-item {
    position: relative;
    display: -webkit-box; /* 兼容旧版iOS Safari */
    display: -webkit-flex; /* 兼容旧版WebKit浏览器 */
    display: -moz-box; /* 兼容旧版Firefox */
    display: -ms-flexbox; /* 兼容IE10 */
    display: flex;
    -webkit-box-align: center; /* 旧版WebKit垂直居中 */
    -webkit-align-items: center; /* WebKit垂直居中 */
    -moz-box-align: center; /* Firefox垂直居中 */
    -ms-flex-align: center; /* IE10垂直居中 */
    align-items: center;
    padding: 16px;
    background-color: #ffffff;
    border-radius: 12px;
    margin-bottom: 0;
    box-shadow: none;
    cursor: pointer;
    -webkit-transition: -webkit-transform 0.3s ease, background-color 0.3s ease; /* iOS兼容 */
    -moz-transition: -moz-transform 0.3s ease, background-color 0.3s ease; /* Firefox兼容 */
    -o-transition: -o-transform 0.3s ease, background-color 0.3s ease; /* Opera兼容 */
    transition: transform 0.3s ease, background-color 0.3s ease;
    min-height: 60px;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
    -webkit-appearance: none; /* 移除iOS默认样式 */
    -moz-appearance: none; /* 移除Firefox默认样式 */
    z-index: 2;
    touch-action: pan-y; /* 优化触摸滚动 */
    -webkit-overflow-scrolling: touch; /* iOS滚动平滑 */
}

.token-item-main {
    border-radius: 12px;
    margin-bottom: 0;
    box-shadow: 0 6px 16px rgba(15, 52, 96, 0.08);
    -webkit-transition: -webkit-transform 0.18s ease; /* iOS兼容 */
    -moz-transition: -moz-transform 0.18s ease; /* Firefox兼容 */
    -o-transition: -o-transform 0.18s ease; /* Opera兼容 */
    transition: transform 0.18s ease;
    will-change: transform; /* 提示浏览器优化 */
    -webkit-backface-visibility: hidden; /* 防止iOS闪动 */
    backface-visibility: hidden;
    -webkit-transform: translate3d(0, 0, 0); /* GPU加速 */
    transform: translate3d(0, 0, 0);
}

/* 点击效果优化 */
.token-item:active {
    background-color: #f0f0f0;
    -webkit-transform: scale(0.98) translate3d(0, 0, 0); /* iOS缩放 */
    -moz-transform: scale(0.98); /* Firefox缩放 */
    -ms-transform: scale(0.98); /* IE缩放 */
    -o-transform: scale(0.98); /* Opera缩放 */
    transform: scale(0.98) translate3d(0, 0, 0);
}

/* 滑动状态下的样式 */
.token-item.swiping {
    -webkit-transition: none; /* 滑动时禁用过渡效果 */
    -moz-transition: none;
    transition: none;
}

/* 名称列 - 20%宽度 */
.token-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    -webkit-box-flex: 0; /* 旧版WebKit */
    -webkit-flex: 0 0 20%; /* WebKit */
    -moz-box-flex: 0; /* Firefox */
    -ms-flex: 0 0 20%; /* IE10 */
    flex: 0 0 20%;
    width: 20%; /* 备份宽度 */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all; /* 长单词换行 */
    -webkit-hyphens: auto; /* iOS自动断词 */
    -moz-hyphens: auto; /* Firefox自动断词 */
    hyphens: auto; /* 自动断词 */
}

/* 数量列 - 40%宽度，居中 */
.token-count {
    font-size: 18px;
    font-weight: 700;
    color: #007AFF;
    -webkit-box-flex: 0; /* 旧版WebKit */
    -webkit-flex: 0 0 40%; /* WebKit */
    -moz-box-flex: 0; /* Firefox */
    -ms-flex: 0 0 40%; /* IE10 */
    flex: 0 0 40%;
    width: 40%; /* 备份宽度 */
    text-align: center;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;
}

/* 时间列 - 40%宽度，右对齐 */
.token-updateTime {
    -webkit-box-flex: 0; /* 旧版WebKit */
    -webkit-flex: 0 0 40%; /* WebKit */
    -moz-box-flex: 0; /* Firefox */
    -ms-flex: 0 0 40%; /* IE10 */
    flex: 0 0 40%;
    width: 40%; /* 备份宽度 */
    text-align: right;
    font-size: 14px;
    color: #666;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 10px;
    word-break: break-all;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;
}

/* iOS Safari 特定优化 */
@supports (-webkit-touch-callout: none) {
    .token-swipe-row {
        -webkit-overflow-scrolling: touch; /* iOS滚动惯性 */
    }
    
    .token-item:active {
        opacity: 0.9; /* iOS点击透明度效果 */
    }
    
    /* 防止iOS橡皮筋效果干扰滑动 */
    .token-list {
        overflow: hidden;
    }
}

/* Android Chrome 特定优化 */
@supports not (-webkit-touch-callout: none) {
    .token-action:active,
    .token-item:active {
        opacity: 0.8; /* Android点击效果 */
    }
}

/* 小屏幕适配 */
@media screen and (max-width: 360px) {
    .token-item {
        padding: 12px;
        min-height: 50px;
    }
    
    .token-actions {
        width: 120px; /* 小屏幕减少按钮宽度 */
    }
    
    .token-action {
        width: 60px;
        font-size: 12px;
    }
    
    .token-name {
        font-size: 14px;
        -webkit-flex: 0 0 25%;
        flex: 0 0 25%;
        width: 25%;
    }
    
    .token-count {
        font-size: 16px;
        -webkit-flex: 0 0 35%;
        flex: 0 0 35%;
        width: 35%;
    }
    
    .token-updateTime {
        font-size: 12px;
        -webkit-flex: 0 0 40%;
        flex: 0 0 40%;
        width: 40%;
    }
}

/* 中屏幕适配 */
@media screen and (min-width: 361px) and (max-width: 768px) {
    .token-item {
        min-height: 56px;
    }
    
    .token-name {
        -webkit-flex: 0 0 22%;
        flex: 0 0 22%;
        width: 22%;
    }
    
    .token-count {
        -webkit-flex: 0 0 38%;
        flex: 0 0 38%;
        width: 38%;
    }
    
    .token-updateTime {
        -webkit-flex: 0 0 40%;
        flex: 0 0 40%;
        width: 40%;
    }
}

/* 防止长文本破坏布局的通用类 */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 热点列表样式 */
.hot-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hot-item {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 4px 10px rgba(15, 52, 96, 0.06);
}

.hot-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.hot-title {
    font-size: 15px;
    font-weight: 600;
    color: #1c2733;
    margin-right: 8px;
}

.hot-time {
    font-size: 12px;
    color: #8b9bb0;
    white-space: nowrap;
}

.hot-content {
    font-size: 14px;
    color: #4a5563;
    line-height: 1.5;
    margin-top: 4px;
}

.hot-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    gap: 12px;
}

.hot-page-info {
    font-size: 14px;
    color: #6b7280;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9aa4b2;
    font-size: 16px;
}
    
/* 下拉刷新指示器 */
.pull-to-refresh-indicator {
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}
    
.pull-to-refresh-indicator .refresh-content {
    display: flex;
    align-items: center;
    gap: 8px;
}
    
.pull-to-refresh-indicator .refresh-arrow {
    font-size: 18px;
    transition: transform 0.3s ease;
}
    
.pull-to-refresh-indicator .refresh-text {
    font-size: 14px;
    color: #666;
}
    
.pull-to-refresh-indicator .refresh-spinner {
    font-size: 18px;
    animation: rotate 1s linear infinite;
}
    
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 吐司提示 */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: rgba(6, 20, 40, 0.9);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s;
    max-width: 80%;
    text-align: center;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 地址提示框 */
.address-tooltip {
    position: fixed;
    background-color: rgba(0,0,0,0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    max-width: 300px;
    word-break: break-all;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.address-tooltip.show {
    opacity: 1;
}

.address-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0,0,0,0.9);
}

/* 底部TAB栏 */
.tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--tabbar-height);
    padding-bottom: var(--safe-bottom);
    background-color: rgba(250, 252, 255, 0.96);
    border-top: 1px solid #d0e4ff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(15, 52, 96, 0.08);
    backdrop-filter: blur(16px);
    z-index: 9999;
}

.tab-item {
    background: none;
    border: none;
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #7b8ba1;
    cursor: pointer;
}

.tab-item .tab-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.tab-item .tab-text {
    font-size: 11px;
}

.tab-item.active {
    color: #0a84ff;
    font-weight: 600;
}

.tab-item.active .tab-icon {
    transform: translateY(-1px);
}

/* 我的页面样式 */
.me-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 4px 20px;
}

.me-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(15, 52, 96, 0.18);
}

.me-nickname {
    font-size: 18px;
    font-weight: 700;
    color: #1c2733;
}

.me-info-list {
    background-color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(15, 52, 96, 0.06);
    overflow: hidden;
}

.me-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #edf2f7;
}

.me-info-item:last-child {
    border-bottom: none;
}

.me-info-label {
    font-size: 14px;
    color: #7b8ba1;
}

.me-info-value {
    font-size: 14px;
    color: #1c2733;
    font-weight: 500;
}

/* 响应式设计 - 桌面端适配 */
@media screen and (min-width: 768px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #e0e0e0;
    }

    .page {
        max-width: 480px;
        max-height: 800px;
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.15);
        overflow: hidden;
    }

    .login-container {
        padding: 60px 40px 40px;
    }

    .logo-img {
        max-width: 250px;
        max-height: 250px;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #fff;
    }

    .page {
        background-color: #1a1a1a;
    }

    .page-header {
        background-color: #2a2a2a;
        border-bottom-color: #3a3a3a;
    }

    .page-footer {
        background-color: #2a2a2a;
        border-top-color: #3a3a3a;
    }

    .back-btn {
        color: #fff;
    }

    .page-title {
        color: #fff;
    }

    .input-field {
        background-color: #2a2a2a;
        border-color: #3a3a3a;
        color: #fff;
    }

    .input-field:focus {
        border-color: #007AFF;
    }

    .input-label {
        color: #ccc;
    }

    .token-item {
        background-color: #2a2a2a;
    }

    .token-item:active {
        background-color: #3a3a3a;
    }

    .token-name {
        color: #fff;
    }

    .empty-state {
        color: #999;
    }
}