/* 🌐 Global Styles */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f6f9;
  color: #333;
  padding-bottom: 80px; /* same or bigger than footer height */
}

/* ✅ Login Page */
.login-container {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
  width: 300px;
  text-align: center;
  margin: 100px auto; /* instead of flex full height */
}

.login-container h2 {
  margin-bottom: 20px;
  color: #333;
}

.login-container input {
  width: 90%;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.login-container button {
  width: 100%;
  padding: 10px;
  background: #0077ff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.login-container button:hover {
  background: #005fcc;
}

#error-msg {
  color: red;
  margin-top: 10px;
  font-size: 14px;
}

/* ✅ Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0077ff;
  color: #fff;
  padding: 12px 20px;
}
header h2 {
  margin: 0;
  font-size: 20px;
}
header button {
  background: #fff;
  color: #0077ff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

/* ✅ Search */
.search-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;   /* fixes alignment */
  margin: 20px;
  gap: 10px;
}
.search-container input {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.search-container button {
  padding: 8px 14px;
  border: none;
  background: #0077ff;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}

/* ✅ Book Cards */
/* ======================= Book Cards Container ======================= */
#booksList {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 16px;
  align-items: stretch; /* all cards in a row same height */
  box-sizing: border-box;
}

/* ======================= Individual Book Card ======================= */
.book-card {
  background: white;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
  transition: transform 0.2s;
}

.book-card:hover {
  transform: scale(1.03);
}

/* ======================= Book Image ======================= */
.book-img {
  width: 100%;
  aspect-ratio: 2/3;      /* proportional height */
  object-fit: cover;
  object-position: top;    /* show top of image */
  border-radius: 6px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

/* ======================= Book Title ======================= */
.book-card h3 {
  font-size: 15px;
  margin: 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;   /* max 3 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ======================= Author ======================= */
.book-card p {
  font-size: 13px;
  margin: 3px 0;
  color: #555;
  display: -webkit-box;
  -webkit-line-clamp: 2;   /* max 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;            /* pushes button to bottom */
}

/* ======================= Button ======================= */
.book-card button {
  margin-top: auto;        /* always at bottom */
  padding: 5px 10px;
  background: #0077ff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.book-card button:disabled {
  background: gray;
  cursor: not-allowed;
}

/* ======================= Mobile Responsive ======================= */

/* Small phones/tablets: force 2 cards per row */
@media (max-width: 600px) and (min-width: 400px) {
  #booksList {
    grid-template-columns: 1fr 1fr; /* 2 cards per row */
    gap: 12px;
    padding: 12px;
  }

  .book-card {
    padding: 10px;
  }

  .book-img {
    margin-bottom: 8px;
  }

  .book-card h3 {
    font-size: 14px;
  }

  .book-card p {
    font-size: 12px;
  }

  .book-card button {
    font-size: 12px;
    padding: 4px 8px;
  }
}

/* Extra small phones: stack 1 card per row */
@media (max-width: 399px) {
  #booksList {
    grid-template-columns: 1fr; /* 1 card per row */
    gap: 10px;
    padding: 10px;
  }
}



/* ✅ Pagination */
#pagination {
  display: flex;
  justify-content: center;   /* center all items */
  align-items: center;
  gap: 10px;                 /* space between them */
  margin: 20px;
  margin-bottom: 100px;      /* keep above footer */
}
#pageNumbers {
  display: flex;
  gap: 6px;                  /* spacing between page numbers */
}
#pagination button {
  margin: 5px;
  padding: 8px 12px;
  border: none;
  background: #0077ff;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}

/* ✅ Home Page */
.home-container {
  max-width: 600px;
  margin: 40px auto;
  text-align: center;
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
}

.home-container h2 {
  margin-bottom: 10px;
  color: #0077ff;
}

.section-btn {
  display: block;
  width: 100%;
  padding: 15px;
  margin: 12px 0;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #0077ff;
  color: white;
  transition: background 0.3s;
}

/* Disabled state */
.section-btn:disabled {
  background-color: #cccccc;  /* greyed out */
  color: #666666;
  cursor: not-allowed;
}
.section-btn:not(:disabled):hover {
  background: #005fcc;
}

.logout-btn {
  margin-top: 20px;
  background: #ff4444;
}

.logout-btn:hover {
  background: #cc0000;
}

/* ✅ My Books Page */
#myBooksList {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  padding: 20px;
}

.overdue {
  color: red;
  font-weight: bold;
}


/* --- Footer --- */
/* --- Sticky Footer --- */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 12px 0;
  font-size: 0.85rem;
  color: #555;
  background: #fff4e6;
  border-top: 1px solid #e0c8b0;
  box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
  z-index: 1000; /* stays above content */
}

footer p {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
}

.share-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 14px;
  background: #25D366; /* WhatsApp green */
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}
.share-btn:hover {
  background: #1da851;
}

/* Toast Notification */
#toast {
  position: fixed;
  top: 20px;                 /* top center */
  left: 50%;
  transform: translateX(-50%);
  background-color: #0077ff;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  font-family: Arial, sans-serif;
  font-size: 14px;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;       /* allows clicks through it */
  transition: opacity 0.7s ease, transform 0.7s ease;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#toast.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
}

/* Register  */
.register-text {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #333;
}

.register-text a {
  color: #0077ff;
  text-decoration: none;
  font-weight: bold;
  margin-left: 4px;
}

.register-text a:hover {
  text-decoration: underline;
}

/* library-summary  */
.library-summary {
  margin: 30px auto;
  padding: 20px 15px;
  max-width: 650px;
  text-align: center;
  background: #f4faff;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
  font-family: Arial, sans-serif;
  transition: transform 0.3s ease;
}

.library-summary:hover {
  transform: translateY(-3px); /* subtle lift on hover */
}

.library-summary h3 {
  color: #0077ff;
  margin-bottom: 12px;
  font-size: 1.5rem;
}

.library-summary p {
  font-size: 15px;
  line-height: 1.6;
  margin: 8px 0;
}

.library-summary .tagline {
  font-weight: bold;
  color: #333;
  margin-top: 12px;
  transition: opacity 0.8s ease;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .library-summary {
    padding: 18px 12px;
  }

  .library-summary h3 {
    font-size: 1.3rem;
  }

  .library-summary p {
    font-size: 14px;
  }
}

#installBtn {
  display: none; /* stays hidden until eligible */
  background: linear-gradient(45deg, #007bff, #00c6ff);
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.5);
  transition: all 0.3s ease;
}

/* Hover effect for more attention */
#installBtn:hover {
  transform: scale(1.05);
  background: linear-gradient(45deg, #0062ff, #00a8ff);
  box-shadow: 0 6px 16px rgba(0, 123, 255, 0.7);
}

