/* Color variables for maintainability */
:root {
  --primary-dark: #003f5c;
  --primary: #0088cc;
  --primary-light: #4db8ff;
  --accent: #ff6b6b;
  --white: #ffffff;
}

/* Background gradients */
.gradient-bg,
.hero-gradient {
  background: linear-gradient(
    135deg,
    var(--primary-dark) 0%,
    var(--primary) 100%
  );
}

.hero-gradient {
  background: linear-gradient(
    135deg,
    var(--primary-dark) 0%,
    var(--primary) 50%,
    var(--primary-light) 100%
  );
}

.section-bg {
  background: linear-gradient(135deg, #f5f7fa 0%, #e6f7ff 100%);
  position: relative;
  overflow: hidden;
}

.section-bg::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%230088cc' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* Glass effects */
.glass-effect,
.form-input {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Text effects */
.text-glow {
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Animations */
@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes float-card {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(5deg);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
  }
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes countUp {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes gradient-x {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Animation classes */
.floating-animation {
  animation: float 6s ease-in-out infinite;
}
.floating-shape {
  animation: float-card 8s ease-in-out infinite;
}
.pulse-animation {
  animation: pulse 2s infinite;
}
.slide-in {
  animation: slideIn 0.8s ease-out forwards;
  opacity: 0;
  transform: translateY(30px);
}

.animate-count-up {
  animation: countUp 0.5s ease-out;
}
.animate-gradient-x {
  animation: gradient-x 3s ease infinite;
}

/* Stagger animation */
.stagger-animation > * {
  opacity: 0;
  animation: slideIn 0.8s ease-out forwards;
}

.stagger-animation > *:nth-child(1) {
  animation-delay: 0.1s;
}
.stagger-animation > *:nth-child(2) {
  animation-delay: 0.3s;
}
.stagger-animation > *:nth-child(3) {
  animation-delay: 0.5s;
}
.stagger-animation > *:nth-child(4) {
  animation-delay: 0.7s;
}
.stagger-animation > *:nth-child(5) {
  animation-delay: 0.9s;
}

/* Card components with shared hover effects */
.feature-card,
.stat-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feature-card::before,
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.feature-card:hover::before,
.stat-card:hover::before {
  opacity: 1;
}

.feature-card:hover {
  transform: translateY(-10px);
}
.stat-card:hover {
  transform: translateY(-8px);
}

.feature-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Icon wrapper transitions */
.icon-wrapper {
  transition: all 0.4s ease;
}

.feature-card:hover .icon-wrapper,
.stat-card:hover .icon-wrapper {
  transform: scale(1.1) rotate(5deg);
}

.stat-card:hover .icon-wrapper {
  transform: scale(1.08) rotate(5deg);
}

/* Book components */
.book-cover {
  perspective: 1000px;
}

.book-cover-inner {
  transition: transform 0.6s;
  transform-style: preserve-3d;
  transform: rotateY(15deg);
}

.book-cover:hover .book-cover-inner {
  transform: rotateY(5deg);
}

.author-avatar {
  transition: transform 0.3s ease;
}

.author-avatar:hover {
  transform: translateY(-5px);
}

/* Book cards */
.book-card-modern {
  flex: 0 0 320px;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.book-card-modern:hover {
  transform: translateY(-15px) scale(1.02);
}

.book-image-wrapper {
  transition: all 0.5s ease;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.1));
}

.book-card-modern:hover .book-image-wrapper {
  filter: drop-shadow(0 25px 50px rgba(0, 0, 0, 0.2));
}

.book-overlay {
  /* background: linear-gradient(
    135deg,
    rgba(0, 136, 204, 0.9) 0%,
    rgba(255, 107, 107, 0.9) 100%
  ); */
  background: linear-gradient(
    180deg,
    rgba(225, 225, 225, 0.137) 0%,
    rgba(15, 15, 15, 0.68) 100%
  );
  opacity: 0;
  transition: all 0.3s ease;
}

.book-card-modern:hover .book-overlay {
  opacity: 1;
}

/* Utility classes */
.counter {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  transition: all 0.5s ease-out;
}

.bg-size-200 {
  background-size: 200% 200%;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* featured book slider */
.book-card-modern {
  /* equivalent to flex: 0 0 calc(33.333% - 1.33rem); and min-width: 0 */
  flex: 0 0 calc(33.333% - 2rem / 3 * 2); /* 2rem is gap-8, need to distribute gap-x/n evenly */
  min-width: 0;
}

@media (max-width: 1024px) {
  /* equivalent to flex: 0 0 calc(50% - 1rem); */
  .book-card-modern {
    flex: 0 0 calc(50% - 1rem); /* 2rem is gap-8 */
  }
}

@media (max-width: 640px) {
  /* equivalent to flex: 0 0 100%; */
  .book-card-modern {
    flex: 0 0 100%;
  }
}

/* Corner accents using custom colors from config */
.book-image-wrapper::before,
.book-image-wrapper::after {
  content: "";
  position: absolute;
  width: 1.5rem;
  height: 1.5rem;
  opacity: 0.3;
  transition: opacity 0.3s ease;
}

.book-image-wrapper::before {
  top: 0;
  left: 0;
  border-top-left-radius: 1rem;
}

.book-image-wrapper::after {
  bottom: 0;
  right: 0;
  border-bottom-right-radius: 1rem;
}

.book-card-modern:hover .book-image-wrapper::before,
.book-card-modern:hover .book-image-wrapper::after {
  opacity: 0.7;
}

/* Truncate book title to 2 lines */
.book-info h3 {
  display: -webkit-box;
  /* -webkit-line-clamp: 2; */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Custom CSS for the Premium Feature Card Effect */
.feature-card-premium {
  /* Initial subtle glow/shadow */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

.feature-card-premium:hover {
  /* Lifted shadow on hover */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1), 0 0 40px rgba(0, 136, 204, 0.1);
}

/* The Glow Line Element */
.glow-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px; /* Thickness of the line */
  transform: translateY(-100%); /* Start position: hidden above the top edge */
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s;
}

/* Hover Effect */
.feature-card-premium:hover .glow-line {
  transform: translateY(0); /* End position: visible at the top edge */
  opacity: 1;
}

/* Optional: Subtle Inner Shadow for Icon */
/* This makes the icon wrapper look slightly debossed */
.icon-wrapper {
  box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Reset the box-shadow for the icon's hover effect (Tailwind's shadow-2xl) */
.icon-wrapper:hover {
  box-shadow: var(--tw-shadow-2xl); /* Use default Tailwind shadow on hover */
}