/* style.css */
/* Общий стиль */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: 'Inter', sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;  /* ← ВАЖНО: запрещаем скролл при 100vw */
}

/* LOGIN PAGE background */
.bg-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0; /* <-- было -1 */
  pointer-events: none;
}

#bg1 { opacity: 1; z-index: 0; }
#bg2 { opacity: 0; z-index: 0; }

/* -------------------- LOGIN BOX -------------------- */

#loginBox {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  padding: 32px;
  border-radius: 20px;

  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);

  color: #fff;
  text-align: center;
  z-index: 10;  /* ← Поверх background слоев */
}

.title {
  margin-bottom: 22px;
  font-size: 26px;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
}

#loginBox input {
  width: 94%;
  padding: 12px;
  font-size: 15px;
  border-radius: 10px;

  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  outline: none;

  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: 0.25s;
}

#loginBox input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

#loginBox input:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 
    inset 0 2px 6px rgba(0, 0, 0, 0.35),
    0 0 12px rgba(255, 255, 255, 0.15);
}

.form-group {
  margin-bottom: 14px;
}

.btn-login {
  margin-top: 22px;
  padding: 12px;
  width: 100%;
  font-size: 16px;
  font-weight: 500;

  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  backdrop-filter: blur(8px);

  color: #fff;
  cursor: pointer;
  transition: 0.25s;
}

.btn-login:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(255, 255, 255, 0.1);
}

.btn-login:active {
  transform: translateY(0);
}

#error {
  color: #ff8080;
  margin-top: 12px;
  font-size: 14px;
  min-height: 18px;
}

/* -------------------- ПОРТАЛ -------------------- */

.portal-body {
  background: radial-gradient(circle at top, #1f2933 0, #020617 55%, #000 100%);
  overflow: hidden;
}

#portal-root {
  position: relative;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

#portal-panel {
  width: 100%;
  max-width: 960px;

  height: 90vh;         /* <--- растягиваем на 90% экрана */
  max-height: 90vh;

  padding: 24px 28px 28px;
  border-radius: 20px;

  background: rgba(15, 15, 15, 0.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);

  overflow-y: auto;   /* <--- чтобы внутренности прокручивались */
}

/* Верхняя часть портала */
.portal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.portal-title {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: #e5e7eb;
}

.portal-logout {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e5e7eb;
  padding: 6px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.portal-logout:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Вкладки */
.tab-bar {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 20px;
}

.tab-btn {
  border: none;
  background: transparent;
  color: #9ca3af;
  padding: 8px 22px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.tab-btn.active {
  background: linear-gradient(135deg, #4b5563, #111827);
  color: #f9fafb;
}

.tab-btn:hover:not(.active) {
  background: rgba(55, 65, 81, 0.5);
}

/* Контент вкладок */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Добавить — textarea */
.add-textarea {
  width: 100%;
  height: 25vh;
  min-height: 140px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.8);
  color: #e5e7eb;
  padding: 10px 12px;
  resize: vertical;
  font-size: 14px;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  transition: 0.2s;
}

.add-textarea::placeholder {
  color: rgba(148, 163, 184, 0.8);
}

.add-textarea:focus {
  outline: none;
  border-color: rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 12px rgba(74, 144, 226, 0.15);
}

/* Общий ряд кнопок */
.button-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-main,
.btn-accent {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(156, 163, 175, 0.4);
  background: rgba(31, 41, 55, 0.9);
  color: #e5e7eb;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.btn-main:hover {
  background: rgba(55, 65, 81, 1);
  border-color: rgba(156, 163, 175, 0.6);
}

.btn-accent {
  background: linear-gradient(135deg, #4b5563, #111827);
  border: 1px solid rgba(107, 114, 128, 0.5);
}

.btn-accent:hover {
  background: linear-gradient(135deg, #6b7280, #1f2937);
  border-color: rgba(156, 163, 175, 0.6);
}

.btn-main:active,
.btn-accent:active {
  transform: scale(0.98);
}

.btn-download {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(180, 190, 210, 0.45);

  background: #3049a3; /* строгий глубокий синий */
  color: #fff;

  font-size: 14px;
  font-weight: 500;
  cursor: pointer;

  transition: none !important;     /* убираем переливания */
  box-shadow: none !important;
}

.btn-download:hover {
  background: #2c448f;   /* минимальный затемнение */
}

.btn-download:active {
  transform: none !important;  /* убираем анимации клика */
}

.btn-main,
.btn-accent,
.btn-login {
  transition: none !important;
  box-shadow: none !important;
  transform: none !important;
}

.btn-main:hover,
.btn-accent:hover,
.btn-login:hover {
  background: rgba(70, 70, 80, 0.9);   /* строгий вид */
}


/* Превью изображений */
.preview-row {
  margin-top: 18px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.preview-block {
  flex: 1 1 0;
  min-width: 220px;
}

.preview-label {
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 6px;
}

.preview-image {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  display: block;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.3);
}

.clickable {
  cursor: zoom-in;
  transition: 0.2s;
}

.clickable:hover {
  border-color: rgba(148, 163, 184, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Извлечь — текстовая панель */
.extract-text-panel {
  width: 100%;
  max-height: 25vh;
  min-height: 120px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  margin-bottom: 14px;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.extract-text-panel.hidden {
  display: none !important;
}

.extract-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(55, 65, 81, 0.9);
  font-size: 13px;
  color: #e5e7eb;
  background: rgba(31, 41, 55, 0.5);
}

.extract-panel-body {
  padding: 10px 12px;
  font-size: 14px;
  color: #e5e7eb;
  overflow: auto;
  flex: 1;
  word-break: break-word;
}

.panel-close {
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  transition: 0.2s;
}

.panel-close:hover {
  color: #e5e7eb;
}

/* Фуллскрин просмотр */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  animation: fadeIn 0.2s ease-in-out;
}

.fullscreen-overlay.hidden {
  display: none !important;
}

.fullscreen-overlay img {
  max-width: 94vw;
  max-height: 94vh;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.6);
  cursor: zoom-out;
  animation: zoomIn 0.2s ease-out;
}


/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(20, 20, 20, 0.85);
  padding: 12px 22px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  z-index: 999;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
}


/* Анимации */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Scroll стилизация */
#portal-panel::-webkit-scrollbar {
  width: 8px;
}

#portal-panel::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 10px;
}

#portal-panel::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.6);
  border-radius: 10px;
}

#portal-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.9);
}

/* Утилиты */
.hidden {
  display: none !important;
}

/* Адаптивность */
@media (max-width: 768px) {
  #loginBox {
    width: 85%;
    min-width: 280px;
    padding: 24px;
  }

  .title {
    font-size: 22px;
  }

  #portal-panel {
    width: 95%;
    padding: 16px 20px;
    min-height: auto;
  }

  .preview-block {
    min-width: 100%;
  }

  .tab-btn {
    padding: 6px 16px;
    font-size: 13px;
  }
}
