/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 连接状态栏 */
.status-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ff9800;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background-color: #4caf50;
    animation: none;
}

.status-indicator.disconnected {
    background-color: #f44336;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* 主容器 */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    min-height: calc(100vh - 50px);
}

/* 消息容器 */
.messages-container {
    padding: 16px;
    padding-bottom: 80px; /* 为底部留出空间 */
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #999;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 消息列表 */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 消息卡片 */
.message-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.message-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.message-type {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.message-type.mempool {
    background-color: #e3f2fd;
    color: #1976d2;
}

.message-type.mouse {
    background-color: #fff3e0;
    color: #f57c00;
}

.message-time {
    font-size: 12px;
    color: #999;
}

.message-content {
    margin-bottom: 12px;
}

.message-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.message-details {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.message-detail-item {
    margin-bottom: 4px;
}

.message-detail-item strong {
    color: #333;
}

.message-detail-item.highlight {
    background-color: #f5f5f5;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.message-detail-item .amount-value {
    color: #2196f3;
    font-weight: 600;
    font-size: 16px;
}

.message-detail-item .address-value {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #666;
}

.message-detail-item .confidence-value {
    font-weight: 600;
    font-size: 16px;
}

.message-detail-item .confidence-value.high {
    color: #f44336;
}

.message-detail-item .confidence-value.medium {
    color: #ff9800;
}

.message-detail-item .confidence-value.low {
    color: #4caf50;
}

.addresses-list {
    margin-top: 8px;
}

.addresses-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.address-tag {
    display: inline-block;
    padding: 4px 8px;
    background-color: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.address-tag.more {
    background-color: #f5f5f5;
    color: #999;
}

/* 按钮组 */
.message-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.message-button {
    padding: 8px 16px;
    background-color: #2196f3;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.message-button:hover {
    background-color: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.message-button:active {
    background-color: #1565c0;
    transform: translateY(0);
}

.message-button:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .messages-container {
        padding: 12px;
        padding-bottom: 60px;
    }

    .message-card {
        padding: 12px;
    }

    .message-title {
        font-size: 15px;
    }

    .message-details {
        font-size: 13px;
    }

    .message-buttons {
        flex-direction: column;
    }

    .message-button {
        width: 100%;
        text-align: center;
    }
}

/* 小屏幕适配 */
@media (max-width: 480px) {
    .status-bar {
        padding: 10px 12px;
    }

    .status-text {
        font-size: 13px;
    }

    .messages-container {
        padding: 8px;
    }

    .message-card {
        padding: 10px;
        border-radius: 8px;
    }
}

/* 深色模式支持（Telegram 自动切换） */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1e1e1e;
        color: #e0e0e0;
    }

    .status-bar {
        background-color: #2d2d2d;
        border-bottom-color: #404040;
    }

    .status-text {
        color: #b0b0b0;
    }

    .message-card {
        background-color: #2d2d2d;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .message-title {
        color: #e0e0e0;
    }

    .message-details {
        color: #b0b0b0;
    }

    .message-detail-item strong {
        color: #e0e0e0;
    }

    .message-detail-item.highlight {
        background-color: #2d2d2d;
    }

    .message-detail-item .amount-value {
        color: #64b5f6;
    }

    .message-detail-item .address-value {
        color: #b0b0b0;
    }

    .address-tag {
        background-color: #1e3a5f;
        color: #64b5f6;
    }

    .address-tag.more {
        background-color: #2d2d2d;
        color: #999;
    }

    .loading {
        color: #b0b0b0;
    }

    .empty-state {
        color: #b0b0b0;
    }
}

