/* ============================================================================
   pages.css — дополнительные стили для отдельных страниц
   ============================================================================ */

/* Бургер-меню (мобильный сайдбар) */
.mobile-burger {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 101;
  width: 48px;
  height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(13, 13, 18, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.mobile-burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.25s ease;
}
.mobile-burger.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.mobile-burger.active span:nth-child(2) {
  opacity: 0;
}
.mobile-burger.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 1024px) {
  .mobile-burger {
    display: flex;
  }
}

/* Модальное окно */
.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal.show {
  opacity: 1;
}
.modal-card {
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.5);
}
.modal-card-wide {
  max-width: 720px;
}
.modal-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: flex-end;
}
body.modal-open {
  overflow: hidden;
}

/* Toast уведомления */
#nxtToastHost {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.nxt-toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}
.nxt-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.nxt-toast-ok {
  border-left: 3px solid var(--green);
}
.nxt-toast-error {
  border-left: 3px solid var(--orange);
}

/* Загрузка / пустое состояние / ошибка */
.nxt-loading,
.nxt-empty,
.nxt-error {
  text-align: center;
  padding: 3rem 1.5rem;
}
.nxt-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: nxt-spin 0.8s linear infinite;
}
@keyframes nxt-spin {
  to { transform: rotate(360deg); }
}
.nxt-loading {
  color: var(--text-dim);
  font-size: 0.95rem;
}
.nxt-empty {
  color: var(--text-dim);
}
.nxt-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.nxt-empty h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.nxt-error {
  background: rgba(255, 107, 53, 0.08);
  border: 1px solid rgba(255, 107, 53, 0.2);
  border-radius: 12px;
  color: var(--orange);
  padding: 1.25rem 1.5rem;
  text-align: left;
}
.nxt-error strong {
  display: block;
  margin-bottom: 0.35rem;
}

/* Библиотека: дерево */
.library-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.library-tree {
  position: sticky;
  top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}
.library-tree-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.library-tree-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  color: var(--text-dim);
  font-weight: 500;
}
.library-tree-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.library-tree-item.active {
  background: rgba(77, 159, 255, 0.12);
  color: var(--blue);
  font-weight: 600;
}
.library-tree-icon {
  font-size: 1.1rem;
}

.library-main {
  min-width: 0;
}
.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.library-header h1 {
  font-size: 2rem;
  font-weight: 800;
}
.library-actions {
  display: flex;
  gap: 0.75rem;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.doc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
}
.doc-card:hover {
  background: var(--surface-2);
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(77, 159, 255, 0.15);
}
.doc-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}
.doc-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.doc-card-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
  display: flex;
  gap: 0.75rem;
}
.doc-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.doc-card-actions .btn-sm {
  flex: 1;
}

/* Адаптив для библиотеки */
@media (max-width: 1024px) {
  .library-layout {
    grid-template-columns: 1fr;
  }
  .library-tree {
    position: static;
    max-height: none;
  }
}

/* Sidebar section title (раздел «Скоро») */
.sidebar-section-title {
  padding: 0.35rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dimmer);
}

/* Кнопка danger */
.btn-danger {
  background: linear-gradient(135deg, var(--orange), #d9534f);
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 107, 53, 0.3);
}
.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 107, 53, 0.45);
}

/* Форма внутри модального окна */
.modal-card .field {
  margin-bottom: 1rem;
}
.modal-card textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.75rem;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  resize: vertical;
  transition: all 0.25s ease;
}
.modal-card textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--dark);
  box-shadow: 0 0 0 4px rgba(77, 159, 255, 0.14);
}
.modal-card-wide {
    max-width: 90vw !important;
    width: 90vw !important;
}
/* модалка документа — компактная */
.modal-card {
    max-width: 480px;
    width: calc(100% - 2rem);
    margin: 1rem;
    border-radius: 20px;
    overflow: hidden;
    padding: 0 !important;
}

@media (max-width: 600px) {
    .modal-card {
        max-width: 100%;
        width: calc(100% - 1.5rem);
        margin: 0.75rem;
        border-radius: 16px;
    }
}
/* ---- Мобильная библиотека ---- */
@media (max-width: 768px) {

    /* Лейаут: дерево сверху, контент снизу */
    .library-layout {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
    }

    /* Дерево разделов — горизонтальный скролл */
    .library-tree {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0.75rem;
        border-radius: 12px;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .library-tree::-webkit-scrollbar { display: none; }

    .library-tree-title { display: none; }

    .library-tree-item {
        flex-shrink: 0;
        border-radius: 20px;
        padding: 0.4rem 0.85rem;
        font-size: 0.82rem;
    }

    /* Карточки документов — одна колонка */
    .doc-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    /* Заголовок библиотеки */
    .library-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .library-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    .library-actions .btn {
        flex: 1;
        text-align: center;
    }

    /* Модалка — на всю ширину с отступами */
    .modal-card {
        width: calc(100% - 1.5rem) !important;
        max-width: 100% !important;
        margin: 0.75rem !important;
        border-radius: 16px !important;
    }
}

/* Контакты: карточки соцсетей и почты */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 2.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.contact-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent, #4d9fff);
  opacity: 0.85;
}
.contact-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent, #4d9fff);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
}
.contact-card:active {
  transform: scale(0.98);
}
.contact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
  color: var(--accent, #4d9fff);
}
.contact-icon svg {
  width: 28px;
  height: 28px;
}
.contact-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}
.contact-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.contact-desc {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.5;
}
.contact-handle {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent, #4d9fff);
  word-break: break-all;
}
.contact-go {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
  color: var(--accent, #4d9fff);
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.25s ease;
}
.contact-card:hover .contact-go {
  transform: translateX(5px);
}

@media (max-width: 1100px) {
  .contacts-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .contacts-grid { grid-template-columns: 1fr; }
}
