/* ============================================================
   صفحة تفاصيل الكتاب – تصميم فني احترافي
   ============================================================ */

.book-page-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 80px;
    position: relative;
}

/* خلفية زخرفية خفيفة للصفحة */
.book-page-wrap::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 15% 10%, rgba(59, 130, 246, 0.06), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(14, 116, 144, 0.05), transparent 45%);
    pointer-events: none;
}

/* ============================================================
   مسار التنقل (Breadcrumb)
============================================================ */
.book-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 26px;
    padding: 12px 20px;
    font-size: 0.94rem;
    font-weight: 600;
    color: #64748b;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.book-breadcrumb a {
    color: #0369a1;
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.book-breadcrumb a:hover {
    color: #0c4a6e;
    background: #e0f2fe;
    text-decoration: none;
}

.book-breadcrumb span:last-child {
    color: #1e293b;
    font-weight: 800;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   القسم الرئيسي (Hero) – الغلاف + التفاصيل
============================================================ */
.book-hero {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
    padding: 36px;
    border-radius: 28px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 60%, #eff6ff 100%);
    border: 1px solid #e2e8f0;
    box-shadow:
        0 4px 6px rgba(15, 23, 42, 0.04),
        0 20px 50px -20px rgba(15, 23, 42, 0.15);
}

/* زخارف دقيقة في الخلفية */
.book-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 35%),
        radial-gradient(circle at bottom left, rgba(14, 116, 144, 0.08), transparent 40%);
    pointer-events: none;
}

.book-hero::after {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent 70%);
    pointer-events: none;
}

.book-cover-box,
.book-content {
    position: relative;
    z-index: 1;
}

/* ============================================================
   صندوق الغلاف
============================================================ */
.book-cover-box {
    position: relative;
    perspective: 1200px;
}

.book-cover {
    width: 100%;
    display: block;
    border-radius: 20px;
    box-shadow:
        0 4px 8px rgba(15, 23, 42, 0.08),
        0 30px 60px -20px rgba(15, 23, 42, 0.35),
        0 0 0 1px rgba(15, 23, 42, 0.05) inset;
    background: #fff;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.5s ease;
    transform-style: preserve-3d;
}

.book-cover:hover {
    transform: translateY(-8px) rotateY(-3deg) rotateX(2deg);
    box-shadow:
        0 10px 20px rgba(15, 23, 42, 0.12),
        0 40px 80px -20px rgba(15, 23, 42, 0.45);
}

/* شريط زخرفي أسفل الغلاف */
.book-cover-box::after {
    content: "";
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.18), transparent 70%);
    border-radius: 50%;
    filter: blur(10px);
    z-index: -1;
}

/* ============================================================
   محتوى الكتاب
============================================================ */
.book-content {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* شارة علوية */
.book-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font-weight: 800;
    font-size: 0.88rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border: 1px solid #93c5fd;
    width: fit-content;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.08);
}

/* العنوان الرئيسي */
.book-title {
    margin: 0;
    font-size: 2.3rem;
    font-weight: 800;
    line-height: 1.35;
    color: #0f172a;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    padding-bottom: 14px;
}

.book-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 70px;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, #1e40af 0%, #0ea5e9 100%);
}

/* ============================================================
   شبكة الميتا (المؤلف، الصفحات، التاريخ، الحجم)
============================================================ */
.book-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.book-meta-item {
    padding: 14px 18px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.book-meta-item::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #1e40af, #0ea5e9);
    border-radius: 0 4px 4px 0;
}

.book-meta-item:hover {
    transform: translateY(-3px);
    border-color: #bfdbfe;
    box-shadow: 0 8px 20px -8px rgba(30, 64, 175, 0.2);
}

.book-meta-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.book-meta-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.5;
}

/* ============================================================
   نبذة عن الكتاب (الوصف)
============================================================ */
.book-description {
    position: relative;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 24px 26px;
    line-height: 2.1;
    font-size: 1.02rem;
    color: #334155;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.book-description::before {
    content: "";
    position: absolute;
    top: 24px;
    right: -1px;
    width: 4px;
    height: 40px;
    background: linear-gradient(180deg, #0ea5e9 0%, #1e40af 100%);
    border-radius: 4px 0 0 4px;
}

.book-description strong,
.book-description b {
    color: #0f172a;
    font-weight: 800;
}

/* ============================================================
   أزرار الإجراءات
============================================================ */
.book-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

.book-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 26px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1rem;
    border-radius: 14px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.book-btn-primary {
    background: linear-gradient(135deg, #1e40af 0%, #0369a1 100%);
    color: #ffffff;
    box-shadow: 0 8px 20px -8px rgba(30, 64, 175, 0.5);
}

.book-btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.5s ease;
}

.book-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px -8px rgba(30, 64, 175, 0.6);
    color: #ffffff;
}

.book-btn-primary:hover::before {
    left: 100%;
}

.book-btn-secondary {
    background: #ffffff;
    color: #1e40af;
    border-color: #cbd5e1;
}

.book-btn-secondary:hover {
    transform: translateY(-3px);
    border-color: #1e40af;
    background: #f0f9ff;
    color: #1e3a8a;
    box-shadow: 0 8px 20px -10px rgba(30, 64, 175, 0.3);
}

/* ============================================================
   قسم الكتب ذات الصلة
============================================================ */
.book-section {
    margin-top: 44px;
    padding: 32px;
    border-radius: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(15, 23, 42, 0.03),
                0 20px 40px -30px rgba(15, 23, 42, 0.15);
    position: relative;
}

.book-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 26px;
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    position: relative;
    padding-bottom: 16px;
}

.book-section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #1e40af 0%, transparent 70%);
    border-radius: 2px;
}

/* شبكة الكتب ذات الصلة */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
}

/* ============================================================
   استجابة الشاشات
============================================================ */
@media (max-width: 960px) {
    .book-hero {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 28px;
    }

    .book-cover-box {
        max-width: 340px;
        width: 100%;
        margin: 0 auto;
    }

    .book-title {
        font-size: 1.9rem;
    }

    .book-cover:hover {
        transform: translateY(-4px);
    }
}

@media (max-width: 640px) {
    .book-page-wrap {
        padding: 20px 12px 60px;
    }

    .book-breadcrumb {
        padding: 10px 14px;
        font-size: 0.87rem;
        gap: 6px;
    }

    .book-breadcrumb span:last-child {
        max-width: 180px;
    }

    .book-hero,
    .book-section {
        padding: 22px 18px;
        border-radius: 20px;
    }

    .book-title {
        font-size: 1.55rem;
        padding-bottom: 12px;
    }

    .book-title::after {
        width: 50px;
        height: 3px;
    }

    .book-description {
        padding: 18px 18px;
        font-size: 0.97rem;
        line-height: 1.95;
    }

    .book-meta {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .book-meta-item {
        padding: 12px 14px;
    }

    .book-meta-value {
        font-size: 0.95rem;
    }

    .book-actions {
        flex-direction: column;
    }

    .book-btn {
        width: 100%;
        padding: 13px 20px;
    }

    .book-section-title {
        font-size: 1.25rem;
        margin-bottom: 20px;
    }

    .related-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* ============================================================
   دعم RTL
============================================================ */
body[dir="rtl"] .book-meta-item::before {
    right: 0;
    left: auto;
    border-radius: 0 4px 4px 0;
}

body[dir="rtl"] .book-description::before {
    right: -1px;
    left: auto;
    border-radius: 4px 0 0 4px;
}

body[dir="rtl"] .book-title::after {
    right: 0;
    left: auto;
}

body[dir="ltr"] .book-meta-item::before {
    left: 0;
    right: auto;
    border-radius: 4px 0 0 4px;
}

body[dir="ltr"] .book-description::before {
    left: -1px;
    right: auto;
    border-radius: 0 4px 4px 0;
}

body[dir="ltr"] .book-title::after {
    left: 0;
    right: auto;
}

body[dir="ltr"] .book-section-title::after {
    background: linear-gradient(270deg, #1e40af 0%, transparent 70%);
}

/* ============================================================
   حركات دخول ناعمة
============================================================ */
@keyframes book-fade-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.book-hero {
    animation: book-fade-up 0.5s ease-out;
}

.book-section {
    animation: book-fade-up 0.5s ease-out 0.1s backwards;
}

/* ============================================================
   الطباعة
============================================================ */
@media print {
    .book-page-wrap::before,
    .book-actions,
    .book-section,
    .book-breadcrumb {
        display: none !important;
    }
    .book-hero {
        box-shadow: none;
        border: 1px solid #000;
    }
}