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

body {
    font-family: 'Cairo', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #f8f9fa;
    direction: rtl;
}

.btn,
  .category-btn {
    font-family: 'Cairo', sans-serif;
  }
  
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(139, 69, 19, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    background-image: url("library_header_background.png");
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    background-color: rgba(255, 255, 255, 0.4);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: #8b4513;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(45deg , #8b4513 , #d4af37);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.search-container {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #6c757d;
}

.categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 1rem;
}

.category-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
}

.category-btn:hover,
.category-btn.active {
    background: #8b4513;
    color: white;
    border-color: #8b4513;
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8b4513 0%, #a0522d 50%, #8b4513 100%);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('https://images.unsplash.com/photo-1543002588-bfa74002ed7e?w=400&h=600&fit=crop') center/cover;
    opacity: 0.2;
    z-index: 1;
}https://images.unsplash.com/photo-1543002588-bfa74002ed7e?w=400&h=600&fit=crop

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.8), rgba(212, 175, 55, 0.6));
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: white;
    max-width: 800px;
    padding: 2rem;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: bold;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.highlight {
    color: #d4af37;
}

.hero-description {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    margin-bottom: 2rem;
    opacity: 0.95;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 400px;
    margin: 0 auto;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #d4af37;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: #d4af37;
    color: #8b4513;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
    background: #c19b26;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-outline {
    background: transparent;
    color: #8b4513;
    border: 1px solid #dee2e6;
}

.btn-outline:hover {
    background: #8b4513;
    color: white;
    border-color: #8b4513;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: #6c757d;
    font-size: 1.1rem;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.book-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(139, 69, 19, 0.1);
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.2);
    border-color: rgba(212, 175, 55, 0.3);
}

.book-cover {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #f8f9fa;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.book-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(212, 175, 55, 0.9);
    color: #8b4513;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.book-rating {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.star-icon {
    width: 12px;
    height: 12px;
    fill: #d4af37;
    color: #d4af37;
}

.book-content {
    padding: 1.5rem;
}

.book-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.book-author {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.book-pages {
    color: #6c757d;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.book-description {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-actions {
    display: flex;
    gap: 0.5rem;
}

.book-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 10px 16px;
    font-size: 0.9rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 0;
}

.no-results p {
    font-size: 1.2rem;
    color: #6c757d;
}

/* Footer */
.footer {
    background: #8b4513;
    color: white;
    text-align: center;
    padding: 3rem 0;
    margin-top: 4rem;
}

.footer h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.footer p {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 1rem;
}

/* Reader Page Styles */
.reader-page {
    background: #faf9f7;
}

.reader-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(139, 69, 19, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.reader-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.reader-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.book-info h1 {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.book-info p {
    color: #6c757d;
    font-size: 0.9rem;
}

.reader-controls {
    display: flex;
    gap: 0.5rem;
}

.reader-content {
    padding: 2rem 0;
}

.reader-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

.reader-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.page-info {
    font-size: 0.9rem;
    color: #6c757d;
}

.font-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.font-controls span {
    font-size: 0.9rem;
    color: #6c757d;
    min-width: 40px;
    text-align: center;
}

.reading-area {
    padding: 2rem;
    line-height: 1.8;
    font-size: 16px;
    color: #2c3e50;
}

.chapter-content h3 {
    font-size: 1.5rem;
    color: #8b4513;
    margin-bottom: 1.5rem;
    text-align: center;
}

.chapter-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
    text-indent: 2rem;
}

.reader-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.progress-info {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-section {
        width: 100%;
    }
    
    .categories {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .reader-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .reader-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .reader-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .reader-navigation .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .book-actions {
        flex-direction: column;
    }
    
    .reading-area {
        padding: 1.5rem;
    }
    
    .chapter-content p {
        text-indent: 1rem;
    }
}

/* Hero Section Button Styling */
.hero-buttons {
    display: flex;
    justify-content: center; /* يوسط الأزرار أفقيًا */
    align-items: center; /* يوسط الأزرار عموديًا */
    gap: 1rem; /* يضيف مسافة بين الأزرار */
    flex-wrap: wrap; /* يسمح للأزرار بالالتفاف إلى سطر جديد عند الحاجة */
}

/* Media Query for smaller screens */
@media (max-width: 768px) {
    .hero-buttons {
        flex-direction: column; /* يرتب الأزرار بشكل عمودي على الشاشات الصغيرة */
        width: 100%; /* يجعل الحاوية تشغل كامل العرض */
    }

    .hero-buttons .btn {
        width: 80%; /* يجعل الأزرار تشغل معظم العرض */
        margin-bottom: 1rem; /* يضيف مسافة سفلية بين الأزرار المكدسة */
    }
}