/* ============================================================
   PLAYDING — auth.css
   Стили авторизации: кнопка «Войти», меню пользователя,
   модалки входа/регистрации и управления аккаунтом.
   Методология: BEM, использует CSS-переменные из main.css
   ============================================================ */

/* ---------- 1. Область авторизации в шапке ---------- */
.auth-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 4px;
}

.auth-btn {
  white-space: nowrap;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- 2. Меню пользователя ---------- */
.auth-user {
  position: relative;
}

.auth-user__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}

.auth-user__btn:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glow);
}

.auth-user__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--grad-accent);
  color: #04121a;
  font-size: 14px;
  flex-shrink: 0;
}

.auth-user__name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  background: var(--bg-elevated);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: var(--z-header);
  animation: modal-pop var(--t-fast);
}

.auth-user__menu[hidden] {
  display: none;
}

.auth-user__menu-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.auth-user__menu-item:hover {
  background: var(--bg-hover);
  color: var(--accent-cyan);
}

.auth-user__menu-item--danger {
  color: var(--danger);
}

.auth-user__menu-item--danger:hover {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger);
}

/* ---------- 3. Модалка входа / регистрации ---------- */
.auth-modal {
  width: min(440px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--bg-base);
  border: var(--glass-border);
  border-radius: var(--radius-pill);
}

.auth-tab {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.auth-tab:hover {
  color: var(--text-primary);
}

.auth-tab--active {
  background: var(--grad-accent);
  color: #04121a;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form[hidden] {
  display: none;
}

.auth-form__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.auth-form__subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: -8px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-field__input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.auth-field__input::placeholder {
  color: var(--text-muted);
}

.auth-field__input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.12);
}

.auth-form__error,
.account-form__error {
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(255, 77, 109, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(255, 77, 109, 0.1);
  color: var(--danger);
  font-size: 13px;
}

.auth-form__error[hidden],
.account-form__error[hidden] {
  display: none;
}

/* ---------- 4. Модалка управления аккаунтом ---------- */
.account-modal {
  width: min(520px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}

.account-modal__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius-md);
}

.account-profile__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grad-accent);
  color: #04121a;
  font-size: 26px;
  flex-shrink: 0;
}

.account-profile__nickname {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.account-profile__email {
  font-size: 13.5px;
  color: var(--text-muted);
}

.account-section {
  padding: 16px 0;
  border-top: 1px solid var(--border-subtle);
}

.account-section__title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 12px;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-status {
  min-height: 90px;
  resize: vertical;
  line-height: 1.5;
}

.account-form .btn {
  align-self: flex-start;
}

/* ---------- 5. Адаптивность ---------- */
@media (max-width: 640px) {
  .auth-user__name {
    max-width: 90px;
  }

  .auth-modal,
  .account-modal {
    padding: 20px;
  }
}

/* ---------- 6. Страница «Управление аккаунтом» (отдельная страница, не модалка) ---------- */
.account-page {
  width: min(620px, calc(100vw - 32px));
  margin: 0 auto;
  /* Отступ под фиксированную шапку (.header position: fixed), чтобы
     кнопка «← Назад в хаб» и заголовок не прятались под ней */
  padding: calc(var(--header-h) + 28px) 0 64px;
}

.account-page__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 4px;
}

.account-page__back {
  align-self: flex-start;
  margin-bottom: 4px;
}

.account-page__head .account-modal__title {
  margin-bottom: 0;
}

.account-page .account-profile {
  margin: 20px 0 0;
}

.account-page .account-section {
  padding: 18px 0;
}

@media (max-width: 640px) {
  .account-page {
    padding-top: calc(var(--header-h) + 20px);
  }
}
