html,
body {
  height: 100%;
  width: 100%;
  background-color: #ffffff;
}

body.theme-dark {
  background-color: #111;
}

/* Modern Educational Preloader */
.preloader {
  position: fixed;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
  background-size: 400% 400%;
  animation: gradientBackground 12s ease infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
  overflow: hidden;
}

.preloader::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 20% 80%,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(255, 255, 255, 0.05) 0%,
      transparent 50%
    );
  animation: backgroundFloat 6s ease-in-out infinite;
}

.theme-dark .preloader {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
}

.preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.preloader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  animation: containerFadeIn 1s ease-out;
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

/* Educational Loader Animation */
.education-loader {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 1rem;
}

.book-stack {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.book {
  position: absolute;
  width: 60px;
  height: 8px;
  border-radius: 2px;
  left: 50%;
  top: 50%;
  transform-origin: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.book-1 {
  background: linear-gradient(45deg, #ff6b6b, #ee5a52);
  transform: translate(-50%, -50%) rotate(0deg);
  animation: bookFloat1 2s ease-in-out infinite;
}

.book-2 {
  background: linear-gradient(45deg, #4ecdc4, #44a08d);
  transform: translate(-50%, -50%) rotate(120deg);
  animation: bookFloat2 2s ease-in-out infinite 0.3s;
}

.book-3 {
  background: linear-gradient(45deg, #45b7d1, #96c93d);
  transform: translate(-50%, -50%) rotate(240deg);
  animation: bookFloat3 2s ease-in-out infinite 0.6s;
}

/* Knowledge Particles */
.knowledge-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: particleFloat 3s ease-in-out infinite;
}

.particle:nth-child(1) {
  top: 20%;
  left: 20%;
  animation-delay: 0s;
}

.particle:nth-child(2) {
  top: 30%;
  right: 20%;
  animation-delay: 0.5s;
}

.particle:nth-child(3) {
  bottom: 30%;
  left: 30%;
  animation-delay: 1s;
}

.particle:nth-child(4) {
  bottom: 20%;
  right: 30%;
  animation-delay: 1.5s;
}

.particle:nth-child(5) {
  top: 50%;
  left: 10%;
  animation-delay: 2s;
}

.particle:nth-child(6) {
  top: 50%;
  right: 10%;
  animation-delay: 2.5s;
}

/* Loading Content Styles */
.loading-content {
  color: white;
  text-align: center;
  animation: contentSlideUp 1s ease-out 0.5s both;
}

.institution-name {
  font-family: "Roboto", sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(45deg, #ffffff, #f0f9ff, #dbeafe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: titleGlow 4s ease-in-out infinite alternate,
    textShimmer 3s ease-in-out infinite;
  letter-spacing: 2px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.loading-text {
  font-family: "Roboto", sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  margin: 0 0 2rem 0;
  opacity: 0.9;
  letter-spacing: 0.5px;
}

.theme-dark .loading-content {
  color: #ecf0f1;
}

/* Progress Bar */
.progress-container {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1);
  background-size: 200% 100%;
  border-radius: 2px;
  width: 0%;
  animation: progressAnimation 3s ease-in-out infinite,
    gradientShift 2s ease-in-out infinite;
}

.loading-percentage {
  font-family: "Roboto", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.8;
  min-width: 30px;
}

@media (max-width: 1199px) {
  .header {
    display: none;
  }
}

@media (max-width: 768px) {
  .institution-name {
    font-size: 2.2rem;
    letter-spacing: 1px;
  }

  .loading-text {
    font-size: 1rem;
  }

  .progress-container {
    width: 240px;
  }

  .preloader-container {
    padding: 1rem;
    gap: 2rem;
  }

  .education-loader {
    width: 100px;
    height: 100px;
  }
}

/* Book Loader - 50% smaller and moved slightly more to the right */
.book {
  position: fixed;
  width: 60px; /* 50% smaller than previous size */
  height: 80px; /* 50% smaller than previous size */
  top: 54%;
  left: 50.5%;
  /*    transform: translate(-50%, -50%);*/
}

/* Base page styling with colorful backgrounds */
.page {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  transform-origin: left;
  box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.3);
  opacity: 1;
}

/* Colorful gradients for each page */
.page:nth-child(1) {
  background: linear-gradient(to right, #ff7e5f, #feb47b); /* Warm gradient */
  animation: flip 0.8s infinite ease-in-out; /* Faster animation */
  animation-delay: 0s;
}
.page:nth-child(2) {
  background: linear-gradient(
    to right,
    #6a11cb,
    #2575fc
  ); /* Purple to blue gradient */
  animation: flip 0.8s infinite ease-in-out; /* Faster animation */
  animation-delay: 0.5s;
}
.page:nth-child(3) {
  background: linear-gradient(to right, #00b4db, #0083b0); /* Aqua gradient */
  animation: flip 0.8s infinite ease-in-out; /* Faster animation */
  animation-delay: 1s;
}

/* Page flipping animation */
@keyframes flip {
  0% {
    transform: rotateY(0deg);
    opacity: 1;
  }
  25% {
    transform: rotateY(-45deg);
    opacity: 0.9;
  }
  50% {
    transform: rotateY(-90deg);
    opacity: 0.8;
  }
  75% {
    transform: rotateY(-135deg);
    opacity: 0.7;
  }
  100% {
    transform: rotateY(-180deg);
    opacity: 0.6;
  }
}

/* Dark Theme Adjustments */
.theme-dark .page:nth-child(1) {
  background: linear-gradient(to right, #ff7e5f, #feb47b); /* Warm gradient */
}
.theme-dark .page:nth-child(2) {
  background: linear-gradient(
    to right,
    #6a11cb,
    #2575fc
  ); /* Purple to blue gradient */
}
.theme-dark .page:nth-child(3) {
  background: linear-gradient(to right, #00b4db, #0083b0); /* Aqua gradient */
}

.preloader .loader::after {
  content: "";
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #fff, #f0f0f0, #fff);
  background-size: 200% 100%;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 3px;
  animation: progressBar 2.5s ease-in-out infinite;
}

.theme-dark .preloader .loader::after {
  background: linear-gradient(90deg, #ecf0f1, #bdc3c7, #ecf0f1);
  background-size: 200% 100%;
}

.header {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  inline-size: 100%;
}
.header-container {
  max-inline-size: 1200px;
  margin-inline: auto;
  padding: 1.28rem 1.6rem;
  background-color: #fff;
  box-shadow: 0px 6px 12px -3px rgba(4, 97, 165, 0.1);
  border-radius: 0 0 0.625rem 0.625rem;
}

.theme-dark .header-container {
  background-color: #111;
}
.header .logo {
  max-height: 30px;
}
.placeholder {
  block-size: 0.825rem;
  inline-size: 3rem;
  background-color: #f5f5f5;
  border-radius: 0.3rem;
}

.theme-dark .placeholder {
  background-color: #111;
}

.placeholder-wide {
  inline-size: 12rem;
}

.d-flex {
  display: flex;
}
.align-items-center {
  align-items: center;
}
.justify-content-center {
  justify-content: center;
}
.justify-content-between {
  justify-content: space-between;
}
.flex-column {
  flex-direction: column;
}
.gap-3 {
  gap: 1rem;
}
.gap-4 {
  gap: 1.5rem;
}
.gap-5 {
  gap: 3rem;
}
/* Modern Educational Animations */
@keyframes containerFadeIn {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bookFloat1 {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(0deg) translateY(0px);
  }
  50% {
    transform: translate(-50%, -50%) rotate(0deg) translateY(-15px);
  }
}

@keyframes bookFloat2 {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(120deg) translateY(0px);
  }
  50% {
    transform: translate(-50%, -50%) rotate(120deg) translateY(-15px);
  }
}

@keyframes bookFloat3 {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(240deg) translateY(0px);
  }
  50% {
    transform: translate(-50%, -50%) rotate(240deg) translateY(-15px);
  }
}

@keyframes particleFloat {
  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0px) scale(0.8);
  }
  50% {
    opacity: 1;
    transform: translateY(-20px) scale(1.2);
  }
}

@keyframes contentSlideUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes titleGlow {
  0% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  }
  100% {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.6),
      0 0 30px rgba(255, 255, 255, 0.3);
  }
}

@keyframes textShimmer {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes progressAnimation {
  0% {
    width: 0%;
  }
  70% {
    width: 85%;
  }
  100% {
    width: 100%;
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes gradientBackground {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes backgroundFloat {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-10px) rotate(1deg);
  }
  66% {
    transform: translateY(5px) rotate(-1deg);
  }
}

/* Legacy animation for backward compatibility */
@keyframes animloader {
  0% {
    left: 0;
    transform: translateX(-100%);
  }
  100% {
    left: 100%;
    transform: translateX(0%);
  }
}

@keyframes animloaderimg {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1rem);
  }
  100% {
    transform: translateY(0);
  }
}
