/* 自定义样式 */
body {
    background-color: #f8f9fa;
}

.card {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
}

/* 结果区域的卡片自适应宽度 */
#resultsContainer .card {
    width: 100%;
    display: block;
    min-width: 100%;
}

#resultsContainer .card-body {
    width: 100%;
    overflow: visible;
}

/* 添加非打印状态下的容器自适应样式 */
.container {
    width: auto;
    min-width: 100%;
    overflow-x: auto;
}

/* 宽屏幕展示优化 */
@media (min-width: 1200px) {
    .container {
        max-width: 95%;
        margin: 0 auto;
    }
    
    /* 宽屏幕下表格宽度自适应上层控件 */
    .table {
        width: 100% !important;
    }
    
    /* 确保在宽页面下卡片填满全宽 */
    #resultsContainer .card,
    #resultsContainer .card-body,
    .table-responsive {
        width: 100% !important;
    }
}

#resultsSection {
    width: auto;
    overflow-x: auto;
    display: block;
}

.table-responsive {
    /* 表格容器自适应，根据页面宽度的不同而调整 */
    max-height: none;
    max-width: none;
    overflow-x: auto;
    white-space: nowrap;
    width: auto;
    min-width: 100%;
    display: block;
}

.loading {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

.wallet-address-header {
    background-color: #e3f2fd;
    font-weight: bold;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #6c757d;
}

.error-message {
    color: #dc3545;
}

/* 表格中长文本省略显示 */
/* 移除文本截断样式，显示完整内容 */
.text-truncate-custom {
    /* 不再限制宽度和截断文本 */
    white-space: normal;
    overflow: visible;
}

/* 交易哈希行的样式 */
.hash-row {
    background-color: #f8f9fa;
    border-top: none !important;
    font-size: 0.85rem;
}

.hash-cell, .timestamp-cell {
    padding: 0.35rem 0.75rem !important;
    border-top: none !important;
    color: #6c757d;
}

.timestamp-cell {
    min-width: 150px;
    white-space: nowrap;
}

.timestamp-text {
    white-space: nowrap;
    color: #6c757d;
    font-size: 0.85rem;
}

.hash-label {
    font-weight: 500;
    margin-right: 0.5rem;
}

.hash-link {
    color: #007bff;
    word-break: break-all;
}

.hash-text {
    word-break: break-all;
}

/* 表格宽度自适应模式 */
.table {
    width: 100%;
    table-layout: auto;
}

/* 屏幕宽度不同时的表格宽度适配 */
@media (max-width: 768px) {
    /* 小屏幕下表格可以超出屏幕宽度 */
    .table {
        min-width: max-content !important; /* 确保表格宽度不会小于内容需要的宽度 */
        width: auto !important;
    }
    
    /* 容器适应表格宽度，允许水平滚动 */
    .container, 
    #resultsSection,
    #resultsContainer,
    #resultsContainer .card,
    #resultsContainer .card-body,
    .table-responsive {
        width: auto !important;
        max-width: none !important;
        overflow-x: auto !important;
    }

    /* 覆盖Bootstrap的响应式容器限制 */
    .container,
    .container-fluid {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }
}

@media (min-width: 769px) {
    .table {
        max-width: 100%;
    }
}

/* 设置单元格文字不换行 */
.table td, .table th {
    white-space: nowrap;
    overflow: visible;
}

/* 打印优化样式 */
@media print {
    /* 移除所有背景色 */
    .card, .card-header, .card-body, .hash-row, .wallet-address-header, 
    .table-striped tbody tr:nth-of-type(odd), .table th {
        background-color: transparent !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        box-shadow: none !important;
    }
    
    /* 表格边框加黑 */
    .table, .table th, .table td {
        border-color: #000 !important;
    }
    
    /* 调整字体大小 */
    .table {
        font-size: 9pt;
        border-collapse: collapse;
        margin-bottom: 10px !important;
    }
    
    /* 钱包地址表头用下划线代替背景色 */
    .wallet-address-header {
        border-bottom: 1px solid #000 !important;
        padding: 5px 10px !important;
        margin-bottom: 5px !important;
        font-size: 11pt;
    }
    
    /* 地址结果卡片之间的间距 */
    .card.mb-4 {
        margin-bottom: 10px !important;
        /* 移除强制不分页的设置 */
        page-break-inside: auto;
        border-bottom: 1px solid #ccc !important;
        padding-bottom: 8px !important;
    }
    
    /* 卡片和表格边距减小 */
    .card-body {
        padding: 0.5rem !important;
    }
    
    .card-header {
        padding: 0.5rem !important;
    }
    
    /* 确保表格行的高度最小 */
    .table td, .table th {
        padding: 2px 5px !important;
        line-height: 1.2 !important;
    }
    
    /* 交易哈希行的高度减少 */
    .hash-row {
        font-size: 8pt;
    }
    
    .hash-cell {
        padding: 1px 5px !important;
    }
    
    /* 文字颜色调整为黑色 */
    body, .card, .card-header, .card-body, .table, .hash-row {
        color: #000 !important;
    }
    
    /* 容器宽度 */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* 打印时表格宽度自适应内容 */
    .table {
        width: auto !important;
        min-width: 100% !important;
        table-layout: auto !important;
    }
    
    /* 打印时确保单元格内容不换行 */
    .table td, .table th {
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: initial !important;
    }
    
    /* 移除表格内容不分页的限制 */
    .table-responsive {
        page-break-inside: auto;
    }
    
    /* 调整空间使用 */
    #resultsContainer {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        display: block;
    }
    
    /* 整个结果区域自适应宽度 */
    #resultsSection {
        width: 100%;
        overflow-x: auto;
        white-space: normal;
    }
    
    /* 隐藏查询结果标题和返回按钮 */
    .d-flex.justify-content-between.align-items-center.mb-3 {
        margin-bottom: 5px !important;
    }
    
    h2 {
        font-size: 14pt !important;
        margin: 0 !important;
    }
}
