/* ========================================================
   Block 1: تنسيق شبكة الكتب (Gallery Grid)
   ======================================================== */
.eb-library-container {
    max-width: 1200px;
    margin: 0 auto; padding: 40px 20px;
}
.eb-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
}
.eb-book-card {
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
    display: flex; flex-direction: column;
}
.eb-book-card:hover {
    transform: translateY(-5px);
}
.eb-book-cover-wrap {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    aspect-ratio: 2/3; /* نسبة أبعاد الكتاب */
    cursor: pointer;
    border: 1px solid #e2e8f0;
}
.eb-book-cover-wrap img {
    width: 100%; height: 100%; object-fit: cover;
    transition: 0.3s;
}
/* تأثير عند الوقوف على الغلاف */
.eb-book-overlay {
    position: absolute; inset: 0;
    background: rgba(15, 42, 58, 0.8);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    opacity: 0; transition: 0.3s; color: #fff; gap: 10px;
}
.eb-book-cover-wrap:hover .eb-book-overlay { opacity: 1; }
.eb-book-cover-wrap:hover img { transform: scale(1.05); }

.eb-book-overlay i { font-size: 30px; color: #C5AB88;
}
.eb-book-overlay span { font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 12px; }

.eb-book-info { padding: 15px 5px; text-align: center;
}
.eb-book-info h4 { margin: 0; color: #C5AB88; font-size: 14px; font-weight: 800; }
.eb-book-info p { margin: 5px 0 0; color: #0f2a3a;
font-size: 13px; font-weight: 600; line-height: 1.3; }

/* ========================================================
   Block 2: تنسيق العارض (Viewer Modal)
   ======================================================== */
.eb-viewer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(15, 42, 58, 0.95);
    backdrop-filter: blur(5px); z-index: 999999;
    display: flex;
    align-items: center; justify-content: center;
    padding: 20px; box-sizing: border-box;
    opacity: 0; animation: ebFadeIn 0.3s forwards;
}
.eb-viewer-modal {
    width: 100%; max-width: 1400px; height: 90vh;
    background: #fff; border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; overflow: hidden;
    position: relative; border: 1px solid #C5AB88;
}
@keyframes ebFadeIn { from { opacity: 0; } to { opacity: 1; } }

.eb-viewer-header {
    height: 60px;
    background-color: #0f2a3a; color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; border-bottom: 4px solid #C5AB88; flex-shrink: 0;
}
.eb-viewer-title-box { display: flex; align-items: center; gap: 12px; }
.eb-viewer-title-box i { font-size: 24px; color: #C5AB88; }
.eb-viewer-title-box span { font-size: 18px;
font-weight: 700; }
.eb-close-btn {
    background: transparent; border: none; color: rgba(255,255,255,0.7);
    font-size: 24px; cursor: pointer; width: 40px;
    height: 40px;
    border-radius: 50%; transition: 0.2s;
}
.eb-close-btn:hover { background: rgba(255,255,255,0.1); color: #fff; transform: rotate(90deg); }

.eb-viewer-body { display: flex; flex: 1;
overflow: hidden; background-color: #f8fafc; }
.eb-viewer-sidebar {
    width: 320px; background: #fff; border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column; overflow-y: auto; flex-shrink: 0;
}
.eb-sidebar-unit {
    background-color: #f1f5f9; padding: 12px 15px; font-weight: 800;
    color: #0f2a3a;
    font-size: 13px; border-bottom: 1px solid #e2e8f0;
}
.eb-sidebar-topic {
    padding: 10px 15px 10px 35px; cursor: pointer; font-size: 14px;
    color: #475569; border-bottom: 1px solid #f8fafc; position: relative;
    transition: 0.2s;
}
.eb-sidebar-topic:hover { background-color: #f8fafc; color: #0f2a3a; padding-left: 40px;
}
.eb-sidebar-topic.active {
    background-color: #fffbeb; color: #b45309; border-left: 4px solid #C5AB88; font-weight: 600;
}
.eb-viewer-content-wrapper { flex-grow: 1;
    position: relative; background-color: #fff; display: flex; flex-direction: column; }
.eb-watermark-layer {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 60%; height: 60%;
    background-image: url('https://myatpl.com/wp-content/uploads/2025/02/cropped-MyATPL-Logo-1.webp');
    background-repeat: no-repeat; background-position: center; background-size: contain;
    opacity: 0.04; pointer-events: none;
    z-index: 0;
}
.eb-content-canvas {
    padding: 60px 80px; overflow-y: auto; height: 100%;
    box-sizing: border-box; position: relative; z-index: 1;
    font-family: 'Georgia', serif; line-height: 1.8; font-size: 18px; color: #334155;
}
.eb-loading-msg { padding: 30px; text-align: center; color: #64748b; font-style: italic;
}
.eb-welcome-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #94a3b8; }
.eb-welcome-screen i { font-size: 40px;
    margin-bottom: 20px; color: #cbd5e1; }

@media (max-width: 768px) {
    .eb-viewer-body { flex-direction: column;
}
    .eb-viewer-sidebar { width: 100%; height: 35%; border-right: none; border-bottom: 1px solid #e2e8f0;
}
    .eb-content-canvas { padding: 20px; font-size: 16px; }
}

/* 🔥 New styles for Cover Menu (Editor) */
.eb-header-cover-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.eb-cover-menu { position: absolute; top: 110%; left: 0; background: #fff; border-radius: 8px; box-shadow: 0 5px 20px rgba(0,0,0,0.2); min-width: 160px; display: none; overflow: hidden; z-index: 1000; border: 1px solid #e2e8f0; }
.eb-cover-menu div { padding: 12px 15px; color: #334155; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 8px; }
.eb-cover-menu div:hover { background: #f8fafc; color: #0f2a3a; }
.eb-cover-menu div.danger { color: #ef4444; border-top: 1px solid #f1f5f9; }
.eb-cover-menu div.danger:hover { background: #fef2f2; }