:root {
  --bg: #ffffff;
  --text: #222;
  --accent: #3b82f6;
  --card-bg: #f9f9f9;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}

/* Header */
header {
  padding: 1rem;
  text-align: center;
}

h2 {
  text-align: center;
  margin-top: 1rem;
}

/* Divider between main heading + section heading */
.section-divider {
  border: none;
  border-top: 1.5px solid #ddd; /* thinner line */
  margin: 0.6rem auto;          /* less spacing */
  width: 50%;                   /* narrower for neat look */
}

/* Section Title (ebooks subheading) */
.section-title {
  text-align: center;
  font-size: 1.4rem;   /* smaller font */
  margin: 0.6rem 0;    /* tighter spacing */
  color: var(--text);
}

/* Loader */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #666;
}

.spinner {
  border: 6px solid #f3f3f3;  /* Light grey */
  border-top: 6px solid #888; /* Darker grey for animation */
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Product Grid - 4 columns */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);  /* Always 4 in a row */
  gap: 1.5rem;  /* spacing between cards */
  padding: 2rem;
  max-width: 1400px;   /* Keeps content centered */
  margin: 0 auto;
}

/* Product Card */
.product-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}
.product-card:hover {
  transform: translateY(-4px);
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.product-card h3 {
  font-size: 1rem;
  font-weight: bold;
  margin: 0.5rem 0;
  text-align: center;
  height: 2.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card p {
  font-size: 0.85rem;
  color: #555;
  text-align: center;
  margin: 0.3rem 0;
  max-height: 3.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card .desc {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.3;
  margin: 0.4rem 0;
}

.price {
  color: var(--accent);
  font-weight: bold;
  margin-top: 0.3rem;
}

button {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
button:hover {
  background: #2563eb;
}

/* Footer */
footer {
  background: #f5f5f5;
  padding: 1.5rem 1rem;
  text-align: center;
  margin-top: 2rem;
  border-top: 1px solid #ddd;
}

footer .footer-links {
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
}

footer .footer-links a {
  color: inherit;         /* same as normal text */
  text-decoration: none;  /* no underline */
  margin: 0 0.6rem;
}

footer .footer-links a:hover,
footer .footer-links a:active,
footer .footer-links a:visited {
  color: inherit;         /* no blue/purple */
  text-decoration: none;  /* no underline */
}

footer .copyright {
  font-size: 0.85rem;
  color: #666;
}

/* Toast */
#toast {
  visibility: hidden;
  min-width: 200px;
  background: var(--accent);
  color: white;
  text-align: center;
  border-radius: 5px;
  padding: 0.8rem;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
}
#toast.show {
  visibility: visible;
  animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
@keyframes fadein { 
  from {bottom: 0; opacity: 0;} 
  to {bottom: 30px; opacity: 1;} 
}
@keyframes fadeout { 
  from {bottom: 30px; opacity: 1;} 
  to {bottom: 0; opacity: 0;} 
}
