/* 重置和基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 下拉刷新样式 */
.pull-to-refresh-indicator {
    position: fixed;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
}

.pull-to-refresh-indicator.visible {
    opacity: 1;
}

.pull-to-refresh-indicator.active {
    top: 20px;
}

.refresh-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #2a5298;
    transition: transform 0.3s ease;
}

.refresh-icon svg {
    width: 100%;
    height: 100%;
}

.pull-to-refresh-indicator.spinning .refresh-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.refresh-text,
.refresh-text-release,
.refresh-text-loading {
    font-size: 0.9em;
    font-weight: 500;
    color: #2a5298;
    white-space: nowrap;
    display: none;
}

.pull-to-refresh-indicator.pull .refresh-text {
    display: block;
}

.pull-to-refresh-indicator.release .refresh-text-release {
    display: block;
}

.pull-to-refresh-indicator.loading .refresh-text-loading {
    display: block;
}

/* 为body添加下拉效果 */
body.pull-refresh-active {
    transform: translateY(0px);
    transition: transform 0.2s ease-out;
}

@media (max-width: 768px) {
    .pull-to-refresh-indicator {
        padding: 12px 20px;
        font-size: 0.85em;
    }
    
    .refresh-icon {
        width: 20px;
        height: 20px;
    }
}

/* 语言切换按钮样式 */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    padding: 4px;
    gap: 2px;
}

.lang-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 55px;
}

.lang-btn:hover {
    background: #f8f9fa;
    color: #2a5298;
}

.lang-btn.active {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    box-shadow: 0 2px 8px rgba(42, 82, 152, 0.3);
}

@media (max-width: 768px) {
    .language-switcher {
        top: 10px;
        right: 10px;
        padding: 3px;
        gap: 1px;
    }
    
    .lang-btn {
        padding: 6px 8px;
        font-size: 0.75em;
        min-width: 45px;
    }
}

@media (max-width: 480px) {
    .language-switcher {
        top: 8px;
        right: 8px;
        padding: 2px;
    }
    
    .lang-btn {
        padding: 5px 6px;
        font-size: 0.7em;
        min-width: 40px;
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #333;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    width: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin: 0 auto;
    position: relative;
}

/* 表格容器，用于水平滚动 */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    min-width: 800px; /* 确保表格有最小宽度 */
}

caption {
    font-size: 1.4em;
    font-weight: bold;
    padding: 20px;
    background: #f1f3f5;
    color: #2a5298;
    border-bottom: 2px solid #e0e0e0;
    text-align: center;
}

th, td {
    border: 1px solid #e0e0e0;
    padding: 12px 8px;
    text-align: center;
    vertical-align: middle;
}

th {
    background: #2a5298;
    color: #fff;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    font-size: 0.85em;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    background: #fff;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

tr:nth-child(even) td {
    background: #f8f9fa;
}

tr:hover td {
    background: #e3f2fd;
    transform: scale(1.02);
}

.crypto-name {
    text-align: left;
    font-weight: 500;
    color: #1e3c72;
    min-width: 200px;
}

th[colspan], th[rowspan] {
    background: #1e3c72;
}

/* 数字格式化 */
td:not(.crypto-name) {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 500;
}

/* 大屏幕（桌面） */
@media (min-width: 1200px) {
    body {
        padding: 40px;
    }
    
    table {
        font-size: 1em;
        min-width: 1000px;
    }
    
    th, td {
        padding: 15px 12px;
    }
    
    caption {
        font-size: 1.5em;
        padding: 25px;
    }
}

/* 中等屏幕（平板横屏） */
@media (max-width: 1199px) and (min-width: 992px) {
    table {
        font-size: 0.85em;
        min-width: 900px;
    }
    
    th, td {
        padding: 10px 6px;
    }
}

/* 小屏幕（平板竖屏） */
@media (max-width: 991px) and (min-width: 768px) {
    body {
        padding: 15px;
    }
    
    table {
        font-size: 0.8em;
        min-width: 700px;
    }
    
    th, td {
        padding: 8px 4px;
    }
    
    caption {
        font-size: 1.2em;
        padding: 15px;
    }
    
    .crypto-name {
        min-width: 150px;
    }
}

/* 移动设备 */
@media (max-width: 767px) {
    body {
        padding: 10px;
        background: #2a5298;
    }
    
    .container {
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    caption {
        font-size: 1.1em;
        padding: 12px;
        line-height: 1.4;
    }
    
    table {
        font-size: 0.7em;
        min-width: 600px;
    }
    
    th, td {
        padding: 6px 3px;
        font-size: 0.9em;
    }
    
    .crypto-name {
        min-width: 120px;
        font-size: 0.85em;
    }
    

}

/* 超小屏幕（小手机） */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    table {
        font-size: 0.65em;
        min-width: 500px;
    }
    
    th, td {
        padding: 4px 2px;
    }
    
    caption {
        font-size: 1em;
        padding: 10px;
    }
    
    .crypto-name {
        min-width: 100px;
    }
}

/* 触摸设备优化 */
@media (hover: none) {
    tr:hover td {
        background: inherit;
        transform: none;
    }
    
    td {
        transition: background 0.1s ease;
    }
    
    tr:active td {
        background: #e3f2fd;
    }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 5px;
        min-height: auto;
    }
    
    caption {
        padding: 8px;
        font-size: 1em;
    }
    
    th, td {
        padding: 4px 6px;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .container {
        box-shadow: none;
        border-radius: 0;
    }
    
    table {
        font-size: 0.8em;
    }
    

}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    th {
        background: #000;
        color: #fff;
    }
    
    td {
        border-color: #333;
    }
}

/* 移动布局样式 */
.mobile-layout {
    display: none;
    padding: 15px;
    background: #f8f9fa;
}

.mobile-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mobile-header h2 {
    font-size: 1.4em;
    margin-bottom: 5px;
    font-weight: 600;
}

.mobile-header p {
    font-size: 0.9em;
    opacity: 0.9;
}

.crypto-card {
    background: white;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.crypto-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
    padding: 15px;
    border-bottom: 3px solid #1e3c72;
}

.crypto-symbol {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 3px;
}

.crypto-full-name {
    font-size: 0.9em;
    opacity: 0.9;
    line-height: 1.3;
}

.price-grid {
    padding: 15px;
    background: #f8f9fa;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

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

.price-item.main-price {
    background: linear-gradient(135deg, #e8f5e8, #f0f8ff);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 2px solid #28a745;
}

.price-item.main-price .price-label {
    font-weight: bold;
    color: #155724;
}

.price-item.main-price .price-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #155724;
}

.price-label {
    font-size: 0.85em;
    color: #6c757d;
    font-weight: 500;
}

.price-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    color: #2a5298;
    font-size: 0.95em;
}

.currency-row {
    display: flex;
    justify-content: space-around;
    background: white;
    padding: 12px 15px;
    border-top: 1px solid #e9ecef;
}

.currency-item {
    text-align: center;
    flex: 1;
}

.currency-label {
    display: block;
    font-size: 0.75em;
    color: #6c757d;
    margin-bottom: 2px;
    font-weight: 500;
}

.currency-value {
    display: block;
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    color: #1e3c72;
    font-size: 0.85em;
}

.mobile-footer {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    margin: 10px;
    border-radius: 8px;
    border-top: 2px solid #2a5298;
}

.last-updated {
    font-size: 0.85em;
    color: #495057;
    margin-bottom: 5px;
    font-weight: 500;
}

.update-info {
    font-size: 0.75em;
    color: #6c757d;
    margin: 0;
}

/* 显示/隐藏逻辑 */
@media (min-width: 768px) {
    .mobile-layout {
        display: none !important;
    }
    
    .table-wrapper {
        display: block;
    }
}

@media (max-width: 767px) {
    .table-wrapper {
        display: none;
    }
    
    .mobile-layout {
        display: block;
    }
    
    .container {
        background: #f8f9fa;
        border-radius: 0;
        box-shadow: none;
    }
    
    body {
        padding: 0;
        background: #f8f9fa;
    }
    
    .crypto-card {
        margin-left: 10px;
        margin-right: 10px;
        border-radius: 8px;
    }
    
    .mobile-header {
        margin: 10px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .crypto-card {
        margin-left: 5px;
        margin-right: 5px;
    }
    
    .mobile-header {
        margin: 5px;
    }
    
    .mobile-header h2 {
        font-size: 1.2em;
    }
    
    .price-grid {
        padding: 12px;
    }
    
    .currency-row {
        padding: 10px;
    }
    
    .currency-value {
        font-size: 0.8em;
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    td {
        transition: none;
    }
    
    tr:hover td {
        transform: none;
    }
    
    .crypto-card {
        transition: none;
    }
    
    .crypto-card:hover {
        transform: none;
    }
    
    .pull-to-refresh-indicator {
        transition: none;
    }
    
    .refresh-icon {
        transition: none;
    }
    
    .pull-to-refresh-indicator.spinning .refresh-icon {
        animation: none;
    }
    
    body.pull-refresh-active {
        transition: none;
    }
}

/* ===== PAGE-SPECIFIC STYLING ===== */

/* Page header styling */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.page-title {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.page-subtitle {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.8;
    font-weight: 500;
}

/* BRICK page styling */
body[data-page="brick"] .page-title {
    background: linear-gradient(135deg, #d2691e, #8b4513);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body[data-page="brick"] .container {
    border-top: 3px solid #d2691e;
}

body[data-page="brick"] .mobile-header h2 {
    color: #d2691e;
}

body[data-page="brick"] .language-switcher .lang-btn.active {
    background: linear-gradient(135deg, #d2691e, #8b4513);
    border-color: #d2691e;
}

/* GRP page styling */
body[data-page="grp"] .page-title {
    background: linear-gradient(135deg, #4a69bd, #1e3799);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body[data-page="grp"] .page-subtitle {
    color: #4a69bd;
}

body[data-page="grp"] .container {
    border-top: 3px solid #4a69bd;
}

body[data-page="grp"] .mobile-header h2 {
    color: #4a69bd;
}

body[data-page="grp"] .language-switcher .lang-btn.active {
    background: linear-gradient(135deg, #4a69bd, #1e3799);
    border-color: #4a69bd;
}

/* Responsive adjustments for page headers */
@media (max-width: 767px) {
    .page-title {
        font-size: 2rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .page-header {
        margin-bottom: 1rem;
        padding: 0.5rem 0;
    }
}

/* Brick页面专用样式 - 新版本 */
body[data-page="brick"] .table-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 桌面版价格网格 */
.brick-price-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.brick-price-header {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.brick-price-card {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 160px;
}

.brick-price-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #e65c00, #f9d423);
}

.brick-price-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.brick-price-type {
    font-size: 1.8rem;
    font-weight: 700;
    color: #e65c00;
    margin-bottom: 10px;
}

.brick-price-name {
    text-align: center;
    font-size: 1rem;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.4;
}

.network-type {
    font-size: 0.85rem;
    color: #888;
}

.brick-price-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin: 10px 0;
}

.brick-price-label {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

/* 移动版卡片新颜色 */
body[data-page="brick"] .mobile-layout .crypto-card {
    max-width: 400px;
    margin: 0 auto 1rem;
}

body[data-page="brick"] .price-item.main-price {
    background: linear-gradient(135deg, #e65c00, #f9d423);
    color: white;
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
    box-shadow: 0 4px 15px rgba(230, 92, 0, 0.3);
}

body[data-page="brick"] .price-item.main-price .price-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

body[data-page="brick"] .price-item.main-price .price-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

/* 响应式调整 */
@media (max-width: 767px) {
    .brick-price-grid {
        display: none;
    }
    
    body[data-page="brick"] .mobile-layout {
        padding: 0 15px;
    }
}

@media (min-width: 768px) {
    body[data-page="brick"] .mobile-layout {
        display: none;
    }
}

/* 价格更新动画 - 仅适用于brick页面 */
body[data-page="brick"] .brick-price-value,
body[data-page="brick"] [id^="mobile-price-"],
body[data-page="brick"] [id^="buy-price-"] {
    position: relative;
    display: inline-block;
    overflow: hidden;
}

@keyframes slideOutUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-100%);
        opacity: 0;
    }
}

@keyframes slideInUp {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.price-update-old {
    position: absolute;
    left: 0;
    top: 0;
    animation: slideOutUp 1.0s ease-out forwards;
}

.price-update-new {
    animation: slideInUp 1.1s ease-out forwards;
}