/* =========================================
   СТРАНИЦА АВТОРИЗАЦИИ (AUTH PAGE)
========================================= */
.auth-page {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; padding: 140px 1rem 60px;
  background-color: var(--bg-color, #F5F2ED); box-sizing: border-box;
}

.auth-card {
  background: #ffffff; width: 100%; max-width: 420px;
  border-radius: 24px; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Полностью скрываем стандартные уродливые табы Drupal на этой странице */
.auth-page #block-aveski-primary-local-tasks {
  display: none !important; 
}

/* Отступы для тела формы */
.auth-card__body {
  padding: 2rem;
}

/* Оставляем только сетку для полей */
.auth-card__body form {
  display: flex; 
  flex-direction: column; 
  gap: 1rem;
}

.form-item { margin: 0; }
.form-item label { display: block; font-weight: 700; margin-bottom: 8px; color: #333; font-size: 0.95rem; }

/* Инпуты */
.form-item input.form-text, .form-item input.form-email {
  width: 100%; padding: 14px 16px; background: #F5F2ED; border: 1px solid transparent;
  border-radius: 12px; font-size: 1rem; font-family: var(--font-main);
  box-sizing: border-box; transition: all 0.3s ease;
}
.form-item input.form-text:focus, .form-item input.form-email:focus {
  background: #fff; border-color: var(--brand-red, #E11A27); outline: none;
  box-shadow: 0 0 0 4px rgba(225, 26, 39, 0.1);
}

/* Кнопка отправки */
.form-submit {
  width: 100%; background-color: var(--brand-red, #E11A27); color: #fff;
  border: none; padding: 16px; font-size: 1.1rem; font-weight: 800; text-transform: uppercase;
  border-radius: 12px; cursor: pointer; transition: background 0.3s ease, transform 0.2s ease;
  margin-top: 10px;
}
.form-submit:hover { background-color: #A63A33; transform: translateY(-2px); }

/* --- GOOGLE LOGIN --- */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #999;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
    margin: 0.5rem 0;
}

/* Линии слева и справа */
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #E4E5E6;
}

/* Отступы от текста до линий */
.auth-divider span {
  padding: 0 15px;
}

.social-auth.auth-link {
  display: flex; align-items: center; justify-content: center; padding: 14px;
  background: #fff; border: 1px solid #ccc; border-radius: 12px;
  text-decoration: none; color: #333; font-weight: 700; transition: all 0.3s ease; box-sizing: border-box;   margin: 0;
}
.social-auth.auth-link:hover { background: #f9f9f9; border-color: #999; }
.social-auth.auth-link::after { content: 'Continue with Google'; margin-left: 10px; }
.social-auth.auth-icon { width: 24px; height: 24px; }

/* --- НАШИ НОВЫЕ ССЫЛКИ ВНИЗУ (Футер карточки) --- */
.auth-card__footer {
  background-color: #F9F9F9;
  border-top: 1px solid #E4E5E6;
  padding: 25px 40px;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-links--other {
  justify-content: center;
}

.auth-links a {
  color: #555;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-links a:hover {
  color: var(--brand-red, #E11A27);
}

/* ----------------------------------------------------
   МАГИЯ ОТОБРАЖЕНИЯ (Без PHP и JS)
------------------------------------------------------- */
/* 1. По умолчанию скрываем обе группы ссылок */
.auth-links--login, 
.auth-links--other {
  display: none;
}

/* 2. Если внутри карточки есть форма логина (#user-login-form) -> Показываем ссылки логина */
.auth-card:has(#user-login-form) .auth-links--login {
  display: flex;
}

/* 3. Если внутри карточки форма регистрации или восстановления -> Показываем кнопку "Назад" */
.auth-card:has(#user-register-form) .auth-links--other,
.auth-card:has(#user-pass) .auth-links--other {
  display: flex;
}

@media (max-width: 576px) {
  .auth-page { padding: 100px 15px 40px; align-items: flex-start; }
  #block-aveski-socialauthlogin { padding: 0 25px 20px; }
  .auth-card__footer { padding: 20px 25px; }
  .auth-links { flex-direction: column; gap: 15px; text-align: center; }
}


/* =========================================
   ФОРМА РЕДАКТИРОВАНИЯ ПРОФИЛЯ (.user-form)
========================================= */

.user-form {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%; /* Резиновая ширина */
}

/* --- ОПИСАНИЯ И ПОДСКАЗКИ (Help text) --- */
.user-form .description {
  font-size: 0.85rem;
  color: #666;
  margin-top: 8px;
  line-height: 1.5;
}

.user-form .description a {
  color: var(--brand-red, #E11A27);
  text-decoration: underline;
}

/* --- СЕЛЕКТЫ (Выпадающие списки) --- */
.user-form select.form-select {
  width: 100%;
  padding: 14px 40px 14px 16px;
  background-color: #F5F2ED;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 1rem;
  font-family: var(--font-main);
  box-sizing: border-box;
  transition: all 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
  /* Добавляем кастомную стрелочку */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 16px;
}

.user-form select.form-select:focus {
  background-color: #fff;
  border-color: var(--brand-red, #E11A27);
  outline: none;
  box-shadow: 0 0 0 4px rgba(225, 26, 39, 0.1);
}

/* --- ВИДЖЕТ ЗАГРУЗКИ КАРТИНКИ --- */
.user-form .image-widget {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  background: #F9F9F9;
  padding: 20px;
  border-radius: 16px;
  border: 1px dashed #ccc;
}

.user-form .image-widget img {
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.user-form .image-widget .file {
  font-weight: 600;
  word-break: break-all;
}

.user-form .image-widget .button {
  background: #E4E5E6;
  color: #333;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.user-form .image-widget .button:hover {
  background: #d0d0d0;
}

/* --- СКРЫТЫЕ БЛОКИ (Details / Summary) --- */
.user-form details {
  background: #fff;
  border: 1px solid #E4E5E6;
  border-radius: 16px;
  margin-bottom: 0;
  overflow: hidden;
}

.user-form details summary {
  padding: 18px 20px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #000;
  cursor: pointer;
  background: #F9F9F9;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.user-form details summary:hover {
  background: #f1f1f1;
}

/* Скрываем стандартный треугольник браузера */
.user-form details summary::-webkit-details-marker { display: none; }
.user-form details summary::marker { display: none; }

/* Кастомная стрелочка для details */
.user-form details summary::after {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>') center/contain no-repeat;
  transition: transform 0.3s ease;
}

.user-form details[open] summary {
  border-bottom: 1px solid #E4E5E6;
}

.user-form details[open] summary::after {
  transform: rotate(180deg);
}

/* Внутренний контент раскрывающегося списка */
.user-form details > .js-form-wrapper,
.user-form details > .js-form-item,
.user-form details > table {
  padding: 20px;
  margin: 0;
}

/* --- ТАБЛИЦЫ (Social Auth) --- */
.user-form table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.user-form th {
  text-align: left;
  font-weight: 700;
  color: #666;
  font-size: 0.85rem;
  text-transform: uppercase;
  padding: 10px 15px;
  border-bottom: 2px solid #E4E5E6;
}

.user-form td {
  padding: 15px;
  border-bottom: 1px solid #E4E5E6;
  font-size: 0.95rem;
  color: #333;
}

.user-form tr:last-child td {
  border-bottom: none;
}

.user-form .dropbutton-wrapper {
  margin: 0; /* Фикс съезжающих кнопок Drupal */
}

/* --- КНОПКИ В НИЗУ (Сохранить / Удалить аккаунт) --- */
.user-form .form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
  border-top: 1px solid #E4E5E6;
  padding-top: 25px;
}

.user-form #edit-submit {
  flex: 1; /* Кнопка сохранения растягивается */
  min-width: 200px;
  margin: 0;
}

.user-form .button--danger {
    display: none;
  color: #666;
  text-decoration: underline;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 15px 20px;
  transition: color 0.2s ease;
  border-radius: 12px;
}

.user-form .button--danger:hover {
  color: var(--brand-red, #E11A27);
}