/* Стили для админ-панели */

.admin-layout {
  min-height: 100vh;
  background-color: #FFFFFF;
  display: flex;
  flex-direction: column;
}

/* Шапка админки */
.admin-header {
  background: white;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

/* Логотип */
.admin-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  /*color: inherit;*/
  transition: opacity 0.3s ease;
}

.logo-link:hover {
  opacity: 0.8;
}

.logo-icon {
  width: 40px;
  height: 40px;
}

.logo-placeholder {
  width: 100%;
  height: 100%;
  /*background: linear-gradient(135deg, #34AAFF 0%, #0A73BE 100%);*/
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 18px;
}

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

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
}

/* Навигация по центру */
.admin-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-nav a {
  display: block;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.3s ease;
  background-color: #F7F7F7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.admin-nav a:hover {
  color: #34AAFF;
  background-color: #f0f8ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.admin-nav a.active {
  color: #34AAFF;
  background-color: #e6f3ff;
  box-shadow: 0 2px 6px rgba(52, 170, 255, 0.2);
}

/* Пользователь и выпадающее меню */
.admin-user {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #333;
}

/* Выпадающий список организаций */
.organizations-dropdown {
  position: relative;
}

.organizations-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
}

.organizations-trigger:hover {
  background-color: #e9ecef;
  border-color: #34AAFF;
}

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

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

.current-organization-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.organizations-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;
}

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

.add-organization-item {
  border-top: 1px solid #E5E7EB;
  margin-top: 8px;
  padding-top: 8px;
  color: #34AAFF;
}

.add-organization-item:hover {
  background-color: #F0F8FF;
  color: #0A73BE;
}

.organization-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #333;
  text-decoration: none;
  transition: background-color 0.3s ease;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
}

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

.organization-item.active {
  background-color: #e6f3ff;
  color: #34AAFF;
}

.organization-item-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.organization-item-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.organization-item-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.organization-form {
  margin: 0;
  padding: 0;
}

.user-dropdown {
  position: relative;
}

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

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

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

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

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

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

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

/* Выпадающее меню */
.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;
}

/* Специфичные стили для меню пользователя в хедере */
.admin-header .user-dropdown .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: 10001 !important; /* Выше чем меню в таблице команды */
}

.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;
}

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

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

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

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

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

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

.dropdown-item span {
  font-size: 14px;
  font-weight: 500;
}

/* Основной контент */
.admin-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  width: 100%;
  /* Рабочая область ЛК занимает весь первый экран (за вычетом шапки):
     футер не «закреплён» на экране — он в потоке ниже фолда и виден
     только при прокрутке, не отнимая полезное место. */
  min-height: calc(100vh - 60px);
}

/* Серая рамка для контента */
.admin-content-wrapper {
  background: #F7F7F7;
  border-radius: 16px;
  padding: 40px;
  /*box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);*/
  margin: 20px 0;
}

/* Секция приветствия */
.welcome-section {
  text-align: center;
  margin-bottom: 40px;
}

.welcome-section h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 15px;
}

.welcome-section p {
  font-size: 1.1rem;
  color: #666;
  line-height: 1.6;
}

/* Карточки для разделов */
.admin-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.admin-card {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.admin-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-color: #34AAFF;
}

.admin-card-header {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 25px;
}

.admin-card-icon {
  width: 50px;
  height: 50px;
  /*background: linear-gradient(135deg, #34AAFF 0%, #0A73BE 100%);*/
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  flex-shrink: 0;
}

.admin-card-title h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
}

.card-description {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0;
}

/* Контент карточки */
.card-content {
  flex: 1;
  margin-bottom: 25px;
}

.task-section {
  margin-bottom: 20px;
}

.task-section h4 {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-list li {
  position: relative;
  padding-left: 25px;
  margin-bottom: 8px;
  color: #555;
  font-size: 0.9rem;
  line-height: 1.4;
}

.task-list li:before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: #34AAFF;
  font-weight: bold;
  font-size: 14px;
}

.purpose-section h4 {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.purpose-section p {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0;
}

.admin-card .btn {
  background: linear-gradient(135deg, #34AAFF 0%, #0A73BE 100%);
  align-self: stretch;
  text-align: center;
  margin-top: auto;
}

/* Футер */
.admin-footer {
  background: #1a1a1a;
  color: white;
  padding: 30px 20px;
  margin-top: auto;
}

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

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

.admin-footer-logo {
  width: 30px;
  height: 30px;
  /*background: linear-gradient(135deg, #34AAFF 0%, #0A73BE 100%);*/
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
}

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

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

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

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

.admin-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;
}

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

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

/* Адаптивность */
@media (max-width: 768px) {
  .admin-header-content {
    flex-direction: column;
    gap: 15px;
  }
  
  .admin-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .admin-nav a {
    padding: 8px 12px;
    font-size: 14px;
  }
  
  .admin-content {
    padding: 20px;
  }
  
  .admin-content-wrapper {
    padding: 20px;
  }
  
  .welcome-section h1 {
    font-size: 2rem;
  }
  
  .admin-cards {
    grid-template-columns: 1fr;
  }
  
  .admin-user {
    flex-direction: column;
    gap: 10px;
  }
  
  .organizations-dropdown {
    width: 100%;
  }
  
  .organizations-trigger {
    justify-content: center;
    width: 100%;
  }
  
  .current-organization-name {
    max-width: none;
  }
  
  .organizations-menu {
    width: 100%;
    right: auto;
    left: 0;
  }
  
  .admin-footer-content {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  
  .admin-footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
}

/* Flash сообщения */
.flash-notice,
.flash-alert {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px 15px 20px;
  padding-right: 45px; /* Место для кнопки закрытия */
  border-radius: 8px;
  font-weight: 500;
  z-index: 1000;
  max-width: 450px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-out;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  word-wrap: break-word;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.flash-message-text {
  flex: 1;
  margin: 0;
  padding: 0;
}

.flash-notice {
  background: #10B981;
  color: white;
  border-left: 4px solid #059669;
}

.flash-alert {
  background: #EF4444;
  color: white;
  border-left: 4px solid #DC2626;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.flash-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
  z-index: 1001;
  pointer-events: auto;
}

.flash-close:hover {
  opacity: 1;
  transform: scale(1.1);
}

.flash-close:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
  border-radius: 2px;
}

.flash-notice:hover,
.flash-alert:hover {
  opacity: 0.95;
}

@media (max-width: 768px) {
  .flash-notice,
  .flash-alert {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* Модальное окно добавления организации */
#addOrganizationModal.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

#addOrganizationModal .modal-content {
  background-color: #FFFFFF;
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  animation: modalSlideIn 0.3s ease-out;
}

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

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

.modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1F2937;
}

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

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

.modal-body {
  padding: 24px;
}

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

.btn-secondary {
  background-color: #FFFFFF;
  color: #374151;
  border: 1px solid #D1D5DB;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background-color: #F9FAFB;
  border-color: #9CA3AF;
}

.btn-primary {
  background-color: #34AAFF;
  color: #FFFFFF;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background-color: #0A73BE;
}

/* Стили для формы в модальном окне */
.modal-body .confirm-text {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 500;
  color: #111827;
}

.modal-body .confirm-hint {
  margin: 0;
  font-size: 0.875rem;
  color: #6B7280;
  line-height: 1.5;
}

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

.modal-body .form-group:last-child {
  margin-bottom: 0;
}

.modal-body .form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.modal-body .form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 14px;
  color: #1F2937;
  transition: border-color 0.2s ease;
}

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

/* Поле телефона теперь использует стандартные стили */

.modal-body textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.copy-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(51, 51, 51, 0.9);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2000;
}

.copy-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

