/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Кастомные стили для мобильного меню */
.mobile-menu-bg {
  background-color: #ffffff !important;
  border-left: 1px solid #e2e8f0 !important;
}

.mobile-overlay-bg {
  background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Фиксы для мобильного меню */
[data-mobile-menu-target="menu"] {
  background-color: #ffffff !important;
}

[data-mobile-menu-target="overlay"] {
  background-color: rgba(0, 0, 0, 0.5) !important;
}

/* тултип */
[data-tooltip] {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted currentColor;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 1000;
  pointer-events: none;
  margin-bottom: 5px;
  
  /* Умная ширина */
  min-width: 120px;
  max-width: min(300px, 80vw);
  white-space: normal;
  word-wrap: break-word;
  text-align: center;
  line-height: 1.3;
}

[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  pointer-events: none;
}

/* Дополнительные улучшения для мобильных */
@media (max-width: 640px) {
  [data-tooltip]:hover::after {
    min-width: 100px;
    max-width: min(250px, 90vw);
    font-size: 11px;
    padding: 5px 8px;
  }
}




/* лоадер */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Плавные переходы для встроенного индикатора */
[data-loading-target="spinner"] {
  transition: all 0.3s ease-in-out;
}

[data-loading-target="factText"] {
  transition: opacity 0.2s ease-in-out;
}

/* Анимация появления встроенного индикатора */
[data-loading-target="spinner"]:not(.hidden) {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Плавные переходы для Turbo Frame */
turbo-frame {
  transition: opacity 0.2s ease-in-out;
}

turbo-frame[busy] {
  opacity: 0.7;
}

/* Стили для raw HTML словарных статей */
.dictionary-raw-content {
  font-family: Georgia, serif;
  line-height: 1.6;
  color: #374151;
}

/* Русские слова с ударениями */
.dictionary-raw-content b {
  font-weight: 700;
  color: #1f2937;
}

/* Курсивные пометы и примеры */
.dictionary-raw-content i {
  font-style: italic;
  color: #6b7280;
  font-size: 0.95em;
}

/* Переносы строк */
.dictionary-raw-content br {
  line-height: 2;
}

/* Испанские переводы (после номеров) */
.dictionary-raw-content {
  counter-reset: translation-counter;
}

/* Стилизуем структуру словарной статьи */
.dictionary-raw-content > br:first-child {
  display: none;
}

/* Делаем испанские слова более заметными */
.dictionary-raw-content {
  font-size: 16px;
}

/* Выделяем основные переводы */
.dictionary-raw-content i b {
  font-weight: 400;
}

/* Грамматические пометы */
.dictionary-raw-content i:contains("м."),
.dictionary-raw-content i:contains("ж."),
.dictionary-raw-content i:contains("с.") {
  background-color: #f3f4f6;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* Примеры использования */
.dictionary-raw-content i:contains("—") {
  display: block;
  margin: 8px 0;
  padding: 8px 12px;
  background-color: #f8fafc;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
}

/* Номера значений */
.dictionary-raw-content {
  /* Стилизуем текст с номерами 1), 2), etc. */
}

/* Дополнительные стили для читаемости */
.dictionary-raw-content {
  max-height: 600px;
  overflow-y: auto;
}

.dictionary-raw-content::-webkit-scrollbar {
  width: 6px;
}

.dictionary-raw-content::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.dictionary-raw-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.dictionary-raw-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Простое и эффективное решение */
.dictionary-raw-content {
  font-family: Georgia, serif;
  line-height: 1.6;
  color: #374151;
  font-size: 15px;
}

/* Убираем все br в начале контента */
.dictionary-raw-content > br:first-child,
.dictionary-raw-content > br:first-child + br,
.dictionary-raw-content > br:first-child + br + br {
  display: none;
}

/* Стилизуем первое жирное слово как заголовок */
.dictionary-raw-content > b:first-child {
  display: block;
  font-size: 1.1em;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}

/* Убираем br сразу после первого b */
.dictionary-raw-content > b:first-child + br {
  display: none;
}

/* Компактное расстояние между элементами */
.dictionary-raw-content br {
  line-height: 1.4;
}

/* Стили для ссылок "см. (смотри)" */
.see-also {
  display: inline-block;
  margin: 4px 0;
  font-style: italic;
  color: #6b7280;
}

.dictionary-link {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 4px;
  text-decoration: none;
  font-family: inherit;
}

.dictionary-link:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.dictionary-link:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  .dictionary-link {
    padding: 4px 10px;
    font-size: 0.95em;
  }
}

/* Компактный дизайн переключателя на мобильных */
@media (max-width: 768px) {
  /* Переключатель направления */
  .language-direction-container .flex {
    gap: 2px;
    padding: 2px;
  }
  
  .language-direction-container label {
    padding: 6px 8px !important;
    font-size: 0.75rem !important;
    line-height: 1.2;
  }
  
  /* Популярные слова компактнее */
  .popular-words-container {
    margin-top: 12px;
    margin-bottom: 12px;
  }
  
  .popular-words-container h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }
  
  .popular-words-grid {
    gap: 6px;
  }
  
  .popular-words-grid button {
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
    min-height: 32px;
  }
  
  /* Индикатор загрузки более заметный на мобильных */
  .loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }
  
  /* Результаты поиска с отступом сверху */
  #dictionary_results {
    margin-top: 16px;
    scroll-margin-top: 20px;
  }
}

/* Анимация появления результатов */
#dictionary_results {
  transition: opacity 0.3s ease-in-out;
}

#dictionary_results.loading {
  opacity: 0.5;
}

/* Улучшенный индикатор загрузки */
.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 12px;
  margin: 16px 0;
}

.search-loading .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e2e8f0;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 12px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


/* Саджесты */
.suggestion-item {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.15s ease;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background-color: #f1f5f9;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-word {
  font-weight: 600;
  color: #1e293b;
}

.suggestion-translation {
  font-size: 0.9em;
  color: #64748b;
}

@media (max-width: 768px) {
  .suggestion-item {
    padding: 10px 12px;
  }
  
  .suggestion-word {
    font-size: 0.9rem;
  }
  
  .suggestion-translation {
    font-size: 0.8rem;
  }
}
