.user-dropdown {
  position: relative;
  display: inline-block;
  z-index: 1030;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  object-fit: cover;
  border: 2px solid #f0f0f0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-avatar:hover {
  border-color: #0c84fe;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(12, 132, 254, 0.2);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1030;
  min-width: 280px;
  padding: 0;
  margin-top: 15px;
  font-size: 0.9rem;
  text-align: left;
  list-style: none;
  background-color: #fff;
  background-clip: padding-box;
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transform-origin: top right;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  display: block !important;
}

.user-dropdown:hover .dropdown-menu,
.user-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  z-index: 1050;
}

.user-dropdown:after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 20px;
  background: transparent;
}

.dropdown-menu.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.dropdown-menu.show {
  z-index: 1050;
}

.user-dropdown:before {
  content: "";
  position: absolute;
  top: 100%;
  right: 15px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #fff;
  opacity: 0;
  transition: all 0.3s ease;
  transform: translateY(-5px);
  z-index: 1031;
  pointer-events: none;
  margin-top: 5px;
}

.user-dropdown:hover:before {
  opacity: 1;
  transform: translateY(0);
}

.user-info {
  padding: 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}

.user-info:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 15%;
  width: 70%;
  height: 1px;
  background: linear-gradient(to right, transparent, #e0e0e0, transparent);
}

.user-info h6 {
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
  font-family: "Syne", sans-serif;
  font-weight: 700;
  color: #333;
  font-size: 1.1rem;
}

.user-info small {
  color: #6c757d;
  font-family: "Space Grotesk", sans-serif;
  opacity: 0.8;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.5rem;
  font-family: "Space Grotesk", sans-serif;
  color: #555;
  transition: all 0.25s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.dropdown-item:hover {
  background-color: #f0f7ff;
  color: #0c84fe;
  border-left-color: #0c84fe;
  transform: translateX(3px);
}

.dropdown-item i {
  width: 24px;
  margin-right: 12px;
  font-size: 1rem;
  color: #6c757d;
  transition: color 0.2s ease;
  text-align: center;
}

.dropdown-item:hover i {
  color: #0c84fe;
}

.dropdown-divider {
  margin: 0.3rem 1rem;
  opacity: 0.1;
}

.dropdown-item:last-child {
  color: #dc3545;
  font-weight: 500;
}

.dropdown-item:last-child i {
  color: #dc3545;
}

.dropdown-item:last-child:hover {
  background-color: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border-left-color: #dc3545;
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.dropdown-menu.show .dropdown-item {
  animation: fadeInRight 0.3s ease forwards;
  animation-delay: calc(0.05s * var(--item-index, 1));
  opacity: 0;
}

@media (max-width: 991.98px) {
  .mobile-user-dropdown {
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
  }

  .mobile-user-dropdown .user-avatar {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
    border-width: 3px;
  }

  .mobile-menu-items {
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .mobile-menu-item {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    color: #333;
    text-decoration: none;
    font-family: "Space Grotesk", sans-serif;
    border-radius: 8px;
    transition: all 0.2s ease;
  }

  .mobile-menu-item:hover {
    background-color: #f0f7ff;
    color: #0c84fe;
  }

  .mobile-menu-item i {
    width: 24px;
    margin-right: 12px;
    color: #6c757d;
    text-align: center;
  }

  .mobile-menu-item:hover i {
    color: #0c84fe;
  }

  .mobile-menu-item:last-child {
    color: #dc3545;
  }

  .mobile-menu-item:last-child i {
    color: #dc3545;
  }

  .mobile-menu-item:last-child:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
  }
}

.dropdown-item:hover {
  background-color: #f8f9fa;
  color: #0c84fe;
  border-left-color: #0c84fe;
}

.dropdown-item i {
  width: 24px;
  margin-right: 12px;
  font-size: 1rem;
  text-align: center;
  color: #6c757d;
  transition: all 0.2s ease;
}

.dropdown-item:hover i {
  color: #0c84fe;
  transform: translateX(2px);
}

.dropdown-divider {
  margin: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, #f0f0f0, transparent);
  border: none;
  opacity: 0.7;
}

.dropdown-item[href="/auth/logout.php"] {
  color: #dc3545;
  border-left-color: transparent;
}

.dropdown-item[href="/auth/logout.php"]:hover {
  background-color: rgba(220, 53, 69, 0.05);
  border-left-color: #dc3545;
}

.dropdown-item[href="/auth/logout.php"] i {
  color: #dc3545;
}

.dropdown-menu:before {
  content: "";
  position: absolute;
  top: -10px;
  right: 15px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid white;
  filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.03));
}

@media (max-width: 991.98px) {
  .dropdown-menu {
    position: static;
    transform: none;
    opacity: 1;
    box-shadow: none;
    border-radius: 0;
    min-width: 100%;
    margin-top: 0;
  }

  .dropdown-menu:before {
    display: none;
  }

  .mobile-user-dropdown {
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
  }

  .mobile-user-dropdown .user-avatar {
    width: 60px;
    height: 60px;
    margin-bottom: 0.8rem;
    border: 3px solid #f0f0f0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  }

  .mobile-user-dropdown .user-info {
    padding: 0;
    border: none;
    background: none;
  }

  .mobile-user-dropdown .user-info h6 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
  }

  .mobile-menu-items {
    padding: 0.8rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .mobile-menu-item {
    padding: 0.9rem 1.2rem;
    display: flex;
    align-items: center;
    color: #333;
    text-decoration: none;
    font-family: "Space Grotesk", sans-serif;
    border-radius: 8px;
    transition: all 0.2s ease;
    background-color: #f8f9fa;
    margin: 0 1rem;
  }

  .mobile-menu-item:hover {
    background-color: #e9ecef;
    color: #0c84fe;
    transform: translateX(3px);
  }

  .mobile-menu-item i {
    width: 24px;
    margin-right: 12px;
    color: #6c757d;
    font-size: 1rem;
    text-align: center;
    transition: all 0.2s ease;
  }

  .mobile-menu-item:hover i {
    color: #0c84fe;
  }

  .mobile-menu-item[href="/auth/logout.php"] {
    color: #dc3545;
    border-left-color: transparent;
  }

  .mobile-menu-item[href="/auth/logout.php"]:hover {
    background-color: rgba(220, 53, 69, 0.1);
  }

  .mobile-menu-item[href="/auth/logout.php"] i {
    color: #dc3545;
  }
}
