/* 捐赠页面容器样式 - 完整主题支持 */
.donation-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--donation-bg-color, var(--bg-color, #ffffff));
    color: var(--donation-text-color, var(--text-color, #2c3e50));
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 30px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    transition: all 0.3s ease;
}

/* 二维码区域 */
.qrcode-section {
    display: flex;
    justify-content: space-around;
    padding: 40px 20px;
    flex-wrap: wrap;
    gap: 30px;
    background: var(--donation-section-bg, var(--section-bg, linear-gradient(135deg, #f5f7fa 0%, #e4e8ed 100%)));
}

.qrcode-container {
    text-align: center;
    flex: 1;
    min-width: 280px;
}

.qrcode-title {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--donation-heading-color, var(--heading-color, #2c3e50));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.qrcode-box {
    background: var(--donation-card-bg, var(--card-bg, #ffffff));
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: inline-block;
    border: 1px solid var(--donation-border-color, var(--border-color, #e1e5eb));
}

.qrcode-image {
    width: 220px;
    height: 220px;
    object-fit: contain;
    border-radius: 8px;
}

.qrcode-placeholder {
    width: 220px;
    height: 220px;
    background-color: var(--donation-placeholder-bg, var(--placeholder-bg, #f8f9fa));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--donation-border-color, var(--border-color, #dee2e6));
    border-radius: 8px;
    margin: 0 auto;
    color: var(--donation-muted-color, var(--muted-color, #6c757d));
}

/* 捐赠说明区域 - 彻底修复高度自适应 */
.instructions {
    all: unset !important;
    display: block !important;
    box-sizing: border-box !important;
    
    /* 基础样式 */
    padding: 30px 40px !important;
    background-color: var(--donation-section-bg, #f8f9fa) !important;
    border-radius: 8px !important;
    margin: 20px !important;
    border-left: 4px solid var(--donation-accent-color, #3275FB) !important;
    color: var(--donation-text-color, #2c3e50) !important;
    
    /* 关键：确保高度完全自适应 */
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    
    /* 确保内容正常显示 */
    overflow: visible !important;
    position: static !important;
    float: none !important;
}

/* 重置说明区域内所有元素 */
.instructions * {
    all: unset !important;
    display: block !important;
    box-sizing: border-box !important;
    
    /* 基础文本样式 */
    color: inherit !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    
    /* 关键：确保所有子元素高度自适应 */
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* 重新定义段落样式 */
.instructions p {
    margin: 0 0 15px 0 !important;
    line-height: 1.6 !important;
    color: var(--donation-text-color, #2c3e50) !important;
}

.instructions p:last-child {
    margin-bottom: 0 !important;
}

/* 重新定义列表样式 */
.instructions ul, .instructions ol {
    margin: 0 0 15px 0 !important;
    padding-left: 20px !important;
}

.instructions li {
    margin-bottom: 8px !important;
    line-height: 1.5 !important;
    color: var(--donation-text-color, #2c3e50) !important;
}

/* 表格区域 */
.table-container {
    padding: 20px 20px 30px;
    overflow-x: auto;
}

.donation-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    background: var(--donation-card-bg, var(--card-bg, #ffffff));
    color: var(--donation-text-color, var(--text-color, #2c3e50));
}

.donation-table th, .donation-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--donation-border-color, var(--border-color, #e1e5eb));
    color: var(--donation-text-color, var(--text-color, #2c3e50));
    vertical-align: top; /* 确保内容顶部对齐 */
}

/* 表头文字不换行 - 在所有设备上 */
.donation-table th {
    white-space: nowrap;
    overflow: hidden;
    background-color: var(--donation-table-header-bg, var(--table-header-bg, #f1f5fd));
    color: var(--donation-heading-color, var(--heading-color, #2c3e50));
    font-weight: 600;
    position: sticky;
    top: 0;
}

/* 渠道列居中显示 */
.donation-table th:nth-child(4),
.donation-table td:nth-child(4) {
    text-align: center;
}

.donation-table tr:hover {
    background-color: var(--donation-hover-bg, var(--hover-bg, #f8fafd));
}

.donation-amount {
    font-weight: bold;
    color: var(--donation-amount-color, #e74c3c);
}

/* 渠道标签样式 - 透明背景 */
.donation-channel {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    min-width: 70px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--donation-text-color, var(--text-color, #2c3e50)) !important;
}

/* PC端表格列宽优化 */
@media (min-width: 769px) {
    .donation-table {
        table-layout: fixed; /* PC端使用固定布局 */
    }
    
    .donation-table th:nth-child(1),
    .donation-table td:nth-child(1) {
        width: 120px; /* 日期列 */
    }
    
    /* PC端名称列宽度增加1/3 - 从100px增加到133px */
    .donation-table th:nth-child(2),
    .donation-table td:nth-child(2) {
        width: 133px; /* 名称列 - 增加1/3 */
    }
    
    .donation-table th:nth-child(3),
    .donation-table td:nth-child(3) {
        width: 100px; /* 金额列 */
    }
    
    .donation-table th:nth-child(4),
    .donation-table td:nth-child(4) {
        width: 100px; /* 渠道列 */
    }
    
    .donation-table th:nth-child(5),
    .donation-table td:nth-child(5) {
        width: auto; /* 留言列自动填充剩余空间 */
    }
    
    /* PC端名称列样式 - 确保内容在列宽内完整显示 */
    .donation-table td:nth-child(2) {
        white-space: normal !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        line-height: 1.4 !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }
    
    /* PC端留言列样式 - 确保内容在列宽内完整显示 */
    .donation-table td:nth-child(5) {
        white-space: normal !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        line-height: 1.4 !important;
        overflow-wrap: break-word !important;
    }
}

/* 分页控件 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
    flex-wrap: wrap;
}

.page-button {
    padding: 8px 15px;
    background-color: var(--donation-accent-color, var(--accent-color, #4270F6));
    color: var(--button-text-color, #ffffff);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
}

.page-button:hover:not(.disabled) {
    background-color: var(--donation-accent-hover, var(--accent-hover, #3275FB));
    color: var(--button-text-color, #ffffff);
}

.page-button.disabled {
    background-color: var(--disabled-bg, #bdc3c7);
    cursor: not-allowed;
    color: var(--disabled-color, #7f8c8d);
}

.page-info {
    padding: 5px 15px;
    font-weight: 500;
    color: var(--donation-text-color, var(--text-color, #2c3e50));
}

/* 响应式设计 - 移动端 */
@media (max-width: 768px) {
    .qrcode-section {
        flex-direction: column;
        align-items: center;
        padding: 30px 15px;
    }
    
    .qrcode-container {
        width: 100%;
    }
    
    .instructions {
        padding: 20px !important;
        margin: 15px !important;
    }
    
    .table-container {
        padding: 0 15px 20px;
    }
    
    .donation-table {
        table-layout: fixed; /* 移动端也使用固定布局 */
        width: 100%;
        min-width: 600px; /* 确保表格有最小宽度 */
    }
    
    .donation-table th, .donation-table td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
    
    /* 移动端表头文字不换行 */
    .donation-table th {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* 移动端列宽设置 */
    .donation-table th:nth-child(1),
    .donation-table td:nth-child(1) {
        width: 80px; /* 日期列 */
    }
    
    .donation-table th:nth-child(2),
    .donation-table td:nth-child(2) {
        width: 70px; /* 名称列 - 保持现有宽度 */
    }
    
    .donation-table th:nth-child(3),
    .donation-table td:nth-child(3) {
        width: 70px; /* 金额列 */
    }
    
    .donation-table th:nth-child(4),
    .donation-table td:nth-child(4) {
        width: 70px; /* 渠道列 */
    }
    
    .donation-table th:nth-child(5),
    .donation-table td:nth-child(5) {
        width: auto; /* 留言列自动填充剩余空间 */
    }
    
    /* 移动端名称列样式 - 确保内容在列宽内完整显示 */
    .donation-table td:nth-child(2) {
        white-space: normal !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        line-height: 1.4 !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }
    
    /* 移动端留言列样式 - 确保内容在列宽内完整显示 */
    .donation-table td:nth-child(5) {
        white-space: normal !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        line-height: 1.4 !important;
        overflow-wrap: break-word !important;
        min-width: 150px; /* 确保留言列有最小宽度 */
    }
    
    .donation-channel {
        padding: 4px 8px;
        font-size: 0.8rem;
        min-width: 60px;
    }
    
    .pagination {
        flex-direction: column;
        gap: 8px;
    }
    
    .page-info {
        order: -1;
    }
}

@media (max-width: 480px) {
    .qrcode-title {
        font-size: 1.2rem;
    }
    
    .qrcode-image,
    .qrcode-placeholder {
        width: 180px;
        height: 180px;
    }
    
    .donation-table {
        font-size: 0.85rem;
        min-width: 500px; /* 在更小的屏幕上调整最小宽度 */
    }
    
    .donation-table th, .donation-table td {
        padding: 8px 5px;
    }
    
    /* 超小屏幕进一步调整列宽 */
    .donation-table th:nth-child(1),
    .donation-table td:nth-child(1) {
        width: 70px; /* 日期列 */
    }
    
    .donation-table th:nth-child(2),
    .donation-table td:nth-child(2) {
        width: 60px; /* 名称列 - 保持现有宽度 */
    }
    
    .donation-table th:nth-child(3),
    .donation-table td:nth-child(3) {
        width: 60px; /* 金额列 */
    }
    
    .donation-table th:nth-child(4),
    .donation-table td:nth-child(4) {
        width: 60px; /* 渠道列 */
    }
    
    .donation-table td:nth-child(5) {
        min-width: 120px; /* 留言列最小宽度 */
    }
    
    /* 超小屏幕名称列样式 - 确保内容在列宽内完整显示 */
    .donation-table td:nth-child(2) {
        white-space: normal !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        line-height: 1.4 !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }
    
    .donation-channel {
        padding: 3px 6px;
        font-size: 0.75rem;
        min-width: 50px;
    }
}

/* 删除系统级的暗黑模式检测，只保留主题类控制 */

/* 主题特定的黑暗模式类支持 */
body.dark-mode .donation-container,
body.dark .donation-container,
.theme-dark .donation-container,
[data-theme="dark"] .donation-container,
.dark .donation-container {
    --donation-bg-color: #1a1a1a;
    --donation-text-color: #e0e0e0;
    --donation-heading-color: #ffffff;
    --donation-section-bg: #2d2d2d;
    --donation-card-bg: #333333;
    --donation-border-color: #444444;
    --donation-table-header-bg: #2a2a2a;
    --donation-hover-bg: #3a3a3a;
    --donation-accent-color: #4270F6;
    --donation-accent-hover: #3b8fd1;
    --donation-placeholder-bg: #2a2a2a;
    --donation-muted-color: #888888;
    --donation-amount-color: #ff6b6b;
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --heading-color: #ffffff;
    --section-bg: #2d2d2d;
    --card-bg: #333333;
    --border-color: #444444;
    --table-header-bg: #2a2a2a;
    --hover-bg: #3a3a3a;
    --accent-color: #4a9fe3;
    --accent-hover: #3b8fd1;
    --placeholder-bg: #2a2a2a;
    --muted-color: #888888;
    --button-text-color: #ffffff;
    --disabled-bg: #555555;
    --disabled-color: #999999;
}
