.page {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  margin-top: 60px;
  height: calc(100vh - 60px);
  padding-top: 0;
  background-color: #1e1e3f;
  color: #fbf6e9;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #6f6baf #1e1e3f;
}

.container {
  display: flex;
  width: 100%;
  min-height: 100%;
  justify-content: center;
  align-items: flex-start;
}

.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
  background-color: rgba(35, 35, 70, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}

.home-logo {
  flex-shrink: 0;
}

.home-logo,
.menu-btn {
  height: 100%;
  width: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
  border: none;
}

.menu-btn {
  border: none;
  position: fixed;
  top: 0;
  right: 0;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1101;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.9) 50%, transparent 50%);
  background-size: 200% 100%;
  background-position: left center;
  transition: background-position 0.5s ease;
}

.home-logo:hover,
.menu-btn:hover {
  border-radius: 0;
}

.home-logo:active,
.menu-btn:active {
  transform: scale(0.97);
}

.menu-btn.hover-effect:hover,
.home-logo.hover-effect:hover {
  border-radius: 0;
}

.side-menu {
  display: flex;
  background-color: #181830;
  padding: 10px;
  gap: 0.5rem;
  opacity: 0;
  pointer-events: none;
  flex-direction: column;
  position: fixed;
  top: 60px;
  right: -240px;
  height: 100vh;
  width: 240px;
  transition:
    right 0.6s ease,
    opacity 0.6s ease;
  z-index: 115;
}

.leaderboards-btn,
.browse-quizzes-btn,
.create-btn {
  background-color: #212139;
  color: #fbf6e9;
  font-size: 20px;
  height: 50px;
  border: none;
  border-radius: 10px;
  transition:
    transform 0.2s ease,
    background-color 0.3s ease;
  cursor: pointer;
}

.leaderboards-btn:hover,
.browse-quizzes-btn:hover,
.create-btn:hover {
  transform: scale(1.02);
  background-color: #2b2b50;
  border: 2px solid #8888aa;
}

.overlay {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 105;
}

.notification-overlay {
  opacity: 0;
  visibility: hidden;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1300;
  transition: opacity 0.3s ease;
}

body.open-notification .notification-overlay,
.menu-open .overlay,
.open-login .overlay,
.open-quiz .overlay,
.open-notification .overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.open-notification #notification-modal {
  display: flex;
}

.menu-open .side-menu {
  right: 0;
  opacity: 1;
  pointer-events: auto;
}

.menu-open .menu-btn {
  border-left: 4px solid #6f6baf;
  background-color: rgba(255, 255, 255, 0.1);
}

.menu-btn.menu-open:hover {
  transform: none;
  box-shadow: none;
  background-color: rgba(173, 216, 230, 0.08);
  border-left: 4px solid #6f6baf;
  cursor: pointer;
}

.closing .overlay {
  opacity: 0;
  visibility: visible;
}

#loader_overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loader {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #3498db;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

.loader-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 200px;
  flex: 1;
}

.loader-mini {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(141, 134, 201, 0.2);
  border-top: 4px solid #8d86c9;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.avatar-btn {
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow: hidden;
  position: relative;
  transition: all 0.3s ease;
  background-color: #1e1e3f;
  box-sizing: border-box;
}

.avatar-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  z-index: 1;
}

.avatar-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}

.avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
  box-sizing: border-box;
  text-align: center;
}

.avatar-btn.has-avatar:hover .avatar-overlay {
  opacity: 1;
}

.nav-avatar-tiny {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.auth-header-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 2px solid #8d86c9;
  border-radius: 12px;
  padding: 6px 16px;
  color: #fbf6e9;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.auth-header-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.auth-header-btn:hover {
  background-color: rgba(141, 134, 201, 0.1);
  border-color: #aaaaff;
  box-shadow: 0 0 12px rgba(138, 138, 255, 0.3);
}

#auth-nav-section {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0 !important;
  min-width: auto;
  z-index: 1002;
}

.user-nav-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1001;
}

.nav-profile-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  background: rgba(141, 134, 201, 0.1);
  border: 2px solid #8d86c9;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0;
}

.nav-profile-trigger:hover {
  background: rgba(141, 134, 201, 0.25);
  border-color: rgba(141, 134, 201, 0.8);
  box-shadow: 0 0 15px rgba(141, 134, 201, 0.15);
}

.nav-profile-trigger.active {
  background: rgba(58, 134, 255, 0.1);
  border-color: #3a86ff;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.nav-nickname {
  color: #fbf6e9;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-block;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background-color: #2b2b50;
  border: 2px solid #8d86c9;
  min-width: 160px;
  display: none;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 2000;
  overflow: visible;
  border-radius: 8px;
}

.nav-dropdown.active {
  display: flex;
}

.dropdown-item {
  padding: 12px 16px;
  background: none;
  border: none;
  color: #fbf6e9;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
  z-index: 1010;
}

.dropdown-item:hover {
  background: #3a86ff;
}

.dropdown-item:first-child:hover {
  border-radius: 6px 6px 0 0;
}

.dropdown-item:last-child:hover {
  border-radius: 0 0 6px 6px;
}

.logout-item {
  border-top: 1px solid rgba(141, 134, 201, 0.2);
  color: #ff5f5f;
}

@media (max-width: 400px) {
  .nav-nickname {
    max-width: 70px;
  }

  .nav-profile-trigger {
    padding: 6px 10px;
    gap: 8px;
  }

  .home-logo,
  .menu-btn {
    width: 60px;
  }
}
