html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: Arial, sans-serif;
  box-sizing: border-box;
}

body::-webkit-scrollbar {
  width: 12px;            /* Ширина полосы прокрутки */
}

body::-webkit-scrollbar-track {
  background: #f1f1f1;    /* Цвет дорожки скролла */
}

body::-webkit-scrollbar-thumb {
  background: #888;       /* Цвет ползунка скролла */
}

body:hover::-webkit-scrollbar-thumb {
  background: #555;       /* Цвет ползунка при hover */
}

h1 {
  text-align: center;     /* Центрируем заголовки */
  font-size: 20px;        /* Размер шрифта */
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1); /* Лёгкая тень */
}

a {
  color: inherit;         /* Наследуем цвет текста */
}

a:hover {
  color: #888888;         /* Цвет при наведении */
  text-decoration: underline; /* Подчёркивание при наведении */
}

a:active,
a:visited {
  color: #f47059;         /* Цвет активных/посещённых ссылок */
}

/* ============================================================================
   ФОРМА ПОИСКА + ИНПУТ + МИКРОФОН
   ============================================================================ */

.search-form {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

.search-input-wrapper {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

/* инпут: скрепка слева, микрофон и крестик справа */
.search-input-wrapper input[type="search"] {
  width: 100%;
  padding-left: 44px;
  padding-right: 40px;
}

.search-input-wrapper.has-voice input[type="search"] {
  padding-right: 42px;
}

.search-input-wrapper.has-voice input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-right: 24px;
  cursor: pointer;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E")
    center / 14px 14px no-repeat;
}

.search-input-wrapper.has-voice input[type="search"]::-webkit-search-cancel-button:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
}

.attach-btn {
  position: absolute;
  left: 0;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 26px;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6b7280;
  flex-shrink: 0;
  z-index: 1;
}

.attach-btn:hover {
  color: #4f46e5;
}

.attach-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25);
  border-radius: 50%;
}

.attach-btn.has-file {
  color: #4f46e5;
}

.search-attachment-preview {
  width: 100%;
  min-width: 0;
  line-height: 1;
}

.search-attachment-preview[hidden] {
  display: none !important;
}

.search-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.18);
  color: #4338ca;
  font-size: 11px;
  line-height: 1.2;
}

.search-attachment-chip svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.search-attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.search-attachment-remove {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 1px;
  opacity: 0.7;
}

.search-attachment-remove:hover {
  opacity: 1;
}

.ai-attachment-badge {
  background: rgba(79, 70, 229, 0.08);
  color: #4338ca;
  font-size: 11px;
  padding: 3px 8px;
}

/* микрофон внутри инпута, без красной рамки */
.voice-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  color: #ff4d4d; /* красный микрофон */
  flex-shrink: 0;
  z-index: 1;
}

/* маленький красный микрофон */
.voice-btn svg {
  color: #ff4d4d;
}

/* фокус без агрессивной рамки */
.voice-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 77, 77, 0.35);
  border-radius: 50%;
}

/* скрытие через класс, а не style */
.voice-btn.is-hidden {
  display: none;
}

/* состояние "слушаю" — оставляем твою анимацию, только без рамки */
.voice-btn.listening {
  background: rgba(255, 77, 77, 0.12);
  animation: pulse-voice 1.5s ease-in-out infinite;
  color: #00ff00;
}

/* ============================================================================
   AI результат: общий контейнер
   ============================================================================ */

.ai-result-container {
  background: rgba(255,255,255,0.9);
  border-radius: 14px;
  border: 1px solid rgba(220,53,69,0.12);
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
  padding: 12px 14px;
  margin-top: 12px;
}

/* Заголовок (если понадобится) */
.ai-result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.ai-model {
  font-size: 11px;
  color: #6b7280;
}

/* Контент ответа */

.ai-result-content {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.6;
  color: #111827;
}

.ai-result-content a {
  color: #111827;
  text-decoration: none;
  border-bottom: 1px dashed rgba(79,70,229,0.25);
}

.ai-result-content a:hover {
  color: #111827;
  border-bottom-style: solid;
}

.ai-result-content h1,
.ai-result-content h2,
.ai-result-content h3 {
  margin: 12px 0 4px;
  font-weight: 600;
}

.ai-result-content ul {
  padding-left: 18px;
  margin: 4px 0 8px;
}

.ai-result-content li {
  margin-bottom: 3px;
}

.ai-result-content .md-link {
  color: #4f46e5;
  text-decoration: none;
  border-bottom: 1px dashed rgba(79,70,229,0.5);
}

.ai-result-content .md-link:hover {
  border-bottom-style: solid;
}

/* Лоадер */

.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 4px;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #4f46e5;
  animation: serpmonn-dot 1s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.loading-text {
  font-size: 13px;
  color: #6b7280;
}

@keyframes serpmonn-dot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Бейдж «найден через поиск» */

.ai-search-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #111111;
  background: rgba(0,0,0,0.04);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 4px;
}

.ai-search-badge svg {
  width: 12px;
  height: 12px;
}

/* Футер: действия + оценка + время */

.ai-result-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;   /* все иконки группой слева */
  gap: 8px;
  margin-top: 10px;
}

/* Группы кнопок */
.ai-actions,
.ai-feedback {
  display: flex;
  gap: 6px;
}

.ai-result-footer.is-pending .ai-actions,
.ai-result-footer.is-pending .ai-feedback {
  display: none;
}

.ai-result-footer:not(.is-pending) .ai-actions,
.ai-result-footer:not(.is-pending) .ai-feedback {
  animation: ai-actions-in 0.2s ease;
}

@keyframes ai-actions-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Базовый стиль круглых кнопок */
.ai-action-btn,
.feedback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(220, 53, 69, 0.35); /* красный бордер */
  background: linear-gradient(145deg, #111111, #1a1a1a); /* как search-btn */
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, transform 0.15s ease,
              box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Общий вид иконок */
.ai-icon {
  width: 18px;
  height: 18px;
  stroke: red;           /* красный цвет */
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Hover/Active эффекты */
.ai-action-btn:hover,
.feedback-btn:hover {
  background: linear-gradient(145deg, #1a1a1a, #222222);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.ai-action-btn:active,
.feedback-btn:active {
  transform: translateY(0) scale(0.96);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Дополнительный акцент для лайка/дизлайка */
.feedback-btn.like {
  border-color: rgba(40, 167, 69, 0.4); /* зелёный оттенок для лайка */
}

.feedback-btn.dislike {
  border-color: rgba(220, 53, 69, 0.7); /* более насыщенный красный для дизлайка */
}

/* Время генерации */

.ai-timestamp {
  color: #9ca3af;
  font-size: 11px;
}

/* Блок источников */

.ai-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.35);
}

.ai-sources-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-sources-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.ai-source-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-source-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.ai-source-chip-favicon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.ai-sources-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 4px 8px;
  font-size: 11px;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.ai-sources-toggle:hover {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.06);
}

.ai-sources-chevron {
  transition: transform 0.2s ease;
}

.ai-sources.is-expanded .ai-sources-chevron {
  transform: rotate(180deg);
}

.ai-sources-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-sources-list[hidden] {
  display: none;
}

.source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  background: transparent;
  border-radius: 8px;
  padding: 4px 6px;
  text-decoration: none;
  color: inherit;
}

.source-item:hover {
  background: #f3f4ff;
}

.source-favicon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.source-title {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-url {
  flex-shrink: 0;
  color: #6b7280;
  font-size: 11px;
}

/* Ошибка */

.ai-error {
  padding: 12px 10px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 13px;
}

.ai-error .error-icon {
  font-size: 18px;
  margin-bottom: 4px;
}

.ai-error .retry-btn {
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #fee2e2;
  color: #b91c1c;
}


/* Findings / activity / share modal styles: see menu.css (loaded via styles.css and menu.html) */
