/* ===========================
   RESET & BASE STYLE
=========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Cairo", sans-serif;
  background: #f5f7fa;
  color: #222;
  line-height: 1.7;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* ===========================
   NAVBAR
=========================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #0d47a1, #1976d2);
  padding: 12px 30px;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
}

.logo img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
}

.search-box {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 25px;
  padding: 5px 10px;
  width: 40%;
  transition: 0.3s ease;
}

.search-box input {
  border: none;
  outline: none;
  flex: 1;
  padding: 8px 10px;
  border-radius: 25px;
  font-size: 0.9rem;
}

.search-btn {
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 50%;
  padding: 8px;
  cursor: pointer;
  transition: 0.3s;
}

.search-btn:hover {
  background: #0d47a1;
}

.auth-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-buttons img {
  width: 30px;
  height: 30px;
  cursor: pointer;
  transition: transform 0.3s;
}

.auth-buttons img:hover {
  transform: scale(1.2);
}

.btn {
  background: #fff;
  color: #1976d2;
  border: 2px solid #1976d2;
  padding: 6px 14px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.btn:hover {
  background: #1976d2;
  color: #fff;
}

/* ===========================
   LAYOUT
=========================== */
.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 20px;
  padding: 20px;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar {
  background: #fff;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  height: calc(100vh - 100px);
  position: sticky;
  top: 90px;
  overflow-y: auto; /* تفعيل السكورول عند زيادة المحتوى */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #1976d2 #e0e0e0;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: #e0e0e0;
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: #1976d2;
  border-radius: 4px;
}

.sidebar nav ul li {
  margin-bottom: 12px;
}

.sidebar a {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 500;
  color: #333;
  transition: 0.3s;
}

.sidebar a:hover {
  background: #1976d2;
  color: #fff;
  padding-left: 18px;
}

.divider {
  font-size: 0.9rem;
  color: #666;
  margin: 15px 0 8px;
  font-weight: bold;
  border-bottom: 1px solid #ddd;
  padding-bottom: 5px;
}

/* ===========================
   MAIN CONTENT
=========================== */
main {
  padding: 10px;
}

/* -------------------
   Book Section
------------------- */
.book-section h2 {
  margin-bottom: 20px;
  font-size: 1.5rem;
  border-bottom: 3px solid #1976d2;
  display: inline-block;
  padding-bottom: 5px;
}

/* -------------------
   BOOK CARDS
------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  perspective: 1000px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 350px;
  transition: transform 0.7s;
  transform-style: preserve-3d;
}

.card:hover .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.card-front img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
}

.card-front h3 {
  font-size: 1rem;
  margin-bottom: 5px;
  font-weight: bold;
}

.card-front .author {
  font-size: 0.85rem;
  color: #555;
}

.card-back {
  transform: rotateY(180deg);
  font-size: 0.9rem;
}

.card-back h3 {
  color: #1976d2;
  margin-bottom: 8px;
}

.card-back h4 {
  margin: 8px 0;
  font-weight: bold;
}

.card-back p {
  margin-bottom: 8px;
}

.card-back .btn {
  margin-top: 10px;
}

/* ===========================
   FOOTER
=========================== */
.site-footer {
  margin-top: 40px;
  background: #0d47a1;
  color: #fff;
  padding: 25px 20px;
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 15px;
}

.footer-links {
  display: flex;
  gap: 15px;
  align-items: center;
}

.footer-links a img {
  width: 25px;
  transition: transform 0.3s;
}

.footer-links a img:hover {
  transform: scale(1.3);
}

.footer-links a {
  color: #fff;
  font-size: 0.9rem;
  transition: 0.3s;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* ===========================
   SLIDER
=========================== */
.slider {
  margin: 70px auto;
  position: relative;
  width: 70%;
  height: 500px;
  overflow: hidden;
}

.slide {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  animation: fadeSlide 12s infinite;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide:nth-child(1){animation-delay:0s}
.slide:nth-child(2){animation-delay:4s}
.slide:nth-child(3){animation-delay:8s}
.slide:nth-child(4){animation-delay:12s}
.slide:nth-child(5){animation-delay:16s}
.slide:nth-child(6){animation-delay:20s}
.slide:nth-child(7){animation-delay:24s}
.slide:nth-child(8){animation-delay:28s}
.slide:nth-child(9){animation-delay:32s}
.slide:nth-child(10){animation-delay:36s}

@keyframes fadeSlide {
  0%{opacity:0}
  5%{opacity:1}
  30%{opacity:1}
  35%{opacity:0}
  100%{opacity:0}
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 200px 1fr;
  }

  .slider {
    width: 90%;
    height: 400px;
  }

  .sidebar {
    height: calc(100vh - 80px);
  }
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 15px;
  }

  .sidebar {
    position: relative;
    top: 0;
    height: auto;
    margin-bottom: 20px;
  }

  .slider {
    width: 95%;
    height: 300px;
  }
}

@media (max-width: 480px) {
  .slider {
    width: 100%;
    height: 250px;
  }

  .search-box {
    width: 60%;
  }

  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
