/**
 * Book Detail Page Styles
 * Uses platform CSS variables exclusively for theme compatibility.
 * Requirements: 7.1-7.5
 */

/* ============================================
   PAGE LAYOUT
   ============================================ */

.book-detail-page {
    background-color: var(--bg-secondary);
    min-height: 100vh;
}

.bd-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--spacing-2xl) var(--spacing-md);
    padding-top: 120px;
}

/* Back link */
.bd-back {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.bd-back:hover {
    color: var(--color-primary);
}

/* ============================================
   HERO SECTION (Task 5.1)
   ============================================ */

.bd-hero {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--spacing-2xl);
    align-items: start;
}

.bd-cover {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: sticky;
    top: calc(80px + var(--spacing-lg));
}

.bd-cover img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}

.bd-cover-placeholder {
    width: 100%;
    aspect-ratio: 2/3;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #3d7ab5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
}

.bd-cover-placeholder span {
    color: white;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    text-align: center;
    line-height: var(--line-height-tight);
}

.bd-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.bd-title {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    line-height: var(--line-height-tight);
    margin: 0;
}

.bd-author {
    font-size: var(--font-size-lg);
    color: var(--color-primary);
    font-weight: var(--font-weight-medium);
    margin: var(--spacing-xs) 0 0 0;
}

.bd-description {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
    margin: 0;
}

/* Metadata pills */
.bd-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.bd-meta-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.bd-meta-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.bd-meta-label {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}


/* ============================================
   CTA SECTION (Task 5.2)
   ============================================ */

.bd-cta {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
}

.bd-cta-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0 0 var(--spacing-sm) 0;
}

.bd-cta-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-lg) 0;
}

/* Pricing rows */
.bd-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.bd-price-row:last-of-type {
    border-bottom: none;
}

.bd-price-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

.bd-price-value {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: #10b981;
}

/* Progress bar */
.bd-progress {
    margin-bottom: var(--spacing-lg);
}

.bd-progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.bd-progress-fill {
    height: 100%;
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.bd-progress-text {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}

/* ============================================
   RECOMMENDATION SECTIONS (Task 5.3)
   ============================================ */

.bd-section {
    margin-top: var(--spacing-3xl);
}

.bd-section-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0 0 var(--spacing-lg) 0;
}

.bd-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
}

.bd-card {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.bd-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.bd-card-cover {
    width: 100%;
    overflow: hidden;
}

.bd-card-cover img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}

.bd-card-placeholder {
    width: 100%;
    aspect-ratio: 2/3;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #3d7ab5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.bd-card-placeholder span {
    color: white;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    text-align: center;
    line-height: var(--line-height-tight);
}

.bd-card-info {
    padding: var(--spacing-md);
}

.bd-card-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0 0 var(--spacing-xs) 0;
    line-height: var(--line-height-tight);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bd-card-author {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   404 ERROR STATE
   ============================================ */

.bd-error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.bd-error {
    text-align: center;
    color: var(--text-secondary);
}

.bd-error svg {
    margin-bottom: var(--spacing-lg);
    opacity: 0.4;
}

.bd-error h1 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0 0 var(--spacing-sm) 0;
}

.bd-error p {
    font-size: var(--font-size-base);
    margin: 0 0 var(--spacing-xl) 0;
}

/* ============================================
   RESPONSIVE (Task 5.4)
   ============================================ */

@media (max-width: 768px) {
    .bd-hero {
        grid-template-columns: 1fr;
    }

    .bd-cover {
        max-width: 250px;
        margin: 0 auto;
        position: static;
    }

    .bd-title {
        font-size: var(--font-size-2xl);
    }

    .bd-cards {
        grid-template-columns: none;
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: var(--spacing-md);
        padding-bottom: var(--spacing-sm);
        -webkit-overflow-scrolling: touch;
    }

    .bd-card {
        min-width: 160px;
        max-width: 160px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    .bd-card-cover img {
        width: 100%;
        aspect-ratio: 2/3;
        object-fit: cover;
    }
}

/* RTL support */
[dir="rtl"] .bd-back svg {
    transform: scaleX(-1);
}

[dir="rtl"] .bd-meta {
    direction: rtl;
}

/* Book-level RTL: Arabic book text on LTR page */
.bd-title[dir="rtl"],
.bd-author[dir="rtl"],
.bd-description[dir="rtl"] {
    text-align: right;
    direction: rtl;
}
