:root {
  --textarea-default-height: 600px;
  --textarea-max-height: 2000px;
}

body {
  font-family: Arial, sans-serif;
  margin: 20px;
}

/* --- Контейнеры и сетка --- */
.content-container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 20px;
}

.table-container {
  flex: 1;
  resize: both;
  max-width: 60%;
  overflow-y: auto;
  height: var(--textarea-default-height);
  max-height: var(--textarea-max-height);
}

.textarea-container {
  flex: 1;
  max-width: 40%;
}

.custom-textarea {
  resize: both;
  overflow: auto;
  min-height: 100px;
  height: var(--textarea-default-height);
  max-height: var(--textarea-max-height);
}

/* --- Десктопы (на всю высоту экрана) --- */
@media (min-width: 1025px) {
  .content-container {
    height: calc(100vh - 150px); 
  }
  
  .table-container,
  .custom-textarea {
    height: 100%;
    max-height: none;
  }
}

/* --- Планшеты и Мобильные --- */
@media (max-width: 1024px) {
  .table-container {
    max-height: 600px;
  }
}

@media (max-width: 768px) {
  .content-container {
    flex-direction: column;
  }
  .table-container,
  .textarea-container {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .table-container {
    max-height: 600px;
  }
}

/* --- Таблицы --- */
table.table-hover, table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  white-space: normal;
}

table th,
table td {
  white-space: normal;
  border: 1px solid #ccc;
  padding: 8px;
  text-align: left;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Колонки */
th:nth-child(1), td:nth-child(1),
th:nth-child(3), td:nth-child(3) { 
  width: 49%; 
}

th:nth-child(2), td:nth-child(2) { 
  display: none; 
}

th:nth-child(4), td:nth-child(4) { 
  width: 40px; 
  text-align: center; 
}

.resizable,
th.resizable,
td.resizable {
  resize: horizontal;
  overflow: auto;
  min-width: 100px;
  max-width: 100%;
}

/* --- Элементы управления --- */
label {
  font-weight: bold;
  margin-right: 10px;
}

input[type="text"],
textarea {
  width: 100%;
  margin-bottom: 10px;
}

#translationInput {
  line-height: 1.5;
}

button {
  padding: 10px 20px;
  background-color: #007bff;
  color: #fff;
  border: none;
  cursor: pointer;
}

button:hover {
  background-color: #0056b3;
}

button.btn-warning {
  background-color: #7a01ae;
  color: #fff;
  border-color: #7a01ae;
}

button.btn-warning:hover {
  background-color: #9802d9;
  border-color: #9802d9;
}

/* --- Модальные окна --- */
.modal {
  display: none;
  position: fixed;
  z-index: 1;
  right: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.modal-content {
  position: absolute;
  background-color: white;
  padding: 20px;
  border: 1px solid #888;
  width: 60%;
  max-width: 400px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@media (max-width: 1024px) {
  .modal-content {
    width: 70%;
  }
}

@media (max-width: 600px) {
  .modal-content {
    width: 90%;
    max-width: none;
    padding: 10px;
  }
}

@media (min-width: 1025px) {
  .modal-content {
    width: 60%;
    max-width: 400px;
  }
}

.modal-header {
  cursor: move;
}

.close {
  position: absolute;
  top: 25px;
  right: 35px;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* --- Темная тема --- */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background-color: #2b2b2b;
  color: #ffffff;
  border-color: #5a6a67;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] input:active,
[data-theme="dark"] textarea:active,
[data-theme="dark"] select:active {
  background-color: #1e1e1e;
  color: #ffffff;
  border-color: #136857;
  outline: none;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #aaaaaa;
}

/* --- Разное --- */
.status-badge-container {
  position: relative; 
  height: 0; 
  width: 0;
}

.status-badge-text {
  position: absolute; 
  top: -70px; 
  left: 50px; 
  white-space: nowrap; 
  font-size: 0.85em;
}

.table-textarea {
  transition: all 1s ease; 
  resize: none; 
  padding: 5px; 
}



/* Модальное окно выбора файла с сервера */
.server-file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.server-file-list li {
    padding: 12px 15px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
}

.server-file-list li:hover {
    background-color: #e9ecef;
    border-color: #0d6efd;
}

.server-file-list li i {
    margin-right: 12px;
    color: #0d6efd;
    font-size: 1.2rem;
}

/* Поддержка темной темы (если используется data-bs-theme="dark") */
[data-bs-theme="dark"] .server-file-list li {
    background-color: #2b2f32;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .server-file-list li:hover {
    background-color: #343a40;
    border-color: #0d6efd;
}

#modernFileSelectModal {
    z-index: 1060 !important;
}

  .cat-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1060;
    max-width: 500px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    border-radius: 4px;
  }
  .cat-dropdown-item {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 14px;
  }
  .cat-dropdown-item:hover {
    background: #f0f0f0;
  }
  .cat-match-percent {
    font-weight: bold;
    color: #0d6efd;
    margin-right: 8px;
  }
  .cat-match-text {
    font-weight: 500;
    color: #212529;
    margin-bottom: 4px;
  }
  .cat-translator-badge {
    font-size: 0.75em;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    color: #495057;
  }

  /* Поддержка темной темы */
  [data-theme="dark"] .cat-dropdown {
    background: #2b2b2b;
    border-color: #5a6a67;
    color: #fff;
  }
  [data-theme="dark"] .cat-dropdown-item {
    border-bottom-color: #444;
  }
  [data-theme="dark"] .cat-dropdown-item:hover {
    background: #3a3a3a;
  }
  [data-theme="dark"] .cat-match-text {
    color: #e9ecef;
  }
  [data-theme="dark"] .cat-translator-badge {
    background: #495057;
    color: #e9ecef;
  }
  [data-theme="dark"] .cat-dropdown-item .text-muted {
    color: #aaa !important;
  }

.catIcon {
    display: inline-block;
    filter: grayscale(100%);
    opacity: 0.5;
}

td.pli-lang {
  position: relative;
  padding-right: 15px; 
}

.cat-trigger {
  position: absolute;
  top: 8px; 
  right: 0px; 
}

.active-word {
  background-color: rgba(var(--bs-primary-rgb), 0.35);
  border-radius: 0.25rem;
  box-shadow: 0 0 0 1px rgba(var(--bs-secondary-rgb), 0.15);
}

.pli-lang, .rus-lang, .eng-lang {
  transition: background-color 260ms ease-in-out;
}

.dynamic-tts-btn {
  position: fixed;
  right: 90px; 
  bottom: 30px; 
  z-index: 99;
  width: 30px;  
  height: 30px;
  
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  
  box-sizing: border-box;
  border-radius: 50%; 
  border: 2px solid #5a5a5a; 
  background-color: rgb(221, 221, 221);
  cursor: pointer;
  
  opacity: 0; 
  transform: scale(0.5); 
  animation: btnPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;

  transition: all 0.3s ease; 
  padding: 0;
  margin: 0;
}
