/* style.css - Green Theme with RTL support and Bahij font */
@font-face {
    font-family: 'Bahij';
    src: url('fonts/Bahij_TheSansArabic-Plain.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Bahij';
    src: url('fonts/Bahij_TheSansArabic-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}
/* For your existing tagline */
.tagline {
    font-size: 0.8rem;
    opacity: 0.8;
    text-align: right;
    margin-left: 15px;
}

/* Mobile styles */
@media (max-width: 768px) {
    .search-area form {
        display: flex;
        flex-direction: column; /* Stack vertically on mobile */
        align-items: stretch;
        gap: 10px; /* Add space between tagline and search bar */
    }
    
    .tagline {
        text-align: right; /* Center align on mobile */
        margin: 0 0 10px 0; /* Add space below tagline */
        order: 1; /* Make sure tagline comes first */
    }
    
    .search-input-group {
        order: 2; /* Search comes after tagline */
    }
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Bahij', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.8;
    color: #333;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

/* RTL/LTR direction based on language */
body[dir="rtl"] {
    text-align: right;
}

body[dir="ltr"] {
    text-align: left;
}

/* Main color theme */
:root {
    --primary-color: #1C685C;
    --primary-dark: #3F625C;
    --primary-light: #71B086;
    --secondary-color: #BF8F2B;
    --accent-color: #FF9A3D;
    --text-color: #FDFFFF;
    --text-light: #666666;
    --background-light: #FFFFFF;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --border-radius: 10px;
}



.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */

.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 0.3rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
	transition: transform 1s ease-in-out;
}
/* DISAPPEARING HEADER */
.header.header-hidden {
    transform: translateY(-100%);
    transition: transform 0.9s ease-in-out;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo h1 {
    font-size: 2.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.logo p {
    font-size: 1rem;
    opacity: 0.9;
}

.header {
    background: linear-gradient(135deg, #1C685C, #6BC06F);
    color: white;
    padding: 5px 0 !important; /* Force with !important */
    margin: 0 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    line-height: 1;
}

.header .container {
    padding: 0 15px !important;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px; /* Set explicit height */
}

.logo h1 {
    font-size: 2rem;
    margin: 0;
    padding: 0;
}

.logo p {
    font-size: 0.8rem;
    margin: 0;
    padding: 0;
    display: none; /* Hide subtitle to save space */
}

.header a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.header a:hover {
    opacity: 0.9;
    text-decoration: underline;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.lang-btn:hover, .lang-btn.active {
    background: white;
    color: var(--primary-dark);
}

/* Search Box */
.search-box {
    margin: 30px 0;
    text-align: center;
}

.search-box input {
    width: 70%;
    max-width: 500px;
    padding: 14px 20px;
    border: 2px solid var(--primary-light);
    border-radius: 30px;
    font-size: 1.1rem;
    font-family: 'Bahij', sans-serif;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 231, 143, 0.2);
}



.search-box button {
    padding: 14px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    margin-right: 10px;
    transition: all 0.3s;
    font-family: 'Bahij', sans-serif;
}

.search-box button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Categories */
.categories {
    margin: 30px 0;
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 15px 0;
}

.category-btn {
    background: var(--secondary-color);
    color: #FFFFFF;
    padding: 10px 22px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.category-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--primary-dark);
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin: 40px 0;
}

.book-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.book-cover {
    height: 250px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.book-cover img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
    transition: transform 0.5s;
}

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

.book-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #50C2C6;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
}

.book-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--secondary-color);
    line-height: 1.4;
    height: 3.2em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Make header thinner */
.navbar, header, .site-header {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    min-height: 40px !important;
}

/* Reduce logo size if needed */
.navbar-brand img {
    height: 40px !important;
    max-height: 40px !important;
}

/* Reduce padding in nav items */
.nav-link {
    padding: 0.25rem 0.75rem !important;
}

/* Reduce search bar size */
.search-form, .form-control {
    height: 35px !important;
}

/* Compact book cards */
.book-card, .card {
    margin-bottom: 15px !important;
    border-radius: 8px !important;
}

/* Reduce card padding */
.card-body {
    padding: 12px !important;
}

/* Smaller book titles */
.book-title, .card-title {
    font-size: 14px !important;
    line-height: 1.3 !important;
    margin-bottom: 5px !important;
    height: 36px !important;
    overflow: hidden !important;
}

/* Smaller author/text */
.book-author, .card-text, .book-info {
    font-size: 12px !important;
    line-height: 1.2 !important;
    margin-bottom: 3px !important;
}

/* Smaller category badges */
.badge, .category-badge {
    font-size: 10px !important;
    padding: 3px 6px !important;
}

/* Reduce image container size */
.book-cover-container, .card-img-top {
    height: 160px !important;
    overflow: hidden !important;
}

/* Compact grid - show more books */
@media (min-width: 768px) {
    .col-md-3 {
        width: 20% !important; /* 5 books per row */
        flex: 0 0 20% !important;
        max-width: 20% !important;
    }
}

@media (min-width: 992px) {
    .col-lg-3 {
        width: 16.666% !important; /* 6 books per row */
        flex: 0 0 16.666% !important;
        max-width: 16.666% !important;
    }
}

/* For mobile */
@media (max-width: 767px) {
    .col-sm-6 {
        width: 33.333% !important; /* 3 books per row */
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }
    
    .book-cover-container, .card-img-top {
        height: 120px !important;
    }
    
    .book-title {
        font-size: 12px !important;
        height: 32px !important;
    }
}

.book-author {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.book-meta {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
}

.book-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.details-btn, .download-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.details-btn {
    background: var(--secondary-color);
    color: white;
    border: 2px solid var(--secondary-color);
}

.details-btn:hover {
    background: transparent;
    color: var(--secondary-color);
}

.download-btn {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
}

.download-btn:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Book Details Page */
.book-details-container {
    max-width: 1000px;
    margin: 40px auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.book-details-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 30px;
    text-align: center;
}

.book-details-content {
    padding: 40px;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
}

.book-details-cover {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
}

.book-details-cover img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.book-details-info {
    padding: 10px 0;
}

.book-details-title {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
    line-height: 1.3;
}

.book-details-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.meta-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.book-details-description {
    margin: 30px 0;
    line-height: 1.8;
    color: var(--secondary-color);
    font-size: 1.05rem;
}

.download-large-btn {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 18px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s;
    border: 3px solid var(--primary-color);
    text-align: center;
    margin-top: 20px;
}

.download-large-btn:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(139, 231, 143, 0.3);
}

/* Footer */
.footer {
    background: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 40px 0;
    margin-top: 60px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

/* Admin Panel Styles */
.menu {
    background: var(--secondary-color);
    padding: 15px;
    margin-bottom: 30px;
    border-radius: var(--border-radius);
}

.menu a {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s;
}

.menu a:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .book-details-content {
        grid-template-columns: 1fr;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .search-box input {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .book-details-meta {
        grid-template-columns: 1fr;
    }
}

/* ===== COMPACT BOOK DETAILS PAGE ===== */
.book-details-container {
    max-width: 1000px;
    margin: 20px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.book-details-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px 30px;
    text-align: center;
    min-height: auto;
}

.book-details-header h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
    line-height: 1.3;
}

.book-details-header p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
}

.book-details-content {
    padding: 25px;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 25px;
    align-items: start;
}

/* Compact book cover */
.book-details-cover {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 320px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.book-details-cover img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
    object-fit: contain;
}

/* Compact book info */
.book-details-info {
    padding: 0;
}

.book-details-title {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
    line-height: 1.3;
    font-weight: bold;
}

/* Compact metadata grid */
.book-details-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 3px;
}

.meta-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.meta-value a {
    color: var(--primary-dark);
    text-decoration: none;
    transition: color 0.3s;
}

.meta-value a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Compact description */
.book-details-description {
    margin: 20px 0;
    line-height: 1.6;
    color: var(--text-color);
    font-size: 0.95rem;
}

.book-details-description h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.book-details-description p {
    max-height: 120px;
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 0;
}

/* Compact download button */
.download-container {
    background: linear-gradient(135deg, #f8fff8 0%, #e8f7e8 100%);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    border: 2px solid var(--primary-light);
    text-align: center;
}

.download-large-btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 14px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(139, 231, 143, 0.3);
}

.download-large-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 231, 143, 0.4);
}

.download-count {
    display: block;
    margin-top: 10px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Similar books section */
.similar-books {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.similar-books h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

/* Breadcrumb */
.breadcrumb {
    margin: 15px 0;
    font-size: 0.9rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--primary-dark);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 992px) {
    .book-details-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .book-details-cover {
        height: 280px;
        max-width: 280px;
        margin: 0 auto;
    }
    
    .book-details-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .book-details-container {
        margin: 10px auto;
    }
    
    .book-details-header {
        padding: 15px 20px;
    }
    
    .book-details-header h1 {
        font-size: 1.4rem;
    }
    
    .book-details-content {
        padding: 20px;
    }
    
    .book-details-meta {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .download-large-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .book-details-description p {
        max-height: 100px;
    }
}

@media (max-width: 480px) {
    .book-details-cover {
        height: 220px;
    }
    
    .book-details-header h1 {
        font-size: 1.2rem;
    }
    
    .book-details-title {
        font-size: 1.1rem;
    }
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* COMPACT BOOK CARDS */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); /* Changed from 220px */
    gap: 15px; /* Changed from 25px */
    margin: 20px 0; /* Changed from 40px */
}

.book-card {
    background: white;
    border-radius: 8px; /* Changed from var(--border-radius) */
    overflow: hidden;
    transition: all 0.3s ease; /* Changed from 0.4s cubic-bezier */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Lighter shadow */
    height: 100%;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-5px) scale(1.02); /* Reduced from -10px */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.book-cover {
    height: 150px; /* Changed from 250px */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px; /* Changed from 20px */
}

.book-info {
    padding: 10px; /* Changed from 20px */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 13px; /* Changed from 1.2rem (approx 19px) */
    font-weight: bold;
    margin-bottom: 5px; /* Changed from 10px */
    color: var(--secondary-color);
    line-height: 1.3;
    height: 34px; /* For 2 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.book-author {
    color: var(--text-light);
    font-size: 11px; /* Changed from 0.95rem (approx 15px) */
    margin-bottom: 8px; /* Changed from 15px */
}

.book-meta {
    color: var(--text-light);
    font-size: 10px; /* Changed from 0.85rem (approx 14px) */
    margin-bottom: 10px; /* Changed from 15px */
}

.book-actions {
    margin-top: auto;
    display: flex;
    gap: 5px; /* Changed from 10px */
}

.details-btn, .download-btn {
    padding: 6px; /* Changed from 10px */
    font-size: 11px; /* Smaller text */
}


/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(139, 231, 143, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}