/* Стили кастомных модальных окон */
.custom-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1055;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-modal-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.18);
  min-width: 320px;
  max-width: 740px;
  width: 100%;
  overflow: hidden;
  animation: fadeInModal 0.2s;
  min-height: 600px; /* увеличиваем минимальную высоту для видимости кнопок */
  max-height: 80vh; /* ограничиваем максимальную высоту */
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1060;
}

@keyframes fadeInModal {
  from { transform: scale(0.98); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.custom-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem 0.7rem 1.2rem;
  font-size: 1.15rem;
  font-weight: 600;
  border-bottom: 1px solid #e5e5e5;
}

.custom-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: inherit;
  cursor: pointer;
  margin-left: 1rem;
}

.custom-modal-body {
  padding: 1.2rem 1.2rem 0.7rem 1.2rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  min-height: 0;
}

.custom-modal-footer {
  display: flex !important;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem 1.2rem 1.2rem;
  border-top: 1px solid #e5e5e5;
  background: #f8f9fa;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  min-height: 60px;
  align-items: center;
}

/* Ограничение высоты и скролл для списков ключевых слов */
.keywords-list {
  max-height: none;
  min-height: 120px;
  overflow-y: auto;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 8px 6px;
  background: #fafbfc;
  flex: 1;
}

/* Стилизация скроллбара для keywords-list */
.keywords-list::-webkit-scrollbar {
  width: 8px;
}

.keywords-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.keywords-list::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

/* Для Firefox */
.keywords-list {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db #f3f4f6;
}

/* Стили для кнопок в модальном окне */
.custom-modal-footer .btn {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 15 !important;
  min-width: 100px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-modal-footer .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Увеличенная иконка для кнопки 'добавить' */
.add-keyword-btn .fa-circle-plus {
  font-size: 0.7em !important;
  line-height: 1 !important;
}

/* Стили для вкладок ключевых слов */
.keywords-tabs {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #dee2e6;
  gap: 2px;
}

.keywords-tab-item {
  margin: 0;
}

.keywords-tab-link {
  display: block;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #6c757d;
  background: none;
  border: none;
  border-radius: 0.375rem 0.375rem 0 0;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
}

.keywords-tab-link:hover {
  color: #495057;
  background-color: #f8f9fa;
}

.keywords-tab-link.active {
  color: #0d6efd;
  background-color: #fff;
  border-bottom: 2px solid #0d6efd;
}

.keywords-tab-content {
  margin-top: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.keywords-tab-pane {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.keywords-tab-pane.show {
  display: flex;
}

.keywords-tab-pane.active {
  display: flex;
}

/* Кастомные стили для поля поиска и селектора категорий в модальном окне ключевых слов */
#customKeywordsModal .custom-modal-body .d-flex.flex-wrap.align-items-center.gap-2.mb-2 {
  gap: 12px;
}

#customKeywordsModal .custom-modal-body input#keywords-search-input,
#customKeywordsModal .custom-modal-body select#keywords-category-filter {
  border-radius: 8px;
  background: #f6f8fa;
  border: 1.5px solid #bfc5cc;
  font-size: 1em;
  padding: 8px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  height: 38px;
  margin-bottom: 0;
}

#customKeywordsModal .custom-modal-body input#keywords-search-input:focus {
  border-color: #198754;
  outline: none;
  box-shadow: 0 0 0 2px rgba(25,135,84,0.10);
  background: #fff;
}

#customKeywordsModal .custom-modal-body select#keywords-category-filter {
  min-width: 170px;
  background: #e9ecef;
  color: #222;
  border: 1.5px solid #bfc5cc;
  cursor: pointer;
  font-weight: 500;
  height: 38px;
  margin-bottom: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

#customKeywordsModal .custom-modal-body select#keywords-category-filter:focus {
  border-color: #198754;
  background: #fff;
}

#customKeywordsModal .custom-modal-body .btn {
  margin-bottom: 0;
}

#customKeywordsModal .custom-modal-body input#keywords-search-input {
  background: #fff;
  border: 1.5px solid #198754;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(25,135,84,0.04);
}

/* Иконки в селекте категорий */
#customKeywordsModal .custom-modal-body select#keywords-category-filter option {
  padding-left: 1.5em;
} 