/* ==========================================
   USER MENU & AUTHENTICATION
   ========================================== */

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, rgba(184, 134, 79, 0.15) 0%, rgba(212, 165, 116, 0.15) 100%);
  border: 1px solid rgba(184, 134, 79, 0.4);
  color: var(--color-accent-hover);
  padding: clamp(0.3rem, 0.8vw, 0.5rem) clamp(0.5rem, 1.5vw, 1.5rem);
  border-radius: 8px;
  font-size: clamp(0.55rem, 1.5vw, 0.9rem);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  -webkit-backdrop-filter: blur(5px);

  backdrop-filter: blur(5px);
  height: auto;
  min-height: clamp(24px, 4vw, 40px);
  white-space: nowrap;
  line-height: 1;
}

.user-menu-trigger:hover {
  background: linear-gradient(135deg, rgba(184, 134, 79, 0.35) 0%, rgba(212, 165, 116, 0.35) 100%);
  border-color: var(--color-accent);
  color: var(--color-text-light);
  box-shadow: 0 4px 12px rgba(184, 134, 79, 0.3);
  transform: translateY(-2px);
}

.user-menu-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-bg-primary);
}

.user-menu-name {
  color: var(--color-text-primary);
  font-size: 0.85rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-arrow {
  color: var(--color-accent);
  transition: transform 0.2s ease;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  background: rgba(30, 20, 15, 0.98);
  border: 1px solid rgba(184, 134, 79, 0.3);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  overflow: hidden;
  z-index: 1001;
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s ease;
}

.user-dropdown-item:hover {
  background: rgba(184, 134, 79, 0.15);
}

.user-dropdown-item svg {
  color: var(--color-accent);
}

.user-dropdown-divider {
  height: 1px;
  background: rgba(184, 134, 79, 0.2);
  margin: 0.25rem 0;
}

.user-dropdown-logout {
  color: #e57373;
}

.user-dropdown-logout:hover {
  background: rgba(229, 115, 115, 0.15);
}

.user-dropdown-logout svg {
  color: #e57373;
}

/* Chat Form Styling */
.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(184, 134, 79, 0.2);
}

.chat-input {
  flex: 1;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(184, 134, 79, 0.3);
  border-radius: 20px;
  color: var(--color-text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-input:focus {
  border-color: var(--color-accent);
}

.chat-input::-moz-placeholder {
  color: rgba(232, 220, 200, 0.4);
}

.chat-input:-ms-input-placeholder {
  color: rgba(232, 220, 200, 0.4);
}

.chat-input::-ms-input-placeholder {
  color: rgba(232, 220, 200, 0.4);
}

.chat-input::placeholder {
  color: rgba(232, 220, 200, 0.4);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  background: var(--color-accent);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.chat-send-btn:hover {
  background: var(--color-accent-hover);
  transform: scale(1.05);
}

.chat-send-btn svg {
  color: var(--color-bg-primary);
}

/* Admin Badge in Chat */
.chat-username-admin {
  color: var(--color-accent) !important;
  font-weight: 600;
}

.chat-username-admin::after {
  content: '★';
  margin-left: 0.25rem;
  font-size: 0.7rem;
}

.chat-message-admin {
  background: rgba(184, 134, 79, 0.1);
  border-left: 2px solid var(--color-accent);
}

/* Form Status Loading */
.form-status.loading {
  color: var(--color-accent);
}

.form-status.loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-accent);
  border-top-color: transparent;
  border-radius: 50%;
  margin-right: 0.5rem;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Login Remember Me Checkbox */
#login-remember-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

#login-remember-group label {
  font-size: 0.85rem;
  color: var(--color-text-primary);
  opacity: 0.8;
  cursor: pointer;
}

/* Nachrichten Badge im User Menu */
.message-badge {
  background: #e74c3c;
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  margin-left: auto;
}

.message-badge:empty {
  display: none;
}

/* Badge im User-Dropdown beim Nachrichten-Link */
.nav-messages-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e74c3c;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  margin-left: auto;
}

/* Badge am User-Menu-Trigger (neben Benutzernamen) */
.user-menu-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e74c3c;
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  text-align: center;
  margin-left: 0.25rem;
  margin-right: 0.25rem;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* User Dropdown Item mit Badge */
.user-dropdown-item.has-badge {
  position: relative;
}

/* Klickbare Online User im Chat */
.online-user-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  margin: 0.2rem 0;
}

.online-user-clickable:hover {
  background: rgba(184, 134, 79, 0.2);
  transform: translateX(3px);
}

.online-user-clickable:active {
  background: rgba(184, 134, 79, 0.3);
}

/* ==========================================
   USER MENU - MOBILE RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
  .user-menu-trigger {
    padding: 0.3rem 0.6rem !important;
    gap: 0.3rem !important;
    border-radius: 15px !important;
  }
  
  .user-menu-name {
    font-size: 0.7rem !important;
    max-width: 80px !important;
  }
  
  .user-menu-badge {
    font-size: 0.55rem !important;
    min-width: 14px !important;
    height: 14px !important;
    padding: 0.08rem 0.3rem !important;
  }
  
  .user-menu-arrow {
    width: 10px !important;
    height: 10px !important;
  }
  
  .user-menu-arrow svg {
    width: 10px !important;
    height: 10px !important;
  }
  
  .user-dropdown {
    min-width: 200px !important;
    border-radius: 10px !important;
    right: 0;
  }
  
  .user-dropdown-item {
    padding: 0.65rem 0.85rem !important;
    font-size: 0.85rem !important;
    gap: 0.65rem !important;
  }
  
  .user-dropdown-item svg {
    width: 16px !important;
    height: 16px !important;
  }
}

@media (max-width: 576px) {
  .user-menu-trigger {
    padding: 0.25rem 0.5rem !important;
    gap: 0.25rem !important;
    border-radius: 12px !important;
  }
  
  .user-menu-name {
    font-size: 0.6rem !important;
    max-width: 65px !important;
  }
  
  .user-menu-badge {
    font-size: 0.5rem !important;
    min-width: 12px !important;
    height: 12px !important;
    padding: 0.05rem 0.25rem !important;
  }
  
  .user-menu-arrow,
  .user-menu-arrow svg {
    width: 6px !important;
    height: 6px !important;
  }
  
  .user-dropdown {
    min-width: 180px !important;
  }
  
  .user-dropdown-item {
    padding: 0.55rem 0.65rem !important;
    font-size: 0.75rem !important;
    gap: 0.5rem !important;
  }
  
  .user-dropdown-item svg {
    width: 14px !important;
    height: 14px !important;
  }
}

@media (max-width: 380px) {
  .user-menu-trigger {
    padding: 0.1rem 0.2rem !important;
    gap: 0.15rem !important;
  }
  
  .user-menu-avatar {
    width: 12px !important;
    height: 12px !important;
    font-size: 0.4rem !important;
  }
  
  .user-menu-name {
    font-size: 0.4rem !important;
    max-width: 30px !important;
  }
  
  .user-menu-badge {
    font-size: 0.4rem !important;
    min-width: 10px !important;
    height: 10px !important;
    padding: 0.03rem 0.2rem !important;
  }
  
  .user-menu-arrow,
  .user-menu-arrow svg {
    width: 5px !important;
    height: 5px !important;
  }
  
  .user-dropdown {
    min-width: 160px !important;
  }
  
  .user-dropdown-item {
    padding: 0.5rem 0.6rem !important;
    font-size: 0.65rem !important;
    gap: 0.4rem !important;
  }
  
  .user-dropdown-item svg {
    width: 12px !important;
    height: 12px !important;
  }
}

/* ==========================================
   PROFILE AVATAR UPLOAD
   ========================================== */

#profile-avatar-container {
  position: relative;
}

.profile-avatar-upload {
  position: absolute;
  bottom: 0;
  right: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#profile-avatar-container:hover .profile-avatar-upload {
  opacity: 1;
}

.profile-avatar-change-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
  border: 2px solid var(--color-bg-primary);
  color: var(--color-bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.profile-avatar-change-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.5);
}

.profile-avatar-change-btn:active {
  transform: scale(0.95);
}

.profile-avatar-hint {
  text-align: center;
  margin-top: 0.5rem;
}
