/* ============================================================
   User Widget - Avatar з випадаючим меню
   ============================================================
   Показується внизу stepper панелі
   Відображає залогіненого користувача з можливістю logout
*/

/* ========== User Widget Area Container ========== */

.user-widget-area {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

/* ========== Login Button ========== */

.user-widget__login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.1);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #c084fc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-widget__login-btn:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.6);
  color: #d8b4fe;
}

.user-widget__login-btn:active {
  background: rgba(168, 85, 247, 0.25);
  transform: scale(0.98);
}

.user-widget__login-btn svg {
  flex-shrink: 0;
}

.user-widget__login-btn[hidden] {
  display: none;
}

/* ========== User Widget (logged in state) ========== */

.user-widget {
  position: relative;
}

/* ========== Trigger Button ========== */

.user-widget__trigger {
  width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
}

.user-widget__trigger:hover {
  background: rgba(255, 255, 255, 0.1);
}

.user-widget__trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
}

/* ========== Avatar ========== */

.user-widget__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

/* ========== User Info ========== */

.user-widget__info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

.user-widget__name {
  font-size: 14px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.user-widget__email {
  display: none;
}

.user-widget__username {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.user-widget--header .user-widget__username {
  color: rgba(31, 33, 60, 0.5);
  text-align: left;
}

/* ========== Chevron Icon ========== */

.user-widget__chevron {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.2s ease;
}

.user-widget__trigger[aria-expanded="true"] .user-widget__chevron {
  transform: rotate(180deg);
}

/* ========== Dropdown Menu ========== */

.user-widget__menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 1000;
  animation: userMenuSlideUp 0.2s ease-out;
}

@keyframes userMenuSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== Menu Items ========== */

.user-widget__menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  color: #333;
  font-size: 14px;
}

.user-widget__menu-item:hover {
  background: #f5f5f5;
}

.user-widget__menu-item:active {
  background: #e8e8e8;
}

.user-widget__menu-item svg {
  flex-shrink: 0;
  color: #666;
}

.user-widget__menu-item[data-action="logout"] {
  color: #DC2626;
}

.user-widget__menu-item[data-action="logout"] svg {
  color: #DC2626;
}

.user-widget__menu-item[data-action="logout"]:hover {
  background: #FEE2E2;
}

/* ========== Menu Divider ========== */

.user-widget__menu-divider {
  height: 1px;
  background: #e5e5e5;
  margin: 4px 0;
}

/* ========== Header Variant (Dashboard) ========== */

.user-widget--header {
  margin-top: 0;
  padding: 0;
  border-top: none;
}

.user-widget--header .user-widget__trigger {
  width: auto;
  flex-direction: row;
  padding: 8px 12px;
  gap: 10px;
  background: transparent;
  border: none;
}

.user-widget--header .user-widget__trigger:hover {
  background: rgba(31, 33, 60, 0.06);
}

.user-widget--header .user-widget__trigger[aria-expanded="true"] {
  background: rgba(31, 33, 60, 0.08);
}

.user-widget--header .user-widget__avatar {
  width: 32px;
  height: 32px;
  background: #e5e7eb;
}

.user-widget--header .user-widget__info {
  align-items: flex-start;
}

.user-widget--header .user-widget__name {
  color: #1f2238;
  text-align: left;
}

.user-widget--header .user-widget__chevron {
  color: rgba(31, 33, 60, 0.5);
}

.user-widget--header .user-widget__menu {
  top: calc(100% + 8px);
  bottom: auto;
  left: auto;
  right: 0;
  min-width: 180px;
  animation: userMenuSlideDown 0.2s ease-out;
}

@keyframes userMenuSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header variant: Login button */
.app-header__right .user-widget__login-btn {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.3);
  color: #8b5cf6;
}

.app-header__right .user-widget__login-btn:hover {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.5);
  color: #a78bfa;
}

/* ========== Language Switcher ========== */

.lang-switcher {
  position: relative;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.lang-switcher__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-switcher__trigger:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

.lang-switcher__trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(168, 85, 247, 0.4);
}

.lang-switcher__icon {
  flex-shrink: 0;
  opacity: 0.6;
}

.lang-switcher__label {
  flex: 1;
  text-align: left;
}

.lang-switcher__chevron {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.lang-switcher__trigger[aria-expanded="true"] .lang-switcher__chevron {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.lang-switcher__menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 16px;
  right: 16px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 100;
  animation: langMenuSlideUp 0.15s ease-out;
}

@keyframes langMenuSlideUp {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-switcher__option {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-switcher__option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.lang-switcher__option.is-active {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.lang-switcher__option.is-active::before {
  content: '✓';
  margin-right: 8px;
  font-size: 11px;
}

/* ========== Responsive (Mobile) ========== */

@media (max-width: 768px) {
  .user-widget-area {
    /* На мобілці user-widget-area в stepper панелі приховано */
    /* Бо stepper панель прихована на мобільці */
  }

  .user-widget {
    /* На мобілці може бути в іншому місці або прихований */
    /* Поки що залишаємо як є */
  }

  .lang-switcher {
    display: none; /* Приховано на мобілці в stepper */
  }
}
