/* app/static/css/book_ranking.css */
.table-container {
    margin-top: 30px;
}

.table-container h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--accent-color);
    font-family: 'Ma Shan Zheng', cursive, Arial, sans-serif;
    font-size: 1.6em;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.table-container h3:before,
.table-container h3:after {
    content: '';
    position: absolute;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--primary-color), transparent);
    width: 120px;
    top: 50%;
}

.table-container h3:before {
    right: 100%;
    margin-right: 15px;
}

.table-container h3:after {
    left: 100%;
    margin-left: 15px;
}

.data-table img {
    width: 55px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid white;
}

.data-table tr:hover img {
    transform: scale(1.08);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.data-table .rank {
    font-weight: 700;
    text-align: center;
    position: relative;
}

/* 前三名特殊样式 */
.data-table tr:nth-child(1) .rank:before {
    content: '👑';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
}

.data-table tr:nth-child(2) .rank:before {
    content: '✨';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
}

.data-table tr:nth-child(3) .rank:before {
    content: '🌟';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
}

.data-table .book-title {
    font-weight: 500;
    color: var(--accent-color);
    transition: color 0.3s;
}

.data-table tr:hover .book-title {
    color: #d06b9c;
}

.data-table .author {
    font-style: italic;
    color: var(--light-text);
}

.data-table .borrow-count {
    font-weight: 600;
    color: var(--accent-color);
    position: relative;
    display: block; /* 修改为block以占据整个单元格 */
    text-align: center; /* 确保文本居中 */
}

.data-table .borrow-count:after {
    content: '❤️';
    font-size: 12px;
    margin-left: 5px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(5px);
    display: inline-block;
}

.data-table tr:hover .borrow-count:after {
    opacity: 1;
    transform: translateY(0);
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--light-text);
    background-color: var(--secondary-color);
    border-radius: 12px;
    font-style: italic;
    border: 1px dashed var(--border-color);
}

/* 书籍行动画 */
#ranking-table-body tr {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#ranking-table-body tr:hover {
    transform: translateX(5px);
}

/* 加载动画美化 */
.loading-row td {
    background-color: var(--secondary-color);
    color: var(--accent-color);
    font-size: 16px;
}

/* 书名悬停效果 */
.book-title {
    position: relative;
    text-decoration: none;
    display: inline-block;
}

.book-title:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

tr:hover .book-title:after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* 特殊效果：波浪下划线 */
@keyframes wave {
    0%, 100% { background-position-x: 0%; }
    50% { background-position-x: 100%; }
}

.page-title:after {
    content: '';
    display: block;
    width: 100px;
    height: 5px;
    margin: 10px auto 0;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--primary-color));
    background-size: 200% 100%;
    border-radius: 5px;
    animation: wave 3s infinite linear;
}

.book-list-title {
    text-align: center;
    margin-bottom: 25px;
    color: var(--accent-color);
    font-family: 'Ma Shan Zheng', cursive, Arial, sans-serif;
    font-size: 1.6em;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 15px;
}

.book-icon {
    font-size: 0.9em;
    margin: 0 8px;
    opacity: 0.85;
}

.column-icon {
    font-size: 0.9em;
    margin-right: 5px;
    opacity: 0.8;
}

.book-list-title:before,
.book-list-title:after {
    content: '';
    position: absolute;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--primary-color), transparent);
    width: 80px;
    top: 50%;
}

.book-list-title:before {
    right: 100%;
    margin-right: 15px;
}

.book-list-title:after {
    left: 100%;
    margin-left: 15px;
}

/* 表格中的图标样式 */
.data-table .borrow-count:after {
    content: '📚';
    font-size: 12px;
    margin-left: 5px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(5px);
    display: inline-block;
}

/* 前三名特殊样式 - 替换这部分代码 */
.data-table tr:nth-child(1) .rank:before,
.data-table tr:nth-child(2) .rank:before,
.data-table tr:nth-child(3) .rank:before {
    position: absolute;
    left: 10px; /* 调整到数字左侧 */
    top: 50%; /* 垂直居中 */
    transform: translateY(-50%); /* 保持垂直居中 */
    opacity: 0.9;
}

/* 分别设置每个奖牌的内容 */
.data-table tr:nth-child(1) .rank:before {
    content: '🏆';
    font-size: 18px;
}

.data-table tr:nth-child(2) .rank:before {
    content: '🥈';
    font-size: 16px;
}

.data-table tr:nth-child(3) .rank:before {
    content: '🥉';
    font-size: 16px;
}

/* 调整排名单元格的内边距，为图标留出空间 */
.data-table .rank {
    padding-left: 35px; /* 增加左内边距为图标腾出空间 */
    text-align: left; /* 使数字左对齐 */
}


/* 加载动画美化 */
.loading-animation {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-animation:before {
    content: '📖';
    margin-right: 10px;
    animation: bookFlip 2s infinite;
    display: inline-block;
}

@keyframes bookFlip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
    100% { transform: rotateY(360deg); }
}
