/* ============================================================
   CATALOG — Listing + Detail + Viewer
   ============================================================ */

/* ===== SECTION TITLE ===== */
.catalog-section-header { text-align: center; margin-bottom: 40px }

.catalog-section-title {
    font-family: 'Mona Sans', sans-serif;
    font-weight: 700;
    font-size: 36px;
    line-height: 51px;
    color: #3C4142;
    margin: 8px 0 0
}

.catalog-section-title span { color: #02A3DB }

/* ===== GRID ===== */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px
}

/* ===== CARD ===== */
.catalog-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.06), 0 0 0 1px rgba(0,0,0,.04);
    transition: box-shadow .3s, transform .3s;
    color: #3C4142
}

.catalog-card:hover {
    box-shadow: 0 16px 40px rgba(2,163,219,.16), 0 0 0 1px rgba(2,163,219,.12);
    transform: translateY(-6px)
}

/* Thumbnail */
.catalog-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%)
}

.catalog-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease
}

.catalog-card:hover .catalog-card-thumb img { transform: scale(1.06) }

.catalog-card-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center
}

/* Overlay gradient */
.catalog-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.45) 100%);
    opacity: 0;
    transition: opacity .3s
}

.catalog-card:hover .catalog-card-overlay { opacity: 1 }

/* Badge PDF */
.catalog-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #02A3DB;
    color: #fff;
    font-family: 'Mona Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 4px;
    letter-spacing: .5px
}

/* Quick view button */
.catalog-card-quick {
    position: absolute;
    bottom: 16px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .3s, transform .3s
}

.catalog-card:hover .catalog-card-quick {
    opacity: 1;
    transform: translateY(0)
}

.catalog-card-quick span {
    background: rgba(255,255,255,.95);
    color: #02A3DB;
    font-family: 'Mona Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 20px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15)
}

/* Card info */
.catalog-card-info {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1
}

.catalog-card-title {
    font-family: 'Mona Sans', sans-serif;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.45;
    color: #1C1C1E;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.catalog-card-desc {
    font-family: 'Mona Sans', sans-serif;
    font-size: 13px;
    color: #6B7280;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6
}

.catalog-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'Mona Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #02A3DB;
    margin-top: auto
}

/* Empty state */
.catalog-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 80px 0;
    color: #9CA3AF
}

.catalog-empty p {
    font-size: 16px;
    margin: 0
}

.catalog-paging { text-align: center }

/* Owl carousel item wrapper */
.catalog-owl-item { padding: 4px 0 }

/* Control buttons */
.control-catalog button { background: rgba(0,0,0,.5) }
.control-catalog button:hover { background: var(--background-static) }

/* ===== DETAIL — HERO ===== */
.catalog-detail-hero {
    background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 100%);
    padding: 48px 0 40px;
    position: relative;
    overflow: hidden
}

.catalog-detail-hero::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: rgba(2,163,219,.15);
    pointer-events: none
}

.catalog-detail-hero::after {
    content: '';
    position: absolute;
    bottom: -40px; left: 10%;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(2,163,219,.08);
    pointer-events: none
}

.catalog-detail-meta { margin-bottom: 16px }

.catalog-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,.65);
    font-family: 'Mona Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color .2s
}

.catalog-detail-back:hover { color: #fff }

.catalog-detail-title {
    font-family: 'Mona Sans', sans-serif;
    font-weight: 700;
    font-size: 32px;
    line-height: 1.3;
    color: #fff;
    margin: 0 0 12px;
    position: relative;
    z-index: 1
}

.catalog-detail-desc {
    font-family: 'Mona Sans', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: rgba(255,255,255,.7);
    margin: 0;
    max-width: 680px;
    position: relative;
    z-index: 1
}

/* ===== VIEWER OUTER ===== */
.catalog-viewer-outer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 16px 0 40px
}

/* Loading */
.catalog-viewer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 80px 0;
    color: #6B7280
}

.catalog-viewer-loading p {
    font-family: 'Mona Sans', sans-serif;
    font-size: 15px;
    margin: 0
}

.catalog-spinner-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center
}

.catalog-spinner {
    position: absolute;
    inset: 0;
    border: 3px solid #E5E7EB;
    border-top-color: #02A3DB;
    border-radius: 50%;
    animation: cat-spin .9s linear infinite
}

@keyframes cat-spin { to { transform: rotate(360deg) } }

.dot-anim {
    display: inline-block;
    animation: dotPulse 1.4s steps(4,end) infinite
}

@keyframes dotPulse {
    0%,100% { opacity: 1 }
    50%      { opacity: .3 }
}

/* Book wrap */
.catalog-viewer-book-wrap {
    perspective: 3000px;
    display: flex;
    justify-content: center;
    position: relative;
    padding: 12px 0 24px
}

/* Khung sách — giả lập mép trang + gáy */
.catalog-book-frame {
    position: relative;
    display: inline-block;
    /* Mép trang chồng nhau ở 2 bên */
    box-shadow:
        -2px 0 0 #d4c4a8,
        -4px 0 0 #ddd3bb,
        -6px 0 0 #d4c4a8,
        -8px 1px 10px rgba(0,0,0,.28),
        2px 0 0 #d4c4a8,
        4px 0 0 #ddd3bb,
        6px 0 0 #d4c4a8,
        8px 1px 10px rgba(0,0,0,.28),
        0 24px 56px rgba(0,0,0,.45),
        0 8px 20px rgba(0,0,0,.25);
    border-radius: 2px
}

/* Gáy sách */
.catalog-book-spine {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    background: linear-gradient(90deg,
        rgba(0,0,0,.25) 0%,
        rgba(0,0,0,.08) 30%,
        rgba(255,255,255,.22) 50%,
        rgba(0,0,0,.08) 70%,
        rgba(0,0,0,.25) 100%
    );
    z-index: 9999;
    pointer-events: none
}

/* Ẩn các div edge cũ — dùng box-shadow thay */
.catalog-book-left-edge,
.catalog-book-right-edge { display: none }

.catalog-book { display: block }

.catalog-book .page {
    background: #fff;
    overflow: hidden
}

.catalog-book .page canvas {
    display: block;
    width: 100%;
    height: 100%
}

/* Controls bar */
.catalog-viewer-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1a2332;
    padding: 8px 16px;
    border-radius: 100px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25)
}

.catalog-ctrl-sep {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,.15);
    margin: 0 4px
}

.catalog-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.8);
    cursor: pointer;
    transition: background .2s, color .2s;
    text-decoration: none;
    flex-shrink: 0
}

.catalog-btn:hover {
    background: #02A3DB;
    color: #fff
}

.catalog-page-info {
    font-family: 'Mona Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.9);
    min-width: 72px;
    text-align: center
}

/* No PDF */
.catalog-no-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 80px 0;
    text-align: center;
    color: #9CA3AF
}

.catalog-no-pdf h3 {
    font-family: 'Mona Sans', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #6B7280;
    margin: 0
}

.catalog-no-pdf p {
    font-size: 15px;
    margin: 0
}

/* Download button (fallback) */
.catalog-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #02A3DB;
    color: #fff;
    font-family: 'Mona Sans', sans-serif;
    font-weight: 700;
    font-size: 15px;
    padding: 12px 28px;
    border-radius: 100px;
    text-decoration: none;
    transition: background .2s
}

.catalog-dl-btn:hover { background: #0190c3; color: #fff }

/* ===== RELATED ===== */
.catalog-related { margin-top: 64px }

.catalog-related-title {
    font-family: 'Mona Sans', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: #1C1C1E;
    margin: 0 0 28px;
    display: flex;
    align-items: center;
    gap: 14px
}

.catalog-related-title span {
    display: block;
    width: 4px;
    height: 28px;
    background: #02A3DB;
    border-radius: 2px;
    flex-shrink: 0
}

.catalog-grid-sm { grid-template-columns: repeat(4, 1fr) }

/* ===== RESPONSIVE ===== */
@media (max-width: 1199px) {
    .catalog-grid { grid-template-columns: repeat(3, 1fr) }
    .catalog-grid-sm { grid-template-columns: repeat(3, 1fr) }
    .catalog-section-title { font-size: 28px }
}

@media (max-width: 767px) {
    .catalog-grid, .catalog-grid-sm { grid-template-columns: repeat(2, 1fr); gap: 16px }
    .catalog-detail-title { font-size: 24px }
    .catalog-detail-hero { padding: 32px 0 24px }
    .catalog-section-title { font-size: 22px; line-height: 32px }
}

@media (max-width: 480px) {
    .catalog-grid, .catalog-grid-sm { grid-template-columns: 1fr }
}
