/**
 * Main Stylesheet for Your Project
 *
 * TABLE OF CONTENTS
 * -----------------
 * 0. SETUP & GLOBAL STYLES
 * - CSS Variables (:root)
 * - Reset & Base Styles
 *
 * 1. UTILITY & HELPER CLASSES
 * - Backgrounds & Shadows
 * - Text & Color Helpers
 * - Button Overrides
 *
 * 2. LAYOUT COMPONENTS
 * - Header (V2)
 * - Breadcrumb
 * - Footer & Back-to-Top Button
 *
 * 3. PAGE-SPECIFIC COMPONENTS
 * - Hero Section (V2)
 * - Adsense Unit
 *
 * 4. CARD COMPONENTS
 * - Book Card (General)
 * - Category Card (Elegant V3)
 * - Author Card (Profile V2)
 * - Author Profile Box (Single Page)
 *
 * 5. MODAL & INTERACTIVE COMPONENTS
 * - Search Modal (V2)
 * - Download Modal & Progress
 * - Load More Button
 * - Star Rating
 * - Countdown Circle
 *
 * 6. ANIMATIONS
 * - Keyframe Animations
 *
 * 7. MEDIA QUERIES
 * - Responsive Design Adjustments
 */

/* ===================================================================
   0. SETUP & GLOBAL STYLES
   =================================================================== */

/* --- CSS Variables (:root) --- */
:root {
    /* Colors */
    --bs-primary: #004080; /* Bootstrap Primary Color Override */
    --color-primary-start: #4facfe;
    --color-primary-end: #00f2fe;
    --color-secondary-start: #007bff;
    --color-secondary-end: #00c6ff;
    --color-disabled-bg: #e9ecef;
    --color-disabled-text: #6c757d;
    --breadcrumb-bg: linear-gradient(to right, #6a11cb, #2575fc);
    --breadcrumb-color: #ffffff;
    --breadcrumb-hover: #ffd700;

    /* Sizing & Transitions */
    --transition-speed: 0.35s;
    --radius-lg: 16px;
    --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* --- Reset & Base Styles --- */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

html {
    font-size: 10px;
    scroll-behavior: smooth;
}

body {
    font-family: "Cairo", sans-serif;
    background-color: #f0f2f5;
    color: #333333;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: #0066cc;
}

li {
    list-style: none;
}

p {
    font-size: 1.5rem;
}

/* ===================================================================
   1. UTILITY & HELPER CLASSES
   =================================================================== */

/* --- Backgrounds & Shadows --- */
.bg-gradient-primary {
    background: linear-gradient(135deg, #6f42c1, #007bff);
    color: #fff;
}

.custom-shadow {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.custom-shadow-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.custom-shadow-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* --- Text & Color Helpers --- */
.text-primary { color: var(--bs-primary) !important; }
.text-danger { color: #cc0000 !important; }
.text-warning { color: #ffaa00 !important; }
.text-muted { color: #6c757d !important; }

/* --- Button Overrides --- */
.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: #0059b3;
    border-color: #0059b3;
}

/* ===================================================================
   2. LAYOUT COMPONENTS
   =================================================================== */

/* --- Header (V2) --- */
.header-v2 {
    padding: 0.5rem 0;
    transition: background-color 0.3s ease;
}

.header-v2 .navbar-brand:hover {
    transform: scale(1.05);
}

.header-v2 .nav-link {
    font-weight: 500;
    color: #555;
    position: relative;
    transition: color 0.3s ease;
}

.header-v2 .nav-link:hover,
.header-v2 .nav-link.active {
    color: var(--bs-primary);
}

.header-v2 .nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 50%;
    transform: translateX(50%);
    width: 0;
    height: 2px;
    background-color: var(--bs-primary);
    transition: width 0.3s ease-in-out;
}

.header-v2 .nav-link:hover::after,
.header-v2 .nav-link.active::after {
    width: 30%;
}

.btn-icon-search {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: #333;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.btn-icon-search:hover {
    background-color: #f0f2f5;
    color: var(--bs-primary);
}

/* --- Breadcrumb --- */
.custom-breadcrumb {
    background: var(--breadcrumb-bg);
    padding: 15px 0;
    margin: 20px;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.custom-breadcrumb-list {
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.custom-breadcrumb-item a {
    color: var(--breadcrumb-color);
    font-size: clamp(14px, 2vw, 18px);
    font-weight: 500;
    transition: color 0.3s ease, transform 0.3s ease;
}

.custom-breadcrumb-item a:hover {
    color: var(--breadcrumb-hover);
    transform: scale(1.05);
}

.custom-breadcrumb-item.active {
    color: var(--breadcrumb-color);
    font-size: clamp(14px, 2vw, 18px);
    font-weight: 600;
}

/* --- Footer & Back-to-Top Button --- */
footer {
    background-color: #343a40;
    color: #f8f9fa;
    padding: 1rem;
    text-align: center;
}

#backToTopBtn {
    position: fixed;
    bottom: 3rem;
    right: 3rem;
    background-color: #003b71;
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    display: none;
    z-index: 100;
}

#backToTopBtn:hover {
    background-color: #5a42c1;
}

/* ===================================================================
   3. PAGE-SPECIFIC COMPONENTS
   =================================================================== */

/* --- Hero Section (V2) --- */
.hero-v2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12rem 0;
    color: white;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.hero-v2 .hero-content {
    position: relative;
    z-index: 2;
}

.hero-v2 h1 {
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.hero-v2 p.lead {
    font-size: 2rem;
    opacity: 0.9;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.search-form-v2 {
    max-width: 700px;
    position: relative;
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
    display: flex;
    align-items: center;
}

.search-form-v2 .form-control {
    flex: 1;
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 1.8rem;
    padding: 1rem 0;
    outline: none;
    box-shadow: none;
}

.search-form-v2 .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-form-v2 .btn {
    border-radius: 50px;
    font-size: 1.6rem;
    font-weight: bold;
    padding: 1.2rem 3rem;
    background-color: #ffffff;
    color: #667eea;
    border: none;
    transition: all 0.3s ease;
}

.search-form-v2 .btn:hover {
    background-color: #f0f0f0;
    transform: scale(1.05);
}

.hero-shapes .shape {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.08);
    z-index: 1;
    animation: floatAnimation 15s infinite ease-in-out;
}

/* --- Adsense Unit --- */
.ad-unit {
    width: 100%;
    margin: 10px auto;
    overflow: hidden;
}

/* ===================================================================
   4. CARD COMPONENTS
   =================================================================== */

/* --- Book Card (General) --- */
.book {
    background-color: white;
    border: .1rem solid #dee2e6;
    border-radius: 1rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 1.5rem;
    position: relative;
    height: 30rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.book:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    border-color: #0059b3;
}

.book-image img {
    max-width: 100px;
    height: auto;
    border-radius: 1rem;
    border: .1rem solid #ede9e5;
    transition: transform 0.3s ease;
}

.book:hover .book-image img {
    transform: scale(1.05);
}

.book-info {
    margin-top: 1rem;
    text-align: center;
}

.book-name a {
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.4;
    color: #333;
    text-decoration: none;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.author-label a,
.category-label a {
    font-size: 1.2rem;
    color: #6610f2;
    font-weight: 600;
    text-decoration: none;
}

.copyright-icon {
    z-index: 10;
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    color: #f65656;
    background-color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid #f65656;
}

.copyright-icon i {
    font-size: 1.8rem;
}

/* --- Category Card (Elegant V3) --- */
.category-card-elegant {
    background-color: #fff;
    border: 1px solid #e0e5ec;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    padding-top: 5px;
}

.category-card-elegant::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: var(--bs-primary, #004080);
    border-radius: 8px 8px 0 0;
    transition: height 0.3s ease;
}

.category-card-elegant:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--bs-primary, #004080);
}

.category-card-elegant:hover::before {
    height: 7px;
}

.category-card-elegant .card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.category-card-elegant__title {
    font-size: 1.7rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.75rem;
}

.category-card-elegant__title i {
    color: var(--bs-primary);
    margin-left: 8px;
}

.category-card-elegant__meta {
    font-size: 1.4rem;
    color: #6c757d;
    margin-bottom: 1.5rem;
}

.category-card-elegant__link {
    margin-top: auto;
    color: var(--bs-primary);
    font-weight: 600;
    font-size: 1.4rem;
    align-self: flex-start;
    transition: color 0.3s ease;
}

.category-card-elegant__link i {
    margin-right: 5px;
    transition: transform 0.3s ease;
}

.category-card-elegant:hover .category-card-elegant__link i {
    transform: translateX(-4px);
}

/* --- Author Card (Profile V2) --- */
.author-card-profile {
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    height: 100%;
}

.author-card-profile:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    border-color: var(--bs-primary);
}

.author-card-profile__image-wrapper {
    flex-shrink: 0;
    margin-left: 1.5rem;
}

.author-card-profile__image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f8f9fa;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.author-card-profile__name {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--bs-primary);
    margin-bottom: 0.5rem;
}

.author-card-profile__meta {
    font-size: 1.4rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.author-card-profile__button {
    display: inline-flex;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 500;
    color: #fff;
    background-color: var(--bs-primary);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    transition: background-color 0.3s ease;
}

.author-card-profile__button:hover {
    background-color: #0059b3;
}

.author-card-profile__button .arrow-icon {
    margin-right: 0.5rem;
    transition: transform 0.3s ease;
}

.author-card-profile:hover .arrow-icon {
    transform: translateX(-3px);
}

/* --- Author Profile Box (Single Page) --- */
.author-profile-box {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.author-profile-box__image-wrapper {
    flex-shrink: 0;
    margin-bottom: 1.5rem;
}

.author-profile-box__image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.author-profile-box__name {
    font-size: 2.2rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.75rem;
}

.author-profile-box__description {
    font-size: 1.5rem;
    color: #495057;
    line-height: 1.7;
    margin-bottom: 0;
}

/* ===================================================================
   5. MODAL & INTERACTIVE COMPONENTS
   =================================================================== */

/* --- Search Modal (V2) --- */
#searchModalV2.modal {
    --bs-modal-bg: transparent;
}

#searchModalV2 .modal-backdrop.show {
    backdrop-filter: blur(5px);
    background-color: rgba(10, 22, 41, 0.5);
    opacity: 1;
}

#searchModalV2 .modal-dialog {
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

#searchModalV2.show .modal-dialog {
    transform: translateY(0);
    opacity: 1;
}

#searchModalV2 .btn-close {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 10;
}

.search-input {
    border-radius: 50px !important;
    border: 2px solid #e9ecef;
    padding: 1.5rem 2rem;
    font-size: 1.5rem !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(0, 64, 128, 0.2);
    background-color: #fff;
}

#searchModalV2 .form-text {
    font-size: 1.3rem;
    color: #6c757d;
}

/* --- Download Modal & Progress --- */
.modal-content.download-modal {
    transform: translateY(40px) scale(0.98);
    opacity: 0;
    transition: all var(--transition-speed) ease;
}

.modal.show .modal-content.download-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.progress {
    height: 55px;
    border-radius: 50px;
    background-color: var(--color-disabled-bg);
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.2);
}

.progress-bar {
    background: linear-gradient(90deg, var(--color-secondary-start), var(--color-secondary-end));
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--color-primary-start), var(--color-primary-end));
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    padding: 1rem;
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-speed);
}

.btn-download:hover:not(.disabled) {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(74, 175, 254, 0.35);
    filter: brightness(1.08);
}

.btn-download.ready {
    background: linear-gradient(135deg, #00c851, #009432);
    animation: pulseReady 1.5s infinite;
}

.btn-download.disabled {
    opacity: 0.75;
    background: var(--color-disabled-bg);
    color: var(--color-disabled-text);
    cursor: not-allowed;
}

/* --- Load More Button --- */
#loadMore {
    transition: background-color 0.3s;
    font-size: 1.5rem;
}

#loadMore:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* --- Star Rating --- */
.star-rating {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    direction: rtl;
}

.star {
    position: relative;
    width: 15px;
    height: 15px;
    margin: 0 3px;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    background-color: #ccc;
    overflow: hidden;
}

.star-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #0d6efd;
    transition: width 0.3s;
    transform-origin: right;
}

.star::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background-color: #0d6efd;
    clip-path: inherit;
    transition: width 0.3s;
}


/* --- Countdown Circle --- */
.circle-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 20px auto;
}

.circle {
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    stroke: #007bff;
    stroke-width: 10;
    fill: none;
    transition: stroke-dashoffset 1s linear;
}

.circle-bg {
    stroke: #e6e6e6;
    stroke-width: 10;
    fill: none;
}

.countdown-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
}

/* ===================================================================
   6. ANIMATIONS
   =================================================================== */

@keyframes pulseReady {
    0%, 100% {
        box-shadow: 0 0 0 rgba(0, 200, 81, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 200, 81, 0.8);
        transform: scale(1.03);
    }
}

@keyframes floatAnimation {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) rotate(180deg);
    }
}

/* ===================================================================
   7. MEDIA QUERIES
   =================================================================== */

@media (min-width: 1025px) {
    .ad-unit { max-width: 728px; }
}

@media (max-width: 1024px) {
    .ad-unit { max-width: 468px; }
}

@media (min-width: 768px) {
    .author-profile-box {
        flex-direction: row;
        text-align: right;
    }
    .author-profile-box__image-wrapper {
        margin-bottom: 0;
        margin-left: 2rem;
    }
}

@media (max-width: 600px) {
    .ad-unit { max-width: 300px; }
}

/**/

/* ===================================================================
   PAGE: SINGLE BOOK (PREMIUM REFINEMENT V2)
   =================================================================== */

/* --- Main Book Display Section --- */
.book-display-section {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 16px; /* Larger radius for a softer look */
    padding: 2.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

@media (min-width: 992px) {
    .book-display-section {
        padding: 4rem;
    }
}

/* --- Cover & Actions Column --- */
.book-cover-container {
    text-align: center;
    margin-bottom: 2rem;
}

.book-cover {
    max-width: 260px;
    height: auto;
    border-radius: 12px; /* Softer radius for the image */
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.book-cover:hover {
    transform: scale(1.03);
}

.book-actions-group .btn {
    font-size: 1.7rem;
    padding: 1.2rem;
    font-weight: 700; /* Bolder text for buttons */
    border-radius: 12px;
}

/* --- Info & Details Column --- */
.book-details-container .book-main-title {
    font-size: 3.2rem;
    font-weight: 800; /* Extra bold for a strong title */
    color: #1a202c; /* Darker, more premium text color */
    margin-bottom: 1.5rem;
}

.book-meta {
    font-size: 1.7rem;
    color: #4a5568; /* Softer text color */
    margin-bottom: 2rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 2rem;
}

.book-meta a {
    color: var(--bs-primary, #004080);
    font-weight: 600;
    text-decoration: none;
}

.book-meta a:hover {
    text-decoration: underline;
}

.book-meta i.fas {
    color: #a0aec0; /* Lighter icon color */
    margin-left: 0.8rem;
}

.book-prose {
    font-size: 1.6rem;
    line-height: 1.9;
    color: #4a5568;
    margin-top: 2rem;
}

/* --- Quick Details Bar --- */
.book-quick-details {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.quick-detail {
    text-align: center;
}

.quick-detail__label {
    font-size: 1.4rem;
    color: #718096; /* Softer label color */
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-weight: 500;
}

.quick-detail__value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2d3748;
}

/* --- Secondary Sections (Author, Related) --- */
.secondary-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 3rem;
    margin-top: 2.5rem;
}

.secondary-section-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2d3748;
    text-align: center;
    margin-bottom: 2.5rem;
}

/* --- Author Info Box inside Secondary Section --- */
.author-info-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

@media (min-width: 768px) {
    .author-info-box {
        flex-direction: row;
        text-align: right;
    }
}

.author-info-box__image {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .author-info-box__image {
        margin-left: 2rem;
        margin-bottom: 0;
    }
}

.author-info-box__name {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2d3748;
}

.author-info-box__bio {
    font-size: 1.5rem;
    color: #4a5568;
}

/* --- Related Books List --- */
.related-book-link {
    display: flex;
    align-items: center;
    padding: 1.2rem;
    font-size: 1.6rem;
    color: #2d3748;
    text-decoration: none;
    border-radius: 12px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    border: 1px solid transparent;
}

.related-book-link:hover {
    background-color: #ffffff;
    color: var(--bs-primary, #004080);
    transform: translateX(-5px);
    border-color: #e9ecef;
}

.related-book-link i.fas {
    color: #a0aec0;
    margin-left: 1.5rem;
    transition: color 0.2s ease;
}
.related-book-link:hover i.fas {
    color: var(--bs-primary, #004080);
}

/* ===================================================================
   FIX: Book Tools Section (Share & Shortlink)
   =================================================================== */

.book-tools-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2.5rem;
}

.book-tools-section .tool-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #718096;
    margin-bottom: 1rem;
    text-align: center;
}

.share-buttons-group .btn {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.8rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.short-link-group .form-control {
    text-align: center;
    background-color: #ffffff;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    border-right: 0;
}

.short-link-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* ===================================================================
   COMPONENT: Refined Download Modal (V2)
   =================================================================== */

#downloadModal .modal-content {
    border: none;
    border-radius: 16px; /* زوايا دائرية ناعمة */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

#downloadModal .modal-header {
    background-color: transparent;
    border-bottom: 1px solid #e9ecef;
    padding: 1.5rem 2rem;
}

#downloadModal .modal-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748; /* لون نص داكن وأنيق */
}

#downloadModal .btn-close {
    margin: 0;
}

#downloadModal .modal-body {
    padding: 2.5rem;
}

#downloadModal .progress {
    height: 1.2rem; /* شريط تحميل أسمك قليلاً */
    border-radius: 50px;
}

#downloadModal .progress-bar {
    background-color: var(--bs-primary, #004080);
    color: #fff !important; /* تأكيد لون النص الأبيض */
    font-weight: 600;
}

#downloadModal #countdownText {
    font-size: 1.5rem;
    color: #4a5568; /* لون نص ناعم */
}

#downloadModal .modal-footer {
    border-top: none;
    padding: 0 2.5rem 2.5rem;
}

#downloadModal #downloadButton {
    font-size: 1.7rem;
    padding: 1.2rem;
    font-weight: 700;
    border-radius: 12px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

/* حالة الزر قبل انتهاء العد التنازلي */
#downloadButton.disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #e9ecef;
}

/* حالة الزر عندما يكون جاهزًا للتحميل */
#downloadButton.ready {
    background-color: #198754; /* لون أخضر للنجاح */
    color: #fff;
    border-color: #198754;
    animation: pulseReady 1.5s infinite; /* استخدام نفس الأنيميشن الجذاب */
}

#downloadButton.ready:hover {
    background-color: #157347; /* لون أغمق عند المرور */
}


/* ===================================================================
   PAGE: Search Results (V1)
   =================================================================== */

/* --- Main Search Form --- */
.search-form-refined {
    display: flex;
    max-width: 700px; /* تحديد عرض أقصى */
    margin: 0 auto 3rem auto;
    border: 1px solid #dee2e6;
    border-radius: 50px; /* حواف دائرية بالكامل */
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease;
}

.search-form-refined:focus-within {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    border-color: var(--bs-primary, #004080);
}

.search-form-refined__input {
    flex-grow: 1;
    border: none;
    padding: 1.5rem 2rem;
    font-size: 1.6rem;
    outline: none;
    color: #212529;
}

.search-form-refined__button {
    border: none;
    background-color: var(--bs-primary, #004080);
    color: #fff;
    padding: 0 3rem;
    font-size: 1.6rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-form-refined__button:hover {
    background-color: #0059b3;
}

/* --- Results Header/Alert --- */
.search-results-header {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    font-size: 1.7rem;
    margin-bottom: 3rem;
}

.search-results-header strong {
    color: var(--bs-primary, #004080);
}

.search-results-header.no-results {
    background-color: #fdf2f2;
    border-color: #fadddd;
    color: #b91c1c;
}

/* --- Pagination Styling --- */
.pagination .page-item .page-link {
    color: var(--bs-primary, #004080);
    border-radius: 0.5rem;
    margin: 0 0.25rem;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}
.pagination .page-item .page-link:hover {
    background-color: #f8f9fa;
    border-color: var(--bs-primary, #004080);
}

.pagination .page-item.active .page-link {
    background-color: var(--bs-primary, #004080);
    border-color: var(--bs-primary, #004080);
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 64, 128, 0.2);
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
}
