/* assets/css/details.css - Modern Book Detail Showcase Styling */

/* ========================================================
   BOOK HERO BACKDROP
   ======================================================== */
.book-hero {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    padding: 3.5rem 0 7rem;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border-subtle);
}

.book-hero-backdrop {
    position: absolute;
    inset: 0;
    opacity: 0.12;
    filter: blur(60px);
    background-size: cover;
    background-position: center;
    transform: scale(1.1);
    pointer-events: none;
}

.book-hero::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: 20%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.18) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
}

/* ========================================================
   MAIN BOOK DETAIL CONTAINER
   ======================================================== */
.book-detail-container {
    margin-top: -5rem;
    padding-bottom: 5rem;
    position: relative;
    z-index: 10;
}

.book-detail-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 3rem;
    align-items: start;
}

/* ========================================================
   3D BOOK COVER & ACTIONS (Left Column)
   ======================================================== */
.book-cover-col {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.book-cover-3d-wrapper {
    perspective: 1200px;
}

.book-cover-3d {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 35px rgba(139, 92, 246, 0.25);
    transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
    transform-style: preserve-3d;
}

.book-cover-3d:hover {
    transform: rotateY(-8deg) rotateX(4deg) translateY(-8px);
    box-shadow: 0 35px 60px -15px rgba(0, 0, 0, 0.8), 0 0 45px rgba(139, 92, 246, 0.4);
}

.book-cover-3d img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Realistic 3D Spine and Sheen */
.book-cover-3d::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}

.book-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    color: var(--text-muted);
    font-size: 4rem;
}

.book-actions-sidebar {
    background: var(--glass-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-sm);
}

/* ========================================================
   BOOK INFO & METADATA (Right Column)
   ======================================================== */
.book-info-col {
    background: var(--glass-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-md);
}

.book-info-header {
    padding: 2.75rem 2.75rem 2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.book-title {
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.book-author-line {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.book-author-line a {
    color: var(--primary-400);
    font-weight: 600;
}

.book-author-line a:hover {
    color: var(--primary-500);
    text-decoration: underline;
}

/* Badges Bar */
.book-meta-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 2rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.badge-primary {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: var(--primary-400);
}

.badge-primary:hover {
    background: var(--primary-500);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.badge-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

/* Action Button Bar */
.book-actions-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.btn-action-primary {
    padding: 1rem 2.25rem;
    font-size: 1.05rem;
}

.btn-action-secondary {
    padding: 1rem 2rem;
    font-size: 1.05rem;
}

/* Metadata Grid */
.book-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    padding: 1.75rem 2.75rem;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--border-subtle);
}

.meta-item {
    text-align: center;
    padding: 0.5rem;
}

.meta-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.meta-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ========================================================
   TABS SYSTEM (Animated Slider Indicator)
   ======================================================== */
.book-tabs {
    position: relative;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.08);
    position: relative;
}

.tab-btn {
    padding: 1.25rem 2rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all var(--transition-fast);
    position: relative;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    color: var(--primary-400);
}

.tab-indicator {
    position: absolute;
    bottom: -1px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 3px 3px 0 0;
    box-shadow: var(--shadow-glow);
    transition: all 0.3s var(--ease-out);
}

.tab-content {
    display: none;
    padding: 2.75rem;
    animation: fadeInTab 0.3s var(--ease-out);
}

.tab-content.active {
    display: block;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.book-description-text {
    color: var(--text-secondary);
    font-size: 1.08rem;
    line-height: 1.85;
}

/* Table of Contents Viewer */
.toc-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    max-height: 480px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.92rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* Book Tags Section */
.book-tags-section {
    padding: 2rem 2.75rem;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.1);
}

.book-tags-section h4 {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.book-tag {
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.book-tag:hover {
    background: var(--primary-500);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* ========================================================
   RELATED BOOKS SHOWCASE (view.php - Redesigned Shelf)
   ======================================================== */
.related-section {
    padding: 4.5rem 0 2rem;
    border-top: 1px solid var(--border-subtle);
    margin-top: 4.5rem;
    position: relative;
    background: radial-gradient(900px 320px at 50% 0%, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
}

.related-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.related-header-left {
    max-width: 680px;
}

.related-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.28);
    color: var(--accent-cyan);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.related-badge i {
    animation: sparkleSpin 4s ease-in-out infinite;
}

@keyframes sparkleSpin {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.15); }
}

.related-title,
.related-section h2 {
    font-size: 2.15rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin: 0 0 0.45rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.related-subtitle {
    color: var(--text-secondary);
    font-size: 0.98rem;
    line-height: 1.5;
    margin: 0;
}

.related-subtitle strong {
    color: var(--primary-400);
}

.related-header-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.related-nav-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.related-nav-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.related-nav-btn:hover {
    background: var(--primary-500);
    border-color: var(--primary-400);
    color: white;
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.related-explore-all {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.62rem 1.25rem;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.related-explore-all:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    transform: translateX(3px);
    box-shadow: var(--shadow-glow);
}

.related-explore-all i {
    transition: transform var(--transition-fast);
}

.related-explore-all:hover i {
    transform: translateX(3px);
}

/* Shelf Container & Track */
.related-shelf-container {
    position: relative;
    width: 100%;
}

.related-shelf {
    display: flex;
    gap: 1.35rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 0.75rem 0.35rem 1.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.related-shelf::-webkit-scrollbar {
    display: none;
}

/* Related Book Card (Compact Authentic 3D Book) */
.related-book-card {
    flex: 0 0 168px;
    width: 168px;
    max-width: 168px;
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
    position: relative;
}

/* Cover Wrapper */
.rel-cover-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.48;
    border-radius: 4px 10px 10px 4px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        -2px 0 6px rgba(0, 0, 0, 0.35),
        0 10px 22px -5px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.35s ease, 
                border-color 0.35s ease;
    cursor: pointer;
}

.rel-cover-wrap:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 
        -4px 0 14px rgba(0, 0, 0, 0.45),
        0 20px 36px -8px rgba(0, 0, 0, 0.7),
        0 0 24px rgba(139, 92, 246, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.rel-cover-link {
    position: absolute;
    inset: 0;
    display: block;
    z-index: 1;
}

.rel-cover-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.rel-cover-wrap:hover .rel-cover-link img {
    transform: scale(1.06);
}

.rel-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    color: var(--text-muted);
    font-size: 2rem;
    padding: 1rem;
    text-align: center;
}

.rel-placeholder span {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* 3D Realistic Spine Shadow & Hinge Fold (Left Edge) */
.rel-spine-shadow {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, 
        rgba(0, 0, 0, 0.5) 0%, 
        rgba(255, 255, 255, 0.16) 12%, 
        rgba(0, 0, 0, 0.32) 28%, 
        rgba(0, 0, 0, 0.08) 60%, 
        transparent 100%
    );
    border-right: 1px solid rgba(0, 0, 0, 0.28);
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.12);
    border-top-left-radius: inherit;
    border-bottom-left-radius: inherit;
    z-index: 3;
    pointer-events: none;
}

/* Realistic Paper Block / Book Trim Edge (Right Edge) */
.rel-paper-edge {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 40%, 
        rgba(255, 255, 255, 0.25) 80%, 
        rgba(0, 0, 0, 0.45) 100%
    );
    border-top-right-radius: inherit;
    border-bottom-right-radius: inherit;
    z-index: 3;
    pointer-events: none;
}

/* Category Micro Pill */
.rel-cat-pill {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    padding: 0.18rem 0.55rem;
    border-radius: var(--radius-full);
    background: rgba(11, 15, 28, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    z-index: 4;
    pointer-events: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    max-width: 82%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hover Quick Actions Overlay */
.rel-hover-actions {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, 
        rgba(8, 12, 24, 0.92) 0%, 
        rgba(8, 12, 24, 0.4) 55%, 
        transparent 100%
    );
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 5;
    pointer-events: none;
}

.rel-cover-wrap:hover .rel-hover-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.rel-action-btn.quick-preview {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.95);
    color: #0b0f19;
    font-size: 0.75rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    transform: translateY(8px);
    transition: all 0.25s ease;
}

.rel-cover-wrap:hover .rel-action-btn.quick-preview {
    transform: translateY(0);
}

.rel-action-btn.quick-preview:hover {
    background: var(--primary-500);
    color: white;
    transform: scale(1.06);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

/* Dedicated Metadata Below Cover */
.rel-book-info {
    padding-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rel-book-title {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.38rem;
}

.rel-book-title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.rel-book-title a:hover {
    color: var(--primary-400);
}

.rel-book-author {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.rel-book-author i {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.rel-book-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.rel-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.rel-meta-item.format {
    font-weight: 700;
    color: var(--accent-cyan);
    font-size: 0.68rem;
}

/* Shelf Edge Fade Gradients */
.shelf-fade-edge {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 6;
    transition: opacity 0.3s ease;
}

.shelf-fade-left {
    left: 0;
    background: linear-gradient(90deg, var(--bg-primary) 0%, transparent 100%);
    opacity: 0;
}

.shelf-fade-right {
    right: 0;
    background: linear-gradient(270deg, var(--bg-primary) 0%, transparent 100%);
    opacity: 1;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .book-detail-grid { grid-template-columns: 280px 1fr; gap: 2rem; }
    .book-info-header, .tab-content, .book-meta-grid, .book-tags-section { padding-left: 1.75rem; padding-right: 1.75rem; }
    .related-book-card { flex: 0 0 155px; width: 155px; max-width: 155px; }
}

@media (max-width: 768px) {
    .book-detail-grid { grid-template-columns: 1fr; }
    .book-cover-col { position: static; max-width: 320px; margin: 0 auto; }
    .book-actions-main { flex-direction: column; }
    .book-actions-main .btn { width: 100%; }
    .tabs-header { overflow-x: auto; }
    .tab-btn { padding: 1rem 1.25rem; font-size: 0.95rem; }
    .related-section { padding: 3rem 0 1.5rem; margin-top: 3rem; }
    .related-title, .related-section h2 { font-size: 1.65rem; }
    .related-book-card { flex: 0 0 142px; width: 142px; max-width: 142px; }
    .related-shelf { gap: 1rem; }
}

@media (max-width: 480px) {
    .related-book-card { flex: 0 0 132px; width: 132px; max-width: 132px; }
    .rel-book-title { font-size: 0.82rem; min-height: 2.2rem; }
}
