/* =============================================================================
   Layout Components - Navigation, Header, Footer, Settings, Back-to-Top
   - Structural components that appear across multiple pages
============================================================================= */

/* =============================================================================
   Header and Logo
   - Styles for header container and logo placement including animations.
============================================================================= */
.header {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  min-height: 20px;
  border-radius: 20px;
  margin: 30px auto 20px auto;
  max-width: 95%;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  height: 100%;
}

.header::before {
  display: none;
}

.logo {
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
}

.logo img {
  display: block;
  width: auto;
  height: 170px;
  margin: 0;
}

.logo::before {
  display: none;
}

.page-title {
  margin: 0;
  padding: 0;
  line-height: 1.2;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #00ffff 0%, #00d4ff 50%, #0099ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: 'Montserrat', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  position: relative;
  text-shadow: none;
  letter-spacing: 1px;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

/* Enhanced Main Page Title Styling */
.page-title {
  background: linear-gradient(135deg, #00ffff 0%, #00d4ff 50%, #0099ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: 'Montserrat', sans-serif;
  font-size: 3.2rem;
  font-weight: 800;
  text-align: center;
  margin: 80px auto 40px auto;
  padding: 20px;
  position: relative;
  text-shadow: none;
  animation: titlePulse 3s ease-in-out infinite alternate;
  letter-spacing: 1px;
  will-change: transform, opacity;
  transform: translateZ(0); /* Force hardware acceleration */
}

.page-title::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.08), rgba(0, 212, 255, 0.03));
  border-radius: 20px;
  z-index: var(--z-background-overlay);
  box-shadow: 0 8px 32px rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.15);
}

.page-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 4px;
  background: linear-gradient(90deg, transparent, #00ffff, transparent);
  border-radius: 2px;
  animation: titleUnderline 2s ease-in-out infinite alternate;
}

.animate-title em {
  transform: translateY(-10px);
}

.page-title em {
  display: block;
  width: 100%;
  text-align: center;
  margin: 0;
  padding: 0;
}

.page-title::before {
  display: none;
}

.page-title::after {
  display: none;
}

/* Dynamic Greeting Styling */
#greeting {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
  background: linear-gradient(45deg, #00ffff, #ffffff, #00d4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 20px auto;
  padding: 15px;
  animation: greetingFade 2s ease-in-out;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
  letter-spacing: 0.5px;
  position: relative;
}

#greeting::before {
  content: '✨';
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  animation: sparkle 2s ease-in-out infinite;
}

#greeting::after {
  content: '✨';
  position: absolute;
  right: -30px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  animation: sparkle 2s ease-in-out infinite 1s;
}

.schoolLogo {
  position: fixed;
  bottom: 20px;
  right: 30px;
  z-index: var(--z-background);
}

/* Logo Animations */
.animate-logo {
  animation: slideInFromLeft 0.5s ease-out forwards;
  will-change: transform, opacity;
}

.page-title.animate-title {
  animation: fadeInScale 0.8s ease-out forwards !important;
  transform: scale(0);
  opacity: 0;
}

.fixed-logo {
  position: fixed;
  bottom: 70px;
  right: 5px;
  animation: none;
}

.animate-schoolLogo {
  animation: slideInFromLeft 0.5s ease-out forwards;
}

.fixed-schoolLogo {
  position:fixed;
  bottom: 40px;
  right:5px;
  animation: none;
}

/* Logo Hover Effect */
a img {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  transform: translateZ(0); /* Force hardware acceleration */
}

a img:hover {
  transform: scale(1.5) translateZ(0);
}

/* =============================================================================
   Navigation
   - Modern, professional styles for top navigation tabs.
============================================================================= */
nav.top-tabs {
  background: linear-gradient(135deg, #2c3e50 0%, #4a6074 50%, #607d8b 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: var(--z-navigation);
  overflow: hidden;
  animation: slideDown 0.8s ease-out forwards;
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(0, 180, 219, 0.3);
}

@keyframes slideDown {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

nav.top-tabs .nav-menu {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

nav.top-tabs .nav-menu li {
  position: relative;
  margin: 0 2px;
}

nav.top-tabs .nav-menu li a {
  display: block;
  padding: 16px 20px;
  text-align: center;
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px 8px 0 0;
  position: relative;
  overflow: hidden;
}

/* Hover effect with sliding animation */
nav.top-tabs .nav-menu li a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #00ffff, #00d4ff, #0099ff);
  transition: left 0.4s ease;
}

nav.top-tabs .nav-menu li a:hover::before {
  left: 0;
}

nav.top-tabs .nav-menu li a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #00ffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 255, 255, 0.2);
}

/* Active page styling */
nav.top-tabs .nav-menu li a.active {
  background: rgba(0, 255, 255, 0.2);
  color: #00ffff;
  box-shadow: 0 4px 8px rgba(0, 255, 255, 0.3);
}

nav.top-tabs .nav-menu li a.active::before {
  left: 0;
  background: #00ffff;
}

/* Mobile hamburger menu styles */
.mobile-nav-header {
  display: none;
  padding: 15px 20px;
  background: inherit;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  padding: 12px;
  border-radius: 6px;
  transition: background-color 0.3s ease;
  background: rgba(0, 255, 255, 0.1);
  border: 2px solid rgba(0, 255, 255, 0.3);
}

.mobile-menu-toggle:hover {
  background: rgba(0, 255, 255, 0.2);
  border-color: rgba(0, 255, 255, 0.5);
}

.mobile-menu-toggle span {
  display: block;
  width: 28px;
  height: 4px;
  background: #00ffff;
  margin: 4px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}

.mobile-menu-toggle.active {
  background: rgba(0, 255, 255, 0.3);
  border-color: rgba(0, 255, 255, 0.7);
}

/* =============================================================================
   Back to Top Button
   - Button that appears to allow quick scroll-to-top, including hover effects.
============================================================================= */
.back-to-top {
  position: fixed;
  top: 50%;
  right: 20px;
  width: 50px;
  height: 50px;
  background-image: var(--backtotop-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-color: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  z-index: var(--z-back-to-top);
  pointer-events: none;
  /* Initially hidden off-screen */
  transform: translateX(100%) translateY(-50%) scale(1);
  transition: background-size 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

/* When scrolled down, the button slides into view */
.back-to-top.show {
  transform: translateX(0) translateY(-50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Hover effects for the back-to-top button */
.back-to-top:hover {
  background-size: 120%; /* Smooth scale-up effect */
  transform: translateX(0) translateY(-50%) scale(1.1);
}

/* Remove default highlight effects */
.back-to-top:hover,
.back-to-top:focus,
.back-to-top:active {
  background-color: transparent;
  outline: none;
  box-shadow: none;
  border: none;
  filter: none;
}

/* =============================================================================
   Settings Panel
   - Gear icon and settings panel styles
============================================================================= */
.gear-icon {
  position: fixed;
  top: 50%;
  right: 80px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background-image: url('../Images/Icons/settings-gear-gray.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-color: var(--settings-color);
  border: none;
  outline: none;
  cursor: pointer;
  z-index: var(--z-settings-gear);
  border-radius: 50%;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.gear-icon:hover {
  background-image: url('../Images/Icons/settings-gear-green.svg');
  background-color: rgba(0, 255, 255, 0.2);
  transform: translateY(-50%) rotate(90deg);
  border-color: rgba(0, 255, 255, 0.3);
}

.settings-panel {
  position: fixed;
  top: 50%;
  right: -400px;
  transform: translateY(-50%);
  width: 350px;
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.9), rgba(30, 30, 30, 0.9));
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 2rem;
  z-index: var(--z-settings-panel);
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(0, 255, 255, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.settings-panel.show {
  right: 20px;
}

.settings-panel h3 {
  color: #00ffff;
  margin-bottom: 1.5rem;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  text-align: center;
  background: none;
  padding: 0;
}

.dark-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #00ffff;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  /* Page title mobile adjustments */
  .page-title {
    font-size: 2rem;
    margin: 40px auto 20px auto;
    padding: 15px 10px;
    letter-spacing: 0.3px;
    line-height: 1.2;
  }
  
  .page-title::before {
    width: 95%;
    border-radius: 12px;
  }
  
  .page-title::after {
    width: 150px;
  }
  
  #greeting {
    font-size: 1rem;
    padding: 10px 5px;
    margin: 15px auto;
  }
  
  #greeting::before,
  #greeting::after {
    display: none; /* Hide sparkles on mobile for cleaner look */
  }

  /* Header mobile adjustments */
  .header {
    flex-direction: column;
    text-align: center;
    padding: 10px;
  }
  
  .page-title {
    text-align: center;
    padding-left: 0;
    margin-top: 10px;
  }
  
  .logo img {
    width: 150px !important;
    height: auto;
  }

  /* Hide desktop nav on mobile */
  nav.top-tabs .nav-menu {
    display: none;
  }
  
  /* Mobile nav adjustments */
  nav.top-tabs {
    position: relative;
  }
  
  .mobile-nav-header {
    display: block !important;
  }
  
  /* Hide desktop nav menu on mobile */
  nav.top-tabs .nav-menu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    flex-direction: column !important;
    align-items: stretch;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    padding: 0;
    margin: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #4a6074 50%, #607d8b 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: var(--z-navigation);
  }
  
  /* Show mobile nav menu when active */
  nav.top-tabs .nav-menu.active {
    display: flex !important;
  }
  
  nav.top-tabs .nav-menu li {
    width: 100%;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  nav.top-tabs .nav-menu li:last-child {
    border-bottom: none;
  }
  
  nav.top-tabs .nav-menu li a {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 0;
    text-align: center;
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  
  nav.top-tabs .nav-menu li a::before {
    display: none;
  }
  
  nav.top-tabs .nav-menu li a:hover {
    background: rgba(0, 255, 255, 0.15);
    transform: none;
  }

  /* Back to top mobile styles */
  .back-to-top {
    width: 35px;
    height: 35px;
    right: 10px;
    top: auto;
    bottom: 15px;
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0.8;
    pointer-events: auto;
  }
  
  .back-to-top.show {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 1;
  }
  
  .back-to-top:hover {
    background-size: 110%;
    transform: translateY(0) translateX(0) scale(1.05);
  }

  /* Settings mobile adjustments */
  .gear-icon {
    right: 15px;
    width: 35px;
    height: 35px;
    top: auto;
    bottom: 60px;
  }
  
  .settings-panel {
    width: 300px;
    right: -320px;
  }
  
  .settings-panel.show {
    right: 10px;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.6rem;
    margin: 30px auto 15px auto;
    padding: 12px 8px;
    letter-spacing: 0.2px;
  }
  
  .page-title::before {
    width: 90%;
    border-radius: 10px;
  }
  
  .page-title::after {
    width: 120px;
  }
  
  #greeting {
    font-size: 0.9rem;
    padding: 8px 5px;
  }
}