/* Infographic Cards CSS */

:root {
    --info-card-bg: #ffffff;
    --info-card-border: #e2e8f0;
    --info-card-radius: 16px;
    --info-primary: #4F46E5;
    --info-secondary: #06B6D4;
    --info-accent: #F59E0B;
}

.popular-books-section {
    padding: 60px 0;
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
}

.infographic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

/* Card Container */
.card-infographic-book {
    background: var(--info-card-bg);
    border-radius: var(--info-card-radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--info-card-border);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
}

.card-infographic-book:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--info-primary);
}

/* Top Section: Split Cover & Key Stat */
.info-card__top {
    display: flex;
    padding: 20px;
    gap: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.info-card__cover-wrapper {
    width: 100px;
    flex-shrink: 0;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.info-card__cover {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.info-card__ranking {
    position: absolute;
    top: -5px;
    left: 10px;
    background: var(--info-accent);
    color: white;
    width: 30px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.info-card__main-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-card__genre {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--info-primary);
    margin-bottom: 6px;
    font-weight: 700;
}

.info-card__title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 6px;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-card__author {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 12px;
}

/* Rating Badge */
.info-card__rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #FFFBEB;
    color: #B45309;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    width: fit-content;
}

/* Visualization Section */
.info-card__stats {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #FAFAFA;
}

/* Borrow Meter */
.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
}

.meter-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--info-secondary), var(--info-primary));
    position: relative;
}

/* Reader Avatars */
.reader-avatars {
    display: flex;
    align-items: center;
}

.reader-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid white;
    margin-left: -8px;
    object-fit: cover;
    background: #ddd;
}

.reader-avatar:first-child {
    margin-left: 0;
}

.reader-count {
    margin-left: 8px;
    font-size: 0.8rem;
    color: #64748b;
}

/* Action Area */
.info-card__action {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-available {
    color: #059669;
}

.status-available .status-dot {
    background: #059669;
}

.status-borrowed {
    color: #DC2626;
}

.status-borrowed .status-dot {
    background: #DC2626;
}

.btn-detail {
    text-decoration: none;
    color: var(--info-primary);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.2s;
}

.btn-detail:hover {
    gap: 8px;
}

/* === SIDEBAR LAYOUT (Added for Standardization) === */
.catalog-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    align-items: start;
}

@media (max-width: 900px) {
    .catalog-layout {
        grid-template-columns: 1fr;
    }
}

/* Main Content Column */
.catalog-main {
    min-width: 0;
    /* Prevent grid blowout */
}

/* Sidebar Column */
.catalog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
    position: sticky;
    top: 20px;
    /* Sticky sidebar */
}

/* Widget Styles */
.sidebar-widget {
    background: #ffffff;
    border: 1px solid var(--info-card-border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.sidebar-widget h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

/* Primary Color Widget (Red/Orange theme) */
.sidebar-widget--primary {
    background: var(--color-brand-primary);
    /* Uses global primary color */
    color: white;
    border: none;
}

.sidebar-widget--primary h4 {
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.sidebar-widget--primary p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

/* Popular List in Sidebar */
.widget-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mini-article {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.mini-article:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.mini-article:first-child {
    padding-top: 0;
}

.mini-rank {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--info-card-border);
    /* Subtle number color */
    margin-right: 16px;
    line-height: 1;
    min-width: 24px;
}

.mini-article a {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    line-height: 1.4;
    display: block;
    margin-bottom: 4px;
    transition: color 0.2s;
}

.mini-article a:hover {
    color: var(--info-primary);
}

.mini-meta {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}