/* ==========================================================================
   聚合汇率 - 旗舰版全局主题自适应样式系统 (TMA & Web双端联动旗舰版)
   ========================================================================== */

/* --- 1. 全局设计系统变量 (自适应亮色与经典石墨深灰主题) --- */
:root {
    --bg-body: #f4f7fb;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #e1e8ed;
    --primary-color: #4834d4;
    --success-color: #2ecc71;
}

[data-theme="dark"] {
    --bg-body: #1e1f22;      /* 经典石墨深灰大背景 (Discord/TMA 标志性灰色) */
    --bg-card: #2b2d31;      /* 极具悬浮立体感的石墨灰容器背景 */
    --text-main: #f2f3f5;    /* 亮白主文本字 */
    --text-muted: #949ba4;   /* 清晰中立的副文本字 */
    --border-color: #35363c; /* 细腻无缝的深灰边框线 */
    --primary-color: #3498db;
}

/* --- 2. 基础全局标签覆盖 --- */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'PingFang SC', -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

/* 强力覆盖全局副文本小字，确保暗黑/灰色模式下的高清晰对比度 */
.text-muted {
    color: var(--text-muted) !important;
}

/* --- 3. 共通顶部自适应高级导航条 (TMA环境自动智能隐藏) --- */
.navbar-custom {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 15px;
}

/* 适配支付详情页较窄卡片的导航条容器样式 */
.checkout-card + .checkout-container, 
.nav-container-narrow {
    max-width: 650px;
}

.nav-link-custom {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-link-custom.active {
    background: var(--primary-color);
    color: #fff;
}

.nav-link-custom:hover {
    background: var(--primary-color);
    color: #fff;
}

.theme-switch {
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    border-radius: 50%;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s;
}

.theme-switch:hover {
    transform: scale(1.08);
}

.container {
    max-width: 1200px !important;
    padding: 15px 10px;
}

/* --- 4. 行情主看板专属样式 (index.html) --- */
.glass-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
    overflow: visible !important;
    border: 1px solid var(--border-color);
}

.header-gradient {
    background: linear-gradient(135deg, #4834d4 0%, #686de0 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

/* 实时汇率行情看板上的倒计时半透明磨砂玻璃胶囊标签 */
.timer-badge {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 5px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.timer-icon {
    font-size: 0.85rem;
    animation: spin 3s linear infinite;
    display: inline-block;
}

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

.timer-countdown {
    color: #ffffff;
    font-family: 'Consolas', 'Courier New', monospace; /* 等宽字体，防止数字变动引发宽度抖动 */
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* 币种下拉搜索 */
.custom-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: 10px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 99999 !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2);
    display: none;
    border: 1px solid var(--border-color);
}

.dropdown-item-custom {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.match-highlight {
    background-color: rgba(241, 196, 15, 0.1);
    border-left: 4px solid #f1c40f;
}

/* 看板上方统计卡片 */
.stats-dashboard {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
}

.stat-card {
    background: var(--bg-card);
    flex: 1;
    min-width: 160px;
    padding: 12px 15px;
    border-radius: 12px;
    border-bottom: 3px solid var(--border-color);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    display: block;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 800;
}

/* 强自适应行情表格样式 */
.table-responsive-custom {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
    overflow: visible;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.01);
    padding: 2px;
}

.table-custom {
    background: transparent !important;
    color: var(--text-main) !important;
}

.table-custom th {
    font-weight: 700;
    border-bottom: 2px solid var(--border-color) !important;
}

.table-custom th, .table-custom td {
    background: transparent !important;
    color: var(--text-main) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.table-custom thead {
    background: rgba(0, 0, 0, 0.02) !important;
    border-radius: 16px 16px 0 0;
}

[data-theme="dark"] .table-custom thead {
    background: rgba(255, 255, 255, 0.03) !important;
}

.table-custom tbody tr:hover {
    background: rgba(0, 0, 0, 0.01) !important;
}

[data-theme="dark"] .table-custom tbody tr:hover {
    background: rgba(255, 255, 255, 0.01) !important;
}

.table-custom .text-muted {
    color: var(--text-muted) !important;
    opacity: 0.9;
}

.rate-val {
    color: #00b894;
    font-weight: 800;
    font-size: 1.1rem;
}

.small-suffix {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 移动端卡片自适应折叠布局 (极高特异性重构，强力歼灭 Bootstrap 所有硬线与内边框阴影) */
@media (max-width: 768px) {
    thead {
        display: none !important;
    }

    /* 强力清洗手机端与Mini App最外层表格容器的重叠阴影与边线 */
    .table-responsive-custom,
    .table-responsive-custom.shadow-sm {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
    }

    .table-custom {
        border: none !important;
        background: transparent !important;
    }

    /* 强特异性选择器覆盖 tr，消除硬框线 */
    .table-custom tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: var(--bg-card) !important;
        margin-bottom: 16px !important;
        padding: 16px !important;
        border-radius: 16px !important;
        border: none !important; 
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02) !important; /* 极致呼吸微影 */
        transition: transform 0.2s ease !important;
    }

    [data-theme="dark"] .table-custom tbody tr {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important; /* 暗灰优雅悬浮投影 */
        border: 1px solid rgba(255, 255, 255, 0.02) !important; /* 极淡微光 */
    }

    .table-custom tbody tr:hover {
        transform: translateY(-2px) !important;
    }

    /* 强特异性重火力单元格清洗：完全剔除 border 边线与 Bootstrap 特有的 inset box-shadow 阴影分割线！ */
    .table-custom tbody tr td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        border: none !important; 
        box-shadow: none !important; /* 彻底清除 Bootstrap 顽固的内格线阴影！ */
        padding: 8px 0 !important;
        width: 100% !important;
        background: transparent !important;
    }

    .table-custom tbody tr td::before {
        content: attr(data-label) !important;
        font-weight: 700 !important;
        font-size: 11px !important;
        color: var(--text-muted) !important;
        text-align: left !important;
    }

    .table-custom tbody tr td:first-child::before {
        display: none !important;
    }

    /* 彻底拔除第一列商户名字下方的所有底部分割线与阴影 */
    .table-custom tbody tr td:first-child {
        justify-content: center !important;
        border-bottom: none !important; 
        box-shadow: none !important; 
        margin-bottom: 6px !important;
        padding-bottom: 12px !important;
    }
}

.tooltip-inner {
    background: rgba(30, 39, 46, 0.98) !important;
    padding: 15px !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
}

.tip-header {
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.tip-row {
    font-size: 12px;
    color: #eee;
    margin-bottom: 4px;
    text-align: left;
}

.tip-label {
    color: #888;
    width: 60px;
    display: inline-block;
}

/* 历史订单悬浮按钮与云查单面板 */
.float-order-btn {
    position: fixed;
    bottom: 35px;
    right: 25px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8e44ad 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(142, 68, 173, 0.35);
    cursor: pointer;
    z-index: 99999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.float-order-btn:hover {
    transform: scale(1.15) rotate(8deg);
    box-shadow: 0 12px 30px rgba(142, 68, 173, 0.55);
}

.float-order-btn svg {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
}

.float-order-btn span {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.modal-glass {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15) !important;
}

.order-item-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
    transition: all 0.25s ease;
}

[data-theme="dark"] .order-item-card {
    background: rgba(255, 255, 255, 0.02);
}

.order-item-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.03);
}


/* --- 5. 支付中心专属样式 (exchange.html) --- */
.checkout-card {
    max-width: 650px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: background-color 0.3s;
}

/* 支付顶部步骤进度条 */
.step-progress {
    display: flex;
    justify-content: space-between;
    background: linear-gradient(135deg, #2980b9 0%, #8e44ad 100%);
    padding: 30px 40px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 600;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.step.active {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.step-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.step.active .step-icon {
    background: #fff;
    color: #8e44ad;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.order-body {
    padding: 35px;
}

.rate-lock-box {
    background: rgba(231, 76, 60, 0.1);
    border-left: 4px solid #e74c3c;
    padding: 12px 20px;
    border-radius: 0 8px 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.timer {
    font-weight: 800;
    color: #e74c3c;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: rgba(0, 0, 0, 0.02);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 25px;
}

[data-theme="dark"] .info-grid {
    background: rgba(255, 255, 255, 0.02);
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted) !important;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.info-value {
    font-weight: 700;
    font-size: 1rem;
}

/* 收款面板与二维码 */
.pay-panel {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    transition: 0.3s;
}

.pay-panel:hover {
    border-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.02);
}

.qr-wrapper {
    width: 140px;
    height: 140px;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin: 0 auto 15px;
}

.qr-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.address-box {
    background: var(--bg-body);
    padding: 12px;
    border-radius: 8px;
    font-family: 'Consolas', monospace;
    font-size: 0.95rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    word-break: break-all;
    border: 1px solid var(--border-color);
}

.form-control {
    background: var(--bg-body) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    padding: 14px;
    border-radius: 12px;
    font-weight: 500;
}

.form-control:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1) !important;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted) !important;
}

.get-preview {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1) 0%, rgba(39, 174, 96, 0.05) 100%);
    border: 1px solid rgba(46, 204, 113, 0.3);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
}

.btn-submit {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
    transition: 0.3s;
    margin-top: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(52, 152, 219, 0.4);
}

.btn-submit:disabled {
    background: #95a5a6;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}
