/* app/static/css/statistics.css */
:root {
    /* Soft & Elegant Palette */
    --color-primary-light-pink: #FCE4EC; /* 淡粉色 */
    --color-primary-milk-white: #FFF8F0; /* 奶白色 */
    --color-primary-apricot: #FFDAB9;    /* 浅杏色 */

    --color-aux-rose-gold: #B76E79;     /* 玫瑰金 */
    --color-aux-light-purple: #E6E6FA;  /* 淡紫色 */
    --color-aux-soft-gray: #D3D3D3;     /* 柔和的灰色 */

    --color-accent-berry-red: #8C2D5A;   /* 深一点的浆果红 */

    --font-serif-elegant: 'Playfair Display', serif;
    --font-serif-lora: 'Lora', serif;
    --font-sans-clean: 'Open Sans', sans-serif;
    --font-script-delicate: 'Sacramento', cursive;
    --font-serif-garamond: 'EB Garamond', serif;

    /* Derived/General Usage */
    --background-main: var(--color-primary-milk-white);
    --background-container: #FFFFFF;
    --text-main: #5D5053; /* A darker, softer, slightly desaturated rose-brown */
    --text-soft: #8A797C;
    --text-heading: var(--color-aux-rose-gold);
    --text-accent: var(--color-accent-berry-red);
    --border-soft: var(--color-aux-soft-gray);
    --border-decorative: var(--color-primary-light-pink);
    --shadow-soft: rgba(183, 110, 121, 0.1); /* Soft shadow based on rose gold */
    --shadow-subtle: rgba(0, 0, 0, 0.05);

    /* Fallback for old variables - some might still be used by unchanged CSS */
    --primary-color: var(--color-primary-light-pink);
    --secondary-color: var(--color-primary-apricot); /* Or #FFF8F0 for a lighter secondary */
    --accent-color: var(--color-aux-rose-gold);
    --text-color: var(--text-main);
    --light-text: var(--text-soft);
    --border-color: var(--border-soft);
    --shadow-color: var(--shadow-soft);
    --hover-color: #F8E0E6; /* Lighter pink for hover */
}

body {
    background-color: var(--background-main);
    color: var(--text-main);
    font-family: var(--font-sans-clean);
    font-weight: 300; /* Lighter default font weight */
    line-height: 1.7; /* Increased line height */
}

.statistics-container {
    padding: 40px 30px; /* Increased padding */
    max-width: 1100px; /* Slightly adjusted max-width */
    margin: 40px auto; /* More margin for breathing room */
    background-color: var(--background-container);
    border-radius: 16px; /* Softer, larger border-radius */
    box-shadow: 0 8px 25px var(--shadow-soft); /* Softer shadow */
    position: relative;
    overflow: hidden;
}

.page-title {
    color: var(--text-heading);
    margin-bottom: 35px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-decorative); /* Thinner, delicate line */
    text-align: center;
    font-family: var(--font-serif-elegant);
    font-size: 2.8em; /* Larger, more prominent */
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Simplified page title decoration */
.page-title:after {
    content: '';
    display: block;
    width: 80px; /* Shorter line */
    height: 2px; /* Thinner line */
    margin: 12px auto 0;
    background: var(--color-aux-rose-gold); /* Solid accent color */
    border-radius: 2px;
    /* animation: wave 3s infinite linear; Removed wave animation for elegance */
}

/* @keyframes wave {
    0%, 100% { background-position-x: 0%; }
    50% { background-position-x: 100%; }
} */

/* Quote Banner - Styled for elegance */
.quote-banner {
    background-color: var(--color-primary-light-pink); /* Soft pink background */
    border-radius: 12px; /* Softer radius */
    padding: 25px 35px; /* Ample padding */
    margin: 0 auto 40px; /* Increased bottom margin */
    max-width: 75%;
    text-align: center;
    box-shadow: 0 4px 15px rgba(183, 110, 121, 0.08); /* Very subtle shadow */
    border-left: 3px solid var(--color-aux-rose-gold);
    border-right: 3px solid var(--color-aux-rose-gold);
    position: relative;
}

.quote-banner p {
    font-family: var(--font-serif-garamond), serif; /* Elegant serif for quote */
    font-style: italic;
    color: var(--color-accent-berry-red); /* Berry red for emphasis */
    font-size: 1.1em; /* Slightly larger */
    margin: 0;
    letter-spacing: 0.2px;
    line-height: 1.6;
}

.quote-banner:before,
.quote-banner:after {
    content: """; /* Using """ for opening */
    font-family: var(--font-serif-elegant), serif; /* Consistent elegant font */
    font-size: 50px; /* Adjusted size */
    color: var(--color-aux-rose-gold); /* Rose gold for quotes */
    opacity: 0.4; /* Softer opacity */
    position: absolute;
    top: 0px;
}

.quote-banner:before {
    left: 15px;
}

.quote-banner:after {
    content: """; /* Using """ for closing */
    right: 15px;
    top: auto; /* Adjust position for closing quote mark */
    bottom: -20px;
}

/* Stats Grid - main navigation cards container */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 30px; /* Increased gap for more whitespace */
    margin: 40px auto; /* Adjusted margin */
    max-width: 900px; /* Adjusted max-width */
}

.stats-grid .stats-card {
    position: relative;
    background-color: var(--background-container);
    border-radius: 12px; /* Softer radius */
    overflow: hidden;
    box-shadow: 0 6px 18px var(--shadow-subtle); /* More subtle shadow */
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid #F0E8E9; /* Very light, almost invisible border */
    min-height: 260px; /* Ensure cards have enough height */
    padding: 0;
}

.card-inner { /* This class is directly inside stats-card links */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 25px; /* Ample padding */
    height: 100%;
    position: relative;
    z-index: 2;
    background: transparent; /* Make it transparent to show card background */
    transition: background-color 0.3s ease;
}

.stats-grid .stats-card:hover {
    transform: translateY(-6px); /* Slightly less aggressive transform */
    box-shadow: 0 10px 25px var(--shadow-soft); /* Enhanced shadow on hover */
    border-color: var(--color-primary-light-pink);
}
.stats-grid .stats-card:hover .card-inner {
    /* background: rgba(255, 248, 240, 0.5); */ /* Optional: very subtle hover background on inner part */
}


.stats-grid .card-icon {
    font-size: 36px; /* Slightly smaller icon */
    margin-bottom: 18px;
    color: var(--color-aux-rose-gold);
    background-color: var(--color-primary-milk-white); /* Milk white for icon background */
    width: 70px; /* Adjusted size */
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(183, 110, 121, 0.15); /* Subtle shadow for icon */
    transition: transform 0.3s ease, color 0.3s ease;
}

.stats-grid .stats-card:hover .card-icon {
    transform: scale(1.08) rotate(3deg);
    color: var(--color-accent-berry-red); /* Icon color change on hover */
}

.stats-grid .card-title {
    font-family: var(--font-serif-lora);
    font-size: 1.45em; /* Adjusted size */
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-heading);
    position: relative;
    display: inline-block;
}

.stats-grid .card-title:after { /* Decorative line under card title */
    content: '';
    position: absolute;
    bottom: -6px; /* Positioned slightly below */
    left: 50%;
    transform: translateX(-50%) scaleX(0); /* Start scaled to 0 */
    width: 60%; /* Line width relative to title */
    height: 1.5px;
    background-color: var(--color-primary-light-pink); /* Light pink line */
    transition: transform 0.35s ease-out;
    transform-origin: center;
}

.stats-grid .stats-card:hover .card-title:after {
    transform: translateX(-50%) scaleX(1); /* Scale to full on hover */
}

.stats-grid .card-description {
    font-family: var(--font-sans-clean);
    font-size: 0.9em;
    color: var(--text-soft);
    line-height: 1.5;
    max-width: 90%; /* Prevent text from touching edges */
}


/* Card Decoration - Subtle background elements */
.card-decoration {
    position: absolute;
    bottom: -40px; /* Adjusted position */
    right: -40px;
    width: 120px; /* Smaller decoration */
    height: 120px;
    border-radius: 50%;
    background-color: var(--color-primary-light-pink); /* Light pink base */
    opacity: 0.15; /* More subtle opacity */
    transition: all 0.5s ease;
    z-index: 1;
}

.stats-card:hover .card-decoration { /* Use stats-card hover for decoration */
    transform: scale(1.4);
    opacity: 0.25;
}

/* Specific card decorations with more subtle emoji styling */
.card-decoration:before { /* General style for emoji if used */
    position: absolute;
    font-size: 24px; /* Smaller emoji */
    top: 50%; /* Centered better */
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.3; /* Very subtle */
    color: var(--color-aux-rose-gold); /* Themed color */
}

.book-decoration:before    { content: '📚'; }
.trend-decoration:before   { content: '📈'; }
.user-decoration:before    { content: '👥'; }
.overdue-decoration:before { content: '⏰'; }


/* Page Decoration - Floating elements */
.page-decoration {
    position: absolute;
    width: 180px; /* Slightly smaller */
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--color-primary-apricot), var(--color-aux-light-purple), var(--color-primary-light-pink)); /* New gradient */
    opacity: 0.15; /* More subtle */
    z-index: -1; /* Ensure it's behind content */
}

.page-decoration.left {
    top: -80px; /* Adjusted position */
    left: -80px;
    animation: floatLeft 18s ease-in-out infinite;
}

.page-decoration.right {
    bottom: -80px;
    right: -80px;
    animation: floatRight 20s ease-in-out infinite;
}

@keyframes floatLeft {
    0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
    25% { transform: translate(15px, 20px) rotate(8deg) scale(1.05); }
    50% { transform: translate(5px, 35px) rotate(15deg) scale(1); }
    75% { transform: translate(25px, 10px) rotate(5deg) scale(1.05); }
}

@keyframes floatRight {
    0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
    25% { transform: translate(-15px, -18px) rotate(-7deg) scale(1.05); }
    50% { transform: translate(-10px, -30px) rotate(-12deg) scale(1); }
    75% { transform: translate(-22px, -12px) rotate(-6deg) scale(1.05); }
}


/* --- Unchanged CSS from this point onwards as per request for elements not in index.html --- */
/* --- (Or elements whose styling should largely be preserved unless overridden by above general styles) --- */

.breadcrumb {
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--light-text); /* Will use new --light-text */
}

.breadcrumb a {
    color: var(--accent-color); /* Will use new --accent-color */
    text-decoration: none;
    transition: all 0.3s ease;
}

.breadcrumb a:hover {
    text-decoration: underline;
    color: var(--color-accent-berry-red); /* More specific hover */
}

.breadcrumb .current-page {
    color: var(--text-color); /* Will use new --text-color */
    font-weight: 500;
}

/* 原始卡片菜单 - Unchanged as it's not used in the provided HTML */
.stats-menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* 原始卡片样式 - This .stats-card is different from .stats-grid .stats-card. Keeping for other pages. */
/* However, some properties might be inherited if not specific enough. */
/* Adding a more specific selector to avoid conflict if this old style is needed elsewhere */
.stats-menu > .stats-card {
    background-color: var(--secondary-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stats-menu > .stats-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 8px 20px var(--shadow-color);
    border-color: var(--primary-color);
}

/* Card icon/title/description for .stats-menu > .stats-card */
.stats-menu > .stats-card .card-icon {
    font-size: 40px;
    margin-bottom: 15px;
    color: var(--accent-color);
    /* Resetting some properties from .stats-grid .card-icon if they conflict */
    background-color: transparent;
    width: auto;
    height: auto;
    box-shadow: none;
}

.stats-menu > .stats-card .card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    font-family: var(--font-sans-clean); /* Keep it simple for this version */
    color: var(--text-color); /* Default text color for these */
}
.stats-menu > .stats-card .card-title:after {
    display: none; /* No line for this version */
}


.stats-menu > .stats-card .card-description {
    font-size: 14px;
    color: var(--light-text);
    font-family: var(--font-sans-clean);
}


.filter-section {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    background-color: var(--color-primary-milk-white); /* Updated bg */
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px dashed var(--border-decorative); /* Updated border */
}

.filter-label {
    font-weight: 500;
    margin-right: 10px;
    color: var(--text-main); /* Updated text */
}

.filter-select {
    padding: 8px 15px;
    border: 1px solid var(--border-soft); /* Updated border */
    border-radius: 8px; /* Softer radius */
    background-color: white;
    color: var(--text-main);
    font-size: 0.95em;
    font-family: var(--font-sans-clean);
    transition: border-color 0.3s, box-shadow 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B76E79' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); /* Updated arrow color */
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-aux-rose-gold); /* Updated focus color */
    box-shadow: 0 0 0 3px rgba(183, 110, 121, 0.2); /* Updated focus shadow */
}

.ml-20 {
    margin-left: 20px;
}

.chart-container {
    background-color: white;
    border-radius: 12px; /* Softer radius */
    padding: 25px;
    box-shadow: 0 4px 15px var(--shadow-soft); /* Updated shadow */
    margin-bottom: 35px;
    position: relative;
    height: 400px;
    border: 1px solid var(--border-decorative); /* Updated border */
    overflow: hidden;
}

.chart-container canvas {
    max-height: 100%;
    z-index: 1;
    position: relative;
}

.chart-decoration { /* These are for charts, distinct from page/card decorations */
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--color-primary-light-pink), var(--color-primary-apricot)); /* Updated gradient */
    opacity: 0.4; /* Softer opacity */
    z-index: 0;
}

.chart-decoration.left {
    top: -15px;
    left: -15px;
}

.chart-decoration.right {
    bottom: -15px;
    right: -15px;
}

.floating {
    animation: floating 6s ease-in-out infinite;
}

@keyframes floating {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(8px, 8px) scale(1.05); } /* Softer float */
    100% { transform: translate(0, 0) scale(1); }
}

.chart-container.half {
    height: auto;
    min-height: 400px;
    padding-bottom: 40px;
}

.chart-container.half .chart-wrapper {
    height: 340px;
    padding-bottom: 20px;
}

canvas#category-chart {
    max-height: 100%;
    margin-bottom: 20px;
    padding-bottom: 20px;
    position: relative;
}
.chart-container.half::before,
.chart-container.half::after {
    width: 40px;
    height: 40px;
    opacity: 0.2; /* Softer opacity */
}
.chart-container.half .chart-wrapper {
    position: relative;
}


.chart-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.half {
    flex: 1 1 calc(50% - 10px);
    min-width: 300px;
}

/* 表格容器样式 */
.table-container {
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-subtle);
}
.data-table {
    width: 100%;
    border-collapse: collapse; /* 修改为collapse以解决边框问题 */
    border-spacing: 0;
    border-radius: 10px; /* 保持圆角 */
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-subtle); /* 保持阴影 */
    font-family: var(--font-sans-clean); /* 确保一致字体 */
}

.data-table th, .data-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-decorative); /* 保持底部边框 */
    vertical-align: middle; /* 确保所有内容垂直居中 */
    box-sizing: border-box; /* 确保边框计算在单元格尺寸内 */
}

.data-table td {
    font-size: 0.95em;
}

.data-table th {
    background-color: var(--color-primary-light-pink); /* Lighter pink for header */
    font-weight: 600; /* Was 600, can be 400 for softer look */
    color: var(--text-heading); /* Rose gold text for header */
    letter-spacing: 0.5px;
    font-size: 1em;
    border-bottom: 2px solid var(--color-aux-rose-gold);
}

.data-table tr {
    transition: background-color 0.3s;
}

.data-table tr:nth-child(even) {
    background-color: var(--color-primary-milk-white); /* Milk white for even rows */
}

.data-table tr:nth-child(odd) {
    background-color: white;
}
.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: #FEF6F8; /* Very light pink on hover */
}

/* 表格特定列的样式 */
.data-table th:first-child,
.data-table td:first-child {
    text-align: center; /* 排名居中 */
    position: relative; /* 确保相对定位 */
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    text-align: center; /* 封面图片居中 */
}

.data-table th:last-child,
.data-table td:last-child {
    text-align: center; /* 借阅次数居中显示 */
}

.loading-row td {
    text-align: center;
    padding: 30px;
    color: var(--text-soft); /* Updated text color */
}

.loading-animation {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-animation:before {
    content: '📖';
    margin-right: 10px;
    animation: bookFlip 2s infinite;
    display: inline-block;
    color: var(--color-aux-rose-gold); /* Themed color */
}

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

.dot-animation {
    display: inline-block;
    animation: dotAnimation 1.5s infinite;
}

@keyframes dotAnimation {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

.stats-cards { /* This is for the small summary cards, different from .stats-grid */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

/* Style for .stats-cards > .stats-card if they exist */
.stats-cards > .stats-card {
    background-color: var(--background-container);
    border: 1px solid var(--border-decorative);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 10px var(--shadow-subtle);
    text-align: center;
}

.stats-cards .stats-card .card-value { /* Assuming .card-value is inside these cards */
    font-size: 2em; /* Adjusted size */
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-accent-berry-red); /* Berry red for value */
    font-family: var(--font-serif-elegant);
}
.stats-cards .stats-card .card-title { /* Title within these small cards */
    font-family: var(--font-sans-clean);
    font-size: 0.95em;
    color: var(--text-soft);
    font-weight: 400;
}
.stats-cards .stats-card .card-icon { /* Icon within these small cards */
    font-size: 1.8em;
    color: var(--color-aux-rose-gold);
    margin-bottom: 10px;
}


/* Quote Container - Appears distinct from .quote-banner, kept for other pages */
.quote-container {
    text-align: center;
    margin: 40px auto 20px;
    max-width: 600px;
    font-style: italic;
    color: var(--text-main); /* Updated text */
    padding: 20px;
    background-color: var(--color-primary-apricot); /* Apricot background */
    border-radius: 12px; /* Softer radius */
    position: relative;
    font-family: var(--font-serif-garamond);
    box-shadow: 0 3px 10px var(--shadow-subtle);
}

.quote-container:before,
.quote-container:after {
    content: """;
    font-size: 50px;
    font-family: var(--font-serif-elegant);
    position: absolute;
    color: var(--color-aux-rose-gold); /* Rose gold quotes */
    opacity: 0.3; /* Softer */
}

.quote-container:before {
    top: -5px;
    left: 10px;
}

.quote-container:after {
    content: """;
    bottom: -25px;
    right: 10px;
}

.quote-container p {
    position: relative;
    z-index: 1;
    margin-bottom: 10px;
    font-size: 1.05em; /* Adjusted */
    line-height: 1.6;
}

.quote-author {
    display: block;
    font-size: 0.9em;
    font-style: normal;
    text-align: right;
    color: var(--text-soft); /* Updated text */
    font-family: var(--font-sans-clean);
}

/* Book list title - for table pages */
.book-list-title {
    text-align: center;
    margin-bottom: 25px;
    color: var(--text-heading); /* Rose gold */
    font-family: var(--font-serif-lora); /* Lora for this title */
    font-size: 1.8em; /* Adjusted */
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 20px;
}

.book-icon { /* General book icon if used with this title */
    font-size: 0.9em;
    margin: 0 8px;
    opacity: 0.85;
    color: var(--color-aux-rose-gold);
}

.column-icon {
    font-size: 0.9em;
    margin-right: 5px;
    opacity: 0.8;
    color: var(--color-aux-rose-gold);
}

.book-list-title:before,
.book-list-title:after {
    content: '';
    position: absolute;
    height: 1.5px; /* Thinner line */
    background: linear-gradient(to right, transparent, var(--color-primary-light-pink), transparent); /* Softer gradient */
    width: 70px;
    top: 50%;
}

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

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

/* 表格中的图标样式 */
.data-table .borrow-count {
    font-weight: 600;
    color: var(--text-heading);
    position: relative;
    display: block; /* 修改为block以占据整个单元格 */
    text-align: center; /* 确保文本居中 */
    font-size: 1em;
}

.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;
    color: var(--color-aux-rose-gold);
}

.data-table tr:hover .borrow-count:after {
    opacity: 0.7; /* Softer opacity */
    transform: translateY(0);
}

/* 排名列样式 */
.data-table .rank {
    font-weight: 700;
    text-align: center;
    position: relative;
    font-size: 1.1em;
    color: var(--text-heading);
    font-family: var(--font-serif-lora);
    padding: 5px 15px; /* 基本内边距 */
}

/* 前三名奖牌样式 */
.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;
    font-size: 1.2em;
    left: 5px; /* 左侧位置 */
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.85;
}

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

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

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

/* 确保所有排名单元格的对齐一致 */
.data-table td:first-child {
    text-align: center;
}


.book-title { /* In data tables */
    position: relative;
    text-decoration: none;
    display: inline-block;
    font-weight: 600; /* Bolder for emphasis */
    color: var(--text-accent); /* Berry red for book titles */
    transition: color 0.3s;
}
.data-table tr:hover .book-title {
    color: var(--color-aux-rose-gold); /* Rose gold on hover */
}

.book-title:after { /* Underline effect for book titles in tables */
    content: '';
    position: absolute;
    width: 100%;
    height: 1.5px;
    bottom: -3px;
    left: 0;
    background-color: var(--color-primary-light-pink); /* Light pink underline */
    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;
}

/* Data table image styling */
.data-table img {
    width: 50px; /* Slightly smaller */
    height: 75px;
    object-fit: cover;
    border-radius: 6px; /* Softer radius */
    box-shadow: 0 2px 6px rgba(0,0,0,0.08); /* Softer shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid white;
}

.data-table tr:hover img {
    transform: scale(1.1); /* Slightly more pop */
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    border-color: var(--color-primary-light-pink); /* Pink border on hover */
}

.data-table .author {
    font-style: italic;
    color: var(--text-soft); /* Softer text for author */
    font-size: 0.9em;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-soft);
    background-color: var(--color-primary-milk-white); /* Milk white background */
    border-radius: 12px;
    font-style: italic;
    border: 1px dashed var(--border-decorative); /* Decorative dashed border */
    font-family: var(--font-serif-garamond);
}

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

#ranking-table-body tr:hover {
    transform: translateX(3px); /* Subtle shift */
}


/* Animation shared */
.fade-in { /* This is a custom class, not from animate.css */
    animation: customFadeIn 0.6s ease forwards; /* Renamed to avoid conflict */
    opacity: 0;
    transform: translateY(15px); /* Slightly more travel */
}

@keyframes customFadeIn { /* Renamed */
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 992px) { /* Adjusted breakpoint */
    .stats-grid {
        max-width: 95%;
        gap: 20px; /* Smaller gap on medium screens */
    }
    .stats-grid .stats-card {
        min-height: 240px;
    }
    .page-title {
        font-size: 2.4em;
    }
    .quote-banner {
        max-width: 85%;
    }
}


@media (max-width: 768px) {
    .statistics-container {
        padding: 30px 20px;
        margin: 20px auto;
    }
    .page-title {
        font-size: 2em;
    }
    .quote-banner {
        max-width: 90%;
        padding: 20px;
    }
    .quote-banner:before,
    .quote-banner:after {
        font-size: 35px;
    }
     .quote-banner:after {
        bottom: -15px;
    }

    .stats-grid {
        grid-template-columns: 1fr; /* Single column for cards */
        gap: 25px;
        max-width: 450px; /* Max width for single column */
    }

    .stats-grid .stats-card {
        min-height: auto; /* Auto height for single column */
        height: auto; /* Ensure this is not fixed */
        padding-bottom: 20px; /* Ensure padding for content */
    }
     .stats-grid .card-inner {
        padding: 20px;
    }


    .chart-row {
        flex-direction: column;
    }

    .half {
        width: 100%;
        flex-basis: 100%; /* Ensure it takes full width */
    }

    .stats-cards { /* Small summary cards */
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .filter-section {
        flex-wrap: wrap;
        padding: 10px 15px;
    }
    .filter-select {
        width: 100%;
    }

    .ml-20 {
        margin-left: 0;
        margin-top: 10px;
    }

    .page-decoration { /* Make page decorations smaller or hide on mobile */
        width: 120px;
        height: 120px;
        opacity: 0.1;
    }
    .page-decoration.left {
        top: -60px;
        left: -60px;
    }
    .page-decoration.right {
        bottom: -60px;
        right: -60px;
    }
    .data-table th, .data-table td {
        padding: 10px 12px;
        font-size: 0.9em;
    }
    .data-table img {
        width: 40px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.8em;
    }
    .quote-banner p {
        font-size: 1em;
    }
    .stats-grid .card-title {
        font-size: 1.3em;
    }
    .stats-grid .card-description {
        font-size: 0.85em;
    }
    .stats-grid .card-icon {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }
    .statistics-container {
        margin: 15px auto;
        padding: 20px 15px;
    }
    .page-decoration {
        display: none; /* Hide complex decorations on very small screens */
    }

    /* 移动端表格调整 */
    .data-table .rank:before {
        left: -5px; /* 小屏幕上减少偏移量 */
        font-size: 1.2em;
    }
    .data-table .rank {
        padding: 5px 8px; /* 减少内边距 */
    }
}
