body {
  margin: 0;
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif; 
  background-color: #fcfbf7;
  overflow-x: hidden; 
}
/* --- Header Formatting --- */
.main-header {
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 1000; 
    background-color: rgba(252, 251, 247, 0.95);
    backdrop-filter: blur(10px);
    padding: 5px 5%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}
/* --- Search bar (left) --- */
.logo-section {
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: right;
}

.logo-icon {
    background-color: #2d4f43;
    color: white;
    width: 38px; 
    height: 38px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;

}

.text-content h1 {
    margin: 0;
    font-size: 20px;
    color: #1a3c34;
    line-height: 1.2;
}

.text-content p {
    margin: 0;
    font-size: 12px; 
    color: #7a7a7a;
}

/* --- Search bar (right) --- */
.search-container {
    position: relative;
    width: 100%;
    max-width: 320px;
}

.search-container input {
    width: 100%;
    padding: 8px 40px 8px 15px; 
    border: 1px solid #e0ddd5;
    border-radius: 10px;
    background-color: #f4f1ea;
    outline: none;
    font-size: 13px;
    box-sizing: border-box;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 12px;
}

.hero-section {
  text-align: center;
  padding: 40px 20px;
  background-color: #fcfbf7;
}

.hero-content h1 {
    font-size: clamp(24px, 5vw, 42px);
    color: #1a3c34;
    margin-bottom: 15px;
}

.hero-content p {
    font-size: clamp(14px, 2vw, 18px);
    color: #8c8c8c;
    max-width: 700px;
    margin: 0 auto 30px auto;
    line-height: 1.6;
}

.filter-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.tag {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    background-color: #f1ede4;
    transition: 0.3s;
}

.tag.active {
  background-color: #2d4f43; 
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(45, 79, 67, 0.2);
}

.tag:hover:not(.active) {
  background-color: #e5e0d5;
}

.books-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  direction: rtl; 
}

.stats-bar {
  text-align: left;
  margin-bottom: 20px;
  color: #8c8c8c;
  font-size: 14px;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 20px;
}

.book-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: 0.3s;
    border: 1px solid #f0f0f0;
}

.book-card:hover {
  transform: translateY(-5px);
}

.cover-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 8px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.card-header {
  position: relative;
  padding: 15px;
  height: 220px;
  background: linear-gradient(135deg, #e8e6e1 0%, #f4f1ea 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.category-badge {
  position: absolute;
  top: 15px;
  left: 15px; 
  background: rgba(255, 255, 255, 0.9);
  padding: 5px 12px;
  border-radius: 10px;
  font-size: 11px;
  color: #555;
}

.book-placeholder .icon {
  font-size: 60px;
  opacity: 0.3;
}

.card-body {
  padding: 20px;
  text-align: right;
  z-index: 2;
}

.book-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #1a3c34;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.book-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 13px;
  color: #7a7a7a;
}

.book-info p {
  margin: 0;
}

.download-btn {
  width: 100%;
  display: flex; 
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  padding: 12px;
  border: none;
  font-size: small;
  border-radius: 12px;
  background-color: #2d4f43;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
  text-decoration: none;
  
}

.download-btn:hover {
  background-color: #1a3c34;
}

.main-footer {
    padding: 40px 20px;
    background: #f4f1ea;
    margin-top: 50px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px; 
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.logo-text {
  font-weight: bold;
  font-size: 18px;
  color: #1a3c34;
}

.logo-box {
  background-color: #2d4f43;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
}

.made-with {
  font-size: 14px;
  color: #8c8c8c;
  margin: 0;
}

.heart {
  color: #8a26e6;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;

}
.heart:hover{
  color: #5600ab;
  transform: scale(1.05);
  
}

.copyright {
  font-size: 12px;
  color: #b0b0b0;
  margin: 0;
}

.modal {
  display: none; 
  position: fixed;
  z-index: 2000; 
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6); 
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
}

.modal-content {
    background-color: #fff;
    width: 95%;
    max-width: 700px;
    margin: 20px;
    max-height: 90vh; 
    overflow-y: auto; 
    border-radius: 15px;
    padding: 20px;
}

.close-btn {
  position: absolute;
  top: 15px;
  left: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #888;
  transition: 0.3s;
}

.close-btn:hover {
  color: #e74c3c;
}

.modal-body {
    display: flex;
    flex-direction: row; 
    gap: 20px;
}

.modal-image {
  flex: 1;
  background: #f4f1ea;
  height: 250px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 15px;
  font-size: 80px;
}

.modal-text {
  flex: 1.5;
}

.modal-text h2 {
  color: #1a3c34;
  margin-top: 0;
}

.modal-category {
  color: #2d4f43;
  font-weight: bold;
  font-size: 14px;
}

.description {
  color: #666;
  line-height: 1.6;
  font-size: 14px;
  margin: 15px 0;
}

.book-card {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.book-card[style*="display: block"] {
    animation: fadeIn 0.4s ease forwards;
}

/* --- Media Queries --- */

/* (Tablets) */
@media (max-width: 992px) {
    .container {
        justify-content: center;
        text-align: center;
    }
    .search-container {
        max-width: 100%;
    }
    .logo-section {
      white-space: nowrap;
      flex-wrap: nowrap;
      gap: 10px;
      margin-left: 10px;
    }
    
    
}

/* (Phones) */
@media (max-width: 768px) {
    .logo-section {
      white-space: nowrap;
      flex-wrap: nowrap;
      gap: 5px;
        
    }
    
    .modal-body {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-image {
        width: 100%;
        height: 200px;
    }

    .footer-container {
        text-align: center;
    }
}

/* For very small phones */
@media (max-width: 480px) {
    .main-header {
        padding: 10px;
    }
    .text-content h1 {
        font-size: 20px;  
    }
    .tag {
        flex: 1 1 40%;
        text-align: center;
    }
    .container {
        flex-direction: column;
        padding: 10px 0;
    }
    
    .logo-section {
        flex-direction: row-reverse;
        margin-bottom: 5px;
    }
    
    .search-container {
        max-width: 100%;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 480px) {
  .main-footer {
    padding: 30px 15px;
  }
}

@media (max-width: 600px) {
  .books-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
    .books-grid {
        grid-template-columns: 1fr; 
    }
}

@media (max-width: 600px) {
  .hero-content h1 {
    font-size: 28px;
  }
  .hero-content p {
    font-size: 15px;
  }
  .tag {
    padding: 8px 18px;
    font-size: 14px;
  }
}
