/* Контейнер для обох таблиць */
.tables-container {
  position: relative;
  width: 100%;
  max-width: 2000px; /* Збільшуємо максимальну ширину з 1500px до 1800px */
  height: auto; /* Змінюємо на auto для адаптивності */
  min-height: 800px; /* Збільшуємо мінімальну висоту з 600px до 700px */
  margin: 50px auto 100px; /* Зменшуємо верхній margin з 300px до 200px для підняття таблиць на 100px вгору */
  display: flex;
  justify-content: center;
  gap: 30px; /* Зменшуємо проміжок між таблицями з 40px до 30px */
  flex-wrap: wrap;
  
  /* Ініціально приховано для анімації */
  opacity: 0;
  filter: blur(20px);
  transform: scale(0.95);
  
  transform-origin: center top;
  min-width: 1200px; /* Мінімальна ширина контейнера, щоб уникнути стискання */
}

/* Обертка с таблицей и скролл-треком */
.scroll-wrapper {
  width: 100%;
  height: 550px;  /* Збільшуємо висоту з 450px до 550px */
  position: relative;
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
  box-sizing: border-box;
  border-radius: 8px;
  overflow: visible;
  min-width: 700px; /* Відповідає мінімальній ширині таблиці */
}

/* Позиціонування першої та другої таблиці */
.equipment-list {
  width: 100%;
  position: relative;
  margin: 0;
  background-color: transparent;
  box-shadow: none;
  border: none;
  transition: none;
}

.selected-equipment-wrapper {
  width: 100%;
  position: relative;
  margin: 0;
  background-color: transparent;
  box-shadow: none;
  border: none;
  transition: none;
}

/* Заголовки таблиць */
.table-container h3 {
  display: none; /* На випадок, якщо заголовки все ще залишилися в HTML */
}

/* Контейнер таблиці */
.table-container {
  position: relative;
  width: 100%;
  height: 100%;
  padding-left: 30px;
  padding-right: 10px; /* Додаємо відступ справа */
  padding-bottom: 10px; /* Додаємо відступ знизу */
  box-sizing: border-box; /* Щоб padding не додавався до розміру */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background-color: rgba(10, 10, 10, 0.7);
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}
.table-container::-webkit-scrollbar {
  display: none;
}

/* Колонки таблиці зі специфічною шириною */
table th:nth-child(1), /* Іконка */
table td:nth-child(1) {
  width: 20%;
}

table th:nth-child(2), /* Код */
table td:nth-child(2) {
  width: 16%;
}

table th:nth-child(3), /* S/N */
table td:nth-child(3) {
  width: 20%;
}

table th:nth-child(4), /* Тип */
table td:nth-child(4) {
  width: 17%;
}

table th:nth-child(5), /* Студія */
table td:nth-child(5) {
  width: 15%;
}

table th:nth-child(6), /* Додати/Видалити */
table td:nth-child(6) {
  width: 12%;
}

table th:nth-child(7), /* Додати/Видалити */
table td:nth-child(7) {
  width: 10%;
}
/* Делаем заголовок таблицы фиксированным */
thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(34, 34, 34, 0.5); /* Полупрозрачный фон */
  backdrop-filter: blur(3px); /* Размытие заднего фона */
}

/* Таблица */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* Додаємо фіксовану структуру таблиці */
  min-width: 700px; /* Мінімальна ширина таблиці */
  background-color: rgba(15, 15, 15, 0.7);
}

/* Стили заголовков */
thead th {
  position: sticky;
  top: 0;
  background-color: rgba(5, 5, 5, 0.95); /* Темніший фон */
  font-weight: 700; /* Збільшуємо жирність шрифту з 500 до 700 */
  font-size: 1.05em;
  z-index: 1;
  border-bottom: 2px solid rgba(94, 155, 255, 0.3); /* Синя напівпрозора лінія */
  letter-spacing: 0.3px;
  padding: 8px 8px; /* Збільшуємо padding для заголовків з 5px до 8px */
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
}

/* Стилі для комірок таблиці */
th, td {
  border: 1px solid rgba(40, 40, 40, 0.8);
  padding: 8px 8px; /* Повертаємо нормальний вертикальний padding з 3px до 8px */
  color: #e0e0e0;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Дозволяємо тексту в колонці "назва" переноситися на новий рядок */
table td:nth-child(4) {
  white-space: normal;
  word-wrap: break-word;
  min-height: 60px;
  vertical-align: middle;
}

/* Стилі для рядків таблиці при наведенні */
tr:hover td {
  background-color: rgba(30, 30, 30, 0.6);
  transition: background-color 0.2s ease;
}

/* Обмежуємо розміри вмісту в комірках */
td img {
  max-width: 100%;
  height: auto;
}

/* Забронированные строки */
.booked {
  position: relative;
  background-color: rgba(28, 28, 28, 0.899);
}

.booked td {
  color: rgba(255, 255, 255, 0.6);
  mix-blend-mode: luminosity;
}

.booked img, 
.booked .equipment-icon, 
.booked .equipment-icon-placeholder,
.booked .icon-with-counter {
  opacity: 0.6;
  filter: grayscale(80%);
}


/* Вибрані елементи в першій таблиці */
.selected {
  background-color: rgba(40, 167, 69, 0.2);
}

/* Кнопка додавання/видалення */
.plus-btn, .minus-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: rgba(30, 30, 30, 0.8);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.plus-btn::before {
  content: "+";
  font-size: 18px;
  font-weight: bold;
  color: #5e9bff;
}

.minus-btn::before {
  content: "×";
  font-size: 18px;
  font-weight: bold;
  color: #dc3545;
}

.plus-btn:hover {
  background-color: rgba(40, 40, 40, 0.9);
  transform: scale(1.05);
}

.minus-btn:hover {
  background-color: rgba(40, 40, 40, 0.9);
  transform: scale(1.05);
}

.plus-btn:disabled, .minus-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: rgba(20, 20, 20, 0.6);
}

/* Підсвітка при додаванні обладнання - ВИМКНЕНО ДЛЯ ШВИДКОДІЇ */
.selected-equipment-wrapper.highlight {
  /* Анімація вимкнена для миттєвого переносу обладнання */
}

/* Секція з таблицею та заголовком */
.table-section {
  width: 48%; /* Збільшуємо ширину секцій з 45% до 48% */
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Контейнер для заголовка таблиці */
.table-header {
  margin-bottom: 15px;
  text-align: center;
  width: 100%;
  height: 45px; /* Фіксована висота заголовка */
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* Стилі для заголовків таблиць */
.table-header h3 {
  margin: 0;
  font-size: 1.5em;
  padding: 8px 0;
  font-weight: 500;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
  width: 100%;
  text-align: center;
  letter-spacing: 0.5px;
}

/* Заголовок Доступне обладнання - світло-сірим кольором */
.equipment-section .table-header h3 {
  color: rgba(220, 220, 220, 0.8);
}

/* Заголовок Вибране обладнання - залишаємо білим */
.selected-section .table-header h3 {
  color: rgba(255, 255, 255, 0.95);
}

/* Оновлюємо шрифти для таблиць */
th {
  font-family: 'Ruberoid', Arial, sans-serif;
  font-weight: 700; /* Збільшуємо жирність шрифту з 500 до 700 */
  font-size: 1.1em;
}

td {
  font-family: 'Ruberoid', Arial, sans-serif;
  font-weight: normal;
  font-size: 1em;
}

/* Фіксовані розміри для обох секцій таблиць */
.equipment-section,
.selected-section {
  width: 48%; /* Збільшуємо ширину секцій з 45% до 48% */
  flex: 0 0 48%; /* Змінюємо flex-basis з 45% на 48% */
}

/* Переконуємось, що обидві таблиці мають однакову структуру */
#available-equipment,
#selected-equipment {
  min-width: 100%;
  table-layout: fixed;
}

/* Стилі для контейнера фільтрів у заголовках */
.filter-container {
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
}

/* Стилі для текстових полів фільтрів */
.filter-input {
  width: 100%;
  background-color: rgba(40, 40, 40, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.9em;
  padding: 3px 6px;
  border-radius: 4px;
}

.filter-input::placeholder {
  color: rgba(200, 200, 200, 0.5);
}

.filter-input:focus {
  background-color: rgba(50, 50, 50, 0.9);
  border-color: rgba(100, 150, 255, 0.6);
  box-shadow: 0 0 5px rgba(100, 150, 255, 0.3);
  color: white;
  outline: none;
}

/* Стилі для випадаючих списків фільтрів */
.filter-select {
  width: 100%;
  background-color: rgba(40, 40, 40, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.9em;
  padding: 3px 6px;
  border-radius: 4px;
}

.filter-select:focus {
  background-color: rgba(50, 50, 50, 0.9);
  border-color: rgba(100, 150, 255, 0.6);
  box-shadow: 0 0 5px rgba(100, 150, 255, 0.3);
  color: white;
  outline: none;
} 

.icon-with-counter {
  position: relative;
  display: inline-block;
}

/* Стилі для таблиці, коли дата не вибрана */
.date-not-selected {
  position: relative;
  opacity: 0.7;
  pointer-events: none;
}

.date-not-selected table {
  filter: blur(1px);
}

.date-reminder-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 15px 30px;
  border-radius: 10px;
  font-size: 1.2em;
  z-index: 100;
  box-shadow: 0 0 20px rgba(58, 183, 177, 0.3);
  border: 1px solid rgba(58, 183, 177, 0.5);
  text-align: center;
  backdrop-filter: blur(5px);
  max-width: 90%;
}

.clear-filters-btn {
  background-color: #333;
  color: #999;
  border: 1px solid #444;
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-filters-btn:hover {
  background-color: #444;
  color: #fff;
  border-color: #5e9bff;
  box-shadow: 0 0 8px rgba(94, 155, 255, 0.4);
}

.clear-filters-btn i {
  font-size: 14px;
}

/* Коли немає іконки, використовуємо текст */
.clear-filters-btn:not(:has(i))::before {
  content: "✕";
  font-size: 12px;
  margin-right: 5px;
}

