/* === General Page Styling === */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
  background: linear-gradient(to top, #f8c3d8 0%, #d8d4f2 50%, #c7dbf7 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  text-align: center;
  color: #333;
  display: flex;
  flex-direction: column;
}

/* === Header === */
header {
  background: #4a148c;
  color: white;
  padding: 25px 10px;
  border-bottom: 5px solid #7b1fa2;
}

header h1 {
  margin: 0;
  font-size: 2.5em;
  animation: float 2s ease-in-out infinite alternate;
}

header p {
  margin: 5px 0;
}

@keyframes float {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.marq {
  background: #7b1fa2;
  color: #fff;
  font-weight: bold;
  padding: 8px;
  margin-top: 10px;
  border-radius: 8px;
}

/* === Semester Cards (Home Grid View) === */
.sem-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  padding: 40px 20px;
}

.sem-card {
  background: white;
  padding: 25px;
  border-radius: 15px;
  width: 180px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.2em;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  animation: popIn 0.6s ease forwards;
  opacity: 0;
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.sem-card:hover {
  background: #7b1fa2;
  color: white;
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* === Notes Section === */
.hidden { display: none; }

#notes-section {
  margin-top: 30px;
  padding: 20px;
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Scrollable Notes Box === */
.notes-box {
  width: 80%;
  max-width: 600px;
  height: 400px; /* fixed height */
  margin: 20px auto;
  padding: 15px;
  background: #ffffffb3;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #9b59b6 #f0f0f0;
}

/* Custom Scrollbar for Chrome, Edge, Safari */
.notes-box::-webkit-scrollbar {
  width: 8px;
}
.notes-box::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 10px;
}
.notes-box::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #a259ff, #6a11cb);
  border-radius: 10px;
}

#notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#notes-list li {
  background: white;
  border-radius: 10px;
  margin: 10px auto;
  width: 85%;
  padding: 15px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

a.download-link {
  text-decoration: none;
  color: #4a148c;
  font-weight: bold;
  display: inline-block;
  margin-top: 8px;
}

/* === Back Button === */
#back-btn {
  background: #4a148c;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  margin-top: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: 0.3s;
}

#back-btn:hover {
  background: #6a1b9a;
}

/* === Footer === */
footer {
  background: #4a148c;
  color: white;
  padding: 15px;
  font-size: 0.9em;
  margin-top: auto;
  border-top: 4px solid #7b1fa2;
}

/* === Sidebar Dashboard Layout === */
.main-layout {
  display: flex;
  flex: 1;
  min-height: 85vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #ede7f6, #d1c4e9);
  padding: 25px 15px;
  border-top-right-radius: 25px;
  border-bottom-right-radius: 25px;
  box-shadow: 3px 0 15px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.6s ease-in;
}

/* Sidebar Search */
.sidebar input {
  width: 90%;
  padding: 10px 15px;
  border: none;
  border-radius: 25px;
  font-size: 1em;
  outline: none;
  margin-bottom: 20px;
  box-shadow: 0 4px 10px rgba(122, 85, 182, 0.2);
  transition: 0.3s;
}

.sidebar input:focus {
  box-shadow: 0 0 10px #7b1fa2;
}

/* Sidebar Title */
.sidebar h3 {
  color: #4a148c;
  font-size: 1.4em;
  margin-bottom: 15px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Semester Buttons in Sidebar */
.side-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: center;
  gap: 15px;
}

.side-panel .sem-card {
  width: 85%;
  background: #4a148c;
  color: #fff;
  font-weight: 600;
  padding: 15px;
  text-align: center;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

.side-panel .sem-card:hover {
  background: #7b1fa2;
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

/* Content Area */
.content-area {
  flex: 1;
  padding: 40px;
  text-align: center;
}

/* === Responsive === */
@media (max-width: 850px) {
  .main-layout {
    flex-direction: column;
    align-items: center;
  }
  .sidebar {
    width: 90%;
    border-radius: 20px;
    margin-bottom: 20px;
  }
  .side-panel .sem-card {
    width: 90%;
  }
  .notes-box {
    height: 300px;
    width: 90%;
  }
}
/* === 📱 Mobile Fix: Footer stays fixed below Back button === */
@media (max-width: 850px) {
  html, body {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
  }

  header {
    flex-shrink: 0;
  }

  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #4a148c;
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 0.9em;
    border-top: 4px solid #7b1fa2;
    z-index: 10;
  }

  main.main-layout {
    flex: 1;
    padding-bottom: 70px; /* space for fixed footer */
    overflow-y: auto;
  }

  #notes-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .notes-box {
    width: 90%;
    max-width: 500px;
    max-height: calc(100vh - 280px); /* keeps between header & footer */
    overflow-y: auto;
  }

  #back-btn {
    margin-bottom: 60px; /* keeps Back button above footer */
  }
}
@media (max-width: 850px) {
  /* Reduce spacing between title and notes box */
  #notes-section {
    margin-top: 10px !important;
  }

  #sem-title {
    margin-bottom: 10px !important;
    font-size: 1.4em;
  }

  .notes-box {
    margin-top: 5px !important;
    padding: 10px;
  }

  #notes-list li {
    margin: 8px auto;
    padding: 12px;
  }

  /* Keep the back button close to the box */
  #back-btn {
    margin-top: 10px;
    margin-bottom: 60px; /* keeps it above footer */
  }
}
/* === Fix: Hide notes section completely until activated === */
#notes-section.hidden {
  display: none !important;
  visibility: hidden;
  opacity: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* When shown, animate smoothly */
#notes-section:not(.hidden) {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  opacity: 1;
  margin-top: 10px;
  animation: fadeIn 0.4s ease-in-out;
}
/* === 📱 Mobile Hint Popup (CSS-only animation) === */
.hint-popup {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  color: #4a148c;
  padding: 12px 20px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  font-weight: 600;
  text-align: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
}

/* 👇 Trigger animation only when notes-section is visible */
#notes-section:not(.hidden) ~ .hint-popup {
  animation: hintSlide 3s ease-in-out 0.5s;
}

/* Keyframes for slide + fade */
@keyframes hintSlide {
  0% { bottom: -80px; opacity: 0; }
  20% { bottom: 120px; opacity: 1; }
  80% { bottom: 120px; opacity: 1; }
  100% { bottom: -80px; opacity: 0; }
}

/* Hide completely on desktop */
@media (min-width: 851px) {
  .hint-popup {
    display: none !important;
  }
}
