/* Стили для страниц авторизации */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  position: relative;
}

/* Мягкий градиентный фон (как на лендинге) — только для страницы входа */
.auth-page--bg {
  background:
    radial-gradient(1000px 680px at 50% 38%, rgba(31, 160, 250, .12), rgba(31, 160, 250, 0) 60%),
    linear-gradient(180deg, #ffffff 0%, #F4F9FF 100%);
}

.auth-page--bg .auth-header {
  background: transparent;
}

/* На страницах документов (/terms, /privacy, /legal/*, /cookies) вместо
   полосы-шапки — только плавающий логотип «ЧейКод»: он следует за прокруткой
   (можно всегда вернуться назад), не занимает полосу и не перекрывает текст.
   Пилюля с блюром — чтобы логотип читался поверх текста на узких экранах. */
.auth-page--docs .auth-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 14px 20px;
  pointer-events: none; /* полоса не перехватывает клики по тексту */
}

/* Логотип как в шапке главной страницы: просто иконка + «ЧейКод», без плашки */
.auth-page--docs .auth-logo .logo-link {
  pointer-events: auto;
}

/* Контент начинается ниже плавающего логотипа */
.auth-page--docs .auth-page-content {
  padding-top: 84px;
}

/* Хедер для auth страниц */
.auth-header {
  background: #FFFFFF;
  padding: 20px;
  border: none;
  box-shadow: none;
}

.auth-header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-logo {
  display: flex;
  align-items: center;
}

.auth-logo .logo-link {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.auth-logo .logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-logo .logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
  margin-left: 12px;
}

.auth-header-button {
  padding: 10px 20px;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  background: #FFFFFF;
  color: #333;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  display: inline-block;
}

.auth-header-button:hover {
  border-color: #34AAFF;
  color: #34AAFF;
  box-shadow: 0 2px 8px rgba(52, 170, 255, 0.1);
}

/* Стили для меню пользователя в auth header */
.auth-user-dropdown {
  position: relative;
}

.auth-user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.auth-user-trigger:hover {
  background-color: #f5f5f5;
}

.auth-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-user-icon-placeholder {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-user-icon-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-dropdown-arrow {
  font-size: 12px;
  color: #666;
  transition: transform 0.3s ease;
}

.auth-user-dropdown:hover .auth-dropdown-arrow {
  transform: rotate(180deg);
}

.auth-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  margin-top: 5px;
}

.auth-user-email {
  padding: 12px 16px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid #E5E7EB;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.auth-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #333;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.auth-dropdown-item:hover {
  background-color: #f8f9fa;
}

.auth-dropdown-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logout-icon-placeholder {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logout-icon-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-page-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* Рабочая область занимает весь первый экран (за вычетом шапки):
     футер остаётся в потоке ниже фолда и появляется только при прокрутке,
     не отнимая место на экране. */
  min-height: calc(100vh - 80px);
}

.auth-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.auth-form-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-form-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}

.auth-form-header p {
  font-size: 1rem;
  color: #666;
  margin: 0;
}

.auth-form-header .error-message {
  font-size: 0.9rem;
  color: #DC2626;
  margin-top: 10px;
  margin-bottom: 0;
  font-weight: 500;
}

.auth-form {
  margin-bottom: 20px;
}

.auth-form .form-group {
  margin-bottom: 20px;
}

.auth-form .form-group label {
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
  display: block;
}

.auth-form .form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.auth-form .form-group input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  outline: none;
}

/* Стили для поля с ошибкой */
.auth-form .form-group input.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.auth-form .form-group input.error:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.auth-form button,
.auth-form input[type="submit"] {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #34AAFF 0%, #0A73BE 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.auth-form button:hover,
.auth-form input[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(52, 170, 255, 0.3);
}

.auth-links {
  text-align: center;
  margin-top: 20px;
}

.auth-links a {
  color: #34AAFF;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.auth-links a:hover {
  color: #0A73BE;
  text-decoration: underline;
}

/* Стили для страницы выбора организации */
.org-select-container {
  max-width: 800px !important;
  padding: 40px !important;
  display: flex !important;
  flex-direction: row !important;
  text-align: left !important;
}

.org-select-container .auth-header {
  display: none !important;
}

.org-select-layout {
  display: flex !important;
  flex-direction: row !important;
  gap: 40px !important;
  align-items: flex-start !important;
  width: 100% !important;
}

.org-select-left {
  flex: 1 !important;
  max-width: 300px !important;
  display: flex !important;
  flex-direction: column !important;
}

.org-select-left h2 {
  font-size: 2rem !important;
  font-weight: 700 !important;
  color: #333 !important;
  margin-bottom: 8px !important;
  text-align: left !important;
}

.org-select-left p {
  font-size: 1rem !important;
  color: #666 !important;
  margin: 0 !important;
  text-align: left !important;
}

.org-select-right {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
}

.org-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  background: transparent !important;
  width: 100% !important;
}

.org-item-form {
  margin: 0 !important;
  background: white !important;
  border: 1px solid #e1e5e9 !important;
  border-radius: 12px !important;
  padding: 16px 20px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.3s ease !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  width: 100% !important;
  min-height: 60px !important;
}

.org-item-form:hover {
  border-color: #34AAFF !important;
  box-shadow: 0 4px 12px rgba(52, 170, 255, 0.15) !important;
  transform: translateY(-1px) !important;
  background: white !important;
}

.org-item {
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  transition: none !important;
  cursor: pointer !important;
  text-align: left !important;
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  font-size: inherit !important;
  color: inherit !important;
  height: 100% !important;
}

.org-item:hover {
  transform: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
  background: transparent !important;
}

.org-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  flex-shrink: 0;
}

.org-icon-placeholder {
  font-size: 20px;
  color: #666;
}

/* Значок организации: буква, поверх — логотип или значок сайта (/lk/organizations/:id/icon) */
.org-icon--mark {
  position: relative;
  overflow: hidden;
  background: #E7F0FC;
}
.org-icon-letter {
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  color: #056AD5;
}
.org-icon--mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #FFFFFF;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(14, 17, 22, 0.06);
}

.org-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.org-name {
  font-size: 16px;
  font-weight: 600;
  color: #2E2E2E;
}

.org-role {
  font-size: 14px;
  color: #6B7280;
  font-weight: 400;
}

.org-empty {
  text-align: center;
  padding: 40px;
  color: #666;
}

.org-item-create {
  margin: 0 !important;
  background: white !important;
  border: 1px solid #e1e5e9 !important;
  border-radius: 12px !important;
  padding: 16px 20px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.3s ease !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  width: 100% !important;
  min-height: 60px !important;
  text-decoration: none !important;
  font-family: inherit !important;
}

.org-item-create:hover {
  border-color: #34AAFF !important;
  box-shadow: 0 4px 12px rgba(52, 170, 255, 0.15) !important;
  transform: translateY(-1px) !important;
  background: white !important;
}

/* Модальное окно */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 0 24px;
  border-bottom: 1px solid #E5E7EB;
  padding-bottom: 16px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6B7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background-color: #F3F4F6;
  color: #374151;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #E5E7EB;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, #34AAFF 0%, #0A73BE 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(52, 170, 255, 0.3);
}

.btn-secondary {
  background: #F3F4F6;
  color: #374151;
}

.btn-secondary:hover {
  background: #E5E7EB;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
  font-size: 14px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: #34AAFF;
  box-shadow: 0 0 0 3px rgba(52, 170, 255, 0.1);
  outline: none;
}

/* Адаптивность */
@media (max-width: 768px) {
  .org-select-layout {
    flex-direction: column !important;
    gap: 30px !important;
  }
  
  .org-select-left {
    max-width: none !important;
  }
  
  .org-select-left h2,
  .org-select-left p {
    text-align: center !important;
  }
}

/* Футер для auth страниц */
.auth-footer {
  background: #1a1a1a !important;
  color: white !important;
  padding: 30px 20px !important;
  margin-top: auto !important;
  width: 100% !important;
  display: block !important;
}

.auth-footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-footer-logo {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.auth-footer-text {
  color: white;
}

.auth-footer-text h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 5px 0;
}

.auth-footer-text p {
  font-size: 0.9rem;
  color: #ccc;
  margin: 0;
}

/* Ссылки в две колонки по два пункта — как в футере на главной странице */
.auth-footer-links {
  display: grid;
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  gap: 10px 40px;
}

.auth-footer-links a {
  color: white;
  text-decoration: none;
  font-size: 12px;
  line-height: 16px;
  opacity: .8;
  transition: color 0.3s ease, opacity 0.2s ease;
}

.auth-footer-links a:hover {
  opacity: 1;
}

.auth-footer-links a:hover {
  color: #34AAFF;
}

/* Адаптивность для футера */
@media (max-width: 768px) {
  .auth-footer-content {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  
  .auth-footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
}

/* --- Единый passwordless-флоу: подсказки, согласия, блокировка (фаза 9) --- */
.auth-hint,
.auth-hint-text {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #8A8A8E;
}

.auth-form .form-check {
  display: block;
  margin-bottom: 18px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.4;
  color: #1C1C1E;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.consent-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 0 28px;
}

.consent-links a {
  font-size: 13px;
  color: #34AAFF;
  text-decoration: none;
}

.consent-links a:hover {
  text-decoration: underline;
}

/* Экран «Создать аккаунт»: каждый документ — отдельной галочкой */
.consent-docs {
  border: 0;
  padding: 0;
  margin: 0 0 6px;
  min-width: 0;
}

.consent-docs-legend {
  padding: 0;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #8A8A8E;
}

.consent-docs .form-check {
  margin-bottom: 14px;
}

.consent-read {
  color: #34AAFF;
  text-decoration: none;
  white-space: nowrap;
}

.consent-read:hover {
  text-decoration: underline;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: #34AAFF;
  font-size: 14px;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.inline-form {
  display: inline;
}

.payment-block {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #E5E5EA;
  border-radius: 12px;
  text-align: center;
  color: #1C1C1E;
}

.payment-block button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Документы согласий и настройки рассылки (фаза 4) --- */
.auth-container-wide {
  max-width: 760px;
}

.legal-text {
  font-size: 14px;
  line-height: 1.6;
  color: #1C1C1E;
  text-align: left;
}

.legal-text p {
  margin: 0 0 12px;
}

.marketing-status {
  text-align: center;
}

.marketing-status .btn {
  margin: 12px 0;
}

/* --- Системная админка (фаза 10) --- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}
.admin-table th, .admin-table td {
  border: 1px solid #E5E5EA;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.admin-table th { background: #F7F7FA; }
.admin-table code { font-size: 12px; }
.admin-table input[type="text"], .admin-table textarea { width: 100%; }

/* --- Редакции документов: заголовки разделов, история, «что изменилось», экран принятия --- */
.legal-text h3 { font-size: 15px; line-height: 1.4; margin: 20px 0 8px; font-weight: 700; }
.legal-text p span { white-space: pre-line; }
.legal-links, .legal-notice { font-size: 13px; color: #5B6472; margin: 6px 0 0; }
.legal-notice { padding: 10px 12px; background: #FDF1E6; color: #6B3600; border-radius: 10px; margin-top: 10px; }
.legal-tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: #E5F4EA; color: #17803F; vertical-align: middle; }
.legal-tag--old { background: #EEF0F3; color: #3F4752; }
.legal-tag--next { background: #E7F0FC; color: #0B4FA0; }
.legal-summary { text-align: left; padding: 10px 12px; background: #F7F9FC; border-radius: 10px; font-size: 14px; }
.legal-muted { color: #8C95A3; }
.legal-versions { list-style: none; margin: 0; padding: 0; text-align: left; }
.legal-versions li { padding: 12px 0; border-top: 1px solid #E3E6EB; }
.legal-versions li:first-child { border-top: 0; }
.legal-versions__head { font-size: 14px; }
.legal-versions__date { color: #5B6472; margin-left: 6px; }
.legal-versions__summary { font-size: 13px; color: #5B6472; margin: 4px 0 0; }
.consent-updates { list-style: none; margin: 0 0 18px; padding: 0; text-align: left; }
.consent-update { padding: 14px 16px; border: 1px solid #E3E6EB; border-radius: 12px; margin-bottom: 10px; background: #fff; }
.consent-update__title { font-weight: 700; font-size: 15px; }
.consent-update__meta { font-size: 12.5px; color: #8C95A3; margin-top: 2px; }
.consent-update__summary { font-size: 13.5px; margin: 8px 0 0; color: #1C1C1E; }
.consent-update .consent-links { margin-top: 8px; }
.auth-page--docs .ac-diff { font-size: 14px; }
.consent-update .consent-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
