:root {
  /* Modern Color Palette */
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --primary-blue-light: #dbeafe;
  --success-green: #10b981;
  --success-green-hover: #059669;
  --warning-orange: #f59e0b;
  --error-red: #ef4444;

  /* Neutral Colors */
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Typography */
  --font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;

  /* Spacing */
  --sidebar-width: 260px;
  --border-radius: 4px;
  --border-radius-lg: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
  font-family: var(--font-family);
  background: var(--gray-50);
  min-height: 100vh;
  color: var(--gray-900);
  line-height: 1.5;
  font-size: 14px;
}

/* Sidebar styles unified in shared.css (.sidebar / .nav-item / .sidebar-toggle) */

/* AI Chatbot Styles */
.ai-chatbot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  max-height: 600px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-chatbot.collapsed {
  width: 90px;
  height: 90px;
  border-radius: 50%;
}

.ai-chatbot.opening {
  animation: chatbotExpand 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.chatbot-input-area button[onclick="openImportAiCompanyModal()"] {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  height: 28px;
  align-self: flex-start;
}

.chatbot-input-area button[onclick="openImportAiCompanyModal()"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.chatbot-input-area button[onclick="openImportAiCompanyModal()"]:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-chatbot.closing {
  animation: chatbotCollapse 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes chatbotExpand {
  0% {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    max-height: 90px;
  }
  50% {
    border-radius: 30px;
  }
  100% {
    width: 380px;
    max-height: 600px;
    border-radius: 20px;
  }
}

@keyframes chatbotCollapse {
  0% {
    width: 380px;
    max-height: 600px;
    border-radius: 20px;
  }
  50% {
    border-radius: 30px;
  }
  100% {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    max-height: 90px;
  }
}

/* Header Styles */
.chatbot-header {
  background: rgba(255, 255, 255, 0.1);
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

/* В свернутом состоянии показываем аватар и текст */
.ai-chatbot.collapsed .chatbot-header {
  padding: 8px;
  background: transparent;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 2px;
}

.chatbot-header:hover {
  background: rgba(255, 255, 255, 0.15);
}

.ai-chatbot.collapsed .chatbot-header:hover {
  background: rgba(255, 255, 255, 0.2);
}

.bot-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 600;
  font-size: 16px;
}

/* В свернутом состоянии показываем вертикально */
.ai-chatbot.collapsed .bot-title {
  flex-direction: column;
  gap: 1px;
  text-align: center;
  line-height: 1;
}

.bot-avatar {
  font-size: 24px;
  animation: pulse 2s infinite;
}

/* В свернутом состоянии увеличиваем аватар */
.ai-chatbot.collapsed .bot-avatar {
  font-size: 24px;
}

/* Текст в свернутом состоянии */
.ai-chatbot.collapsed .bot-title .bot-text {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.chatbot-toggle {
  color: white;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s ease;
  padding: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* Content Styles */
.chatbot-content {
  background: white;
  height: 500px;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.ai-chatbot.collapsed .chatbot-content {
  opacity: 0;
  height: 0;
  overflow: hidden;
}

/* В свернутом состоянии показываем только аватар и текст AI Help */
.ai-chatbot.collapsed .bot-title .bot-text:not(.bot-avatar) {
  display: block;
}

.ai-chatbot.collapsed .chatbot-toggle {
  display: none;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #5a6fd8;
}

/* Message Styles */
.chat-message {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 85%;
  word-wrap: break-word;
  animation: messageSlideIn 0.3s ease-out;
  line-height: 1.4;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.bot {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  margin-right: auto;
  border-bottom-left-radius: 6px;
  position: relative;
}

.chat-message.bot::before {
  content: "🤖";
  position: absolute;
  left: -8px;
  top: -8px;
  background: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-message.user {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 6px;
  position: relative;
}

.chat-message.user::before {
  content: "👤";
  position: absolute;
  right: -8px;
  top: -8px;
  background: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 18px;
  margin-bottom: 16px;
  max-width: 85%;
  color: #666;
  font-style: italic;
  animation: messageSlideIn 0.3s ease-out;
}

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

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #667eea;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingDot {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Input Area */
.chatbot-input-area {
  padding: 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.main-input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

#searchWithAIInput {
  flex: 1;
  border: 2px solid #e9ecef;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14px;
  resize: none;
  outline: none;
  transition: all 0.3s ease;
  background: white;
  max-height: 80px;
  min-height: 44px;
  font-family: inherit;
}

#searchWithAIInput:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#searchWithAIInput::placeholder {
  color: #adb5bd;
}

/* Модальное окно импорта Google Sheet */
#importSheetModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: none;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  min-width: 500px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1000;
  animation: modalFadeIn 0.3s ease-out;
}

#importSheetModal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Заголовок модального окна */
#importSheetModal h2 {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  margin: 0;
  padding: 20px 30px;
  border-radius: 16px 16px 0 0;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
}

/* Форма */
#importSheetForm {
  padding: 30px;
}

/* Группы полей */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

/* Поля ввода */
#googleSheetIdInput,
#sheetNameSelect {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
  box-sizing: border-box;
}

#googleSheetIdInput:focus,
#sheetNameSelect:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#sheetNameSelect:disabled {
  background-color: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* Placeholder стили */
#googleSheetIdInput::placeholder {
  color: #9ca3af;
  font-style: italic;
}

/* Кнопка загрузки листов */
.load-sheets-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.load-sheets-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.load-sheets-btn:active {
  transform: translateY(0);
}

/* Статус листа */
.sheet-status {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #64748b;
}

/* Кнопки действий */
.buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #d1d5db;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* Сообщения об ошибках и успехе */
.error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 15px;
  font-size: 14px;
  display: none;
}

.error:not(:empty) {
  display: block;
}

.success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 15px;
  font-size: 14px;
  display: none;
}

.success:not(:empty) {
  display: block;
}

/* Состояния загрузки */
.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #4f46e5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Адаптивность */
@media (max-width: 640px) {
  #importSheetModal {
    min-width: auto;
    width: 95vw;
    margin: 20px;
  }

  #importSheetForm {
    padding: 20px;
  }

  #importSheetModal h2 {
    padding: 15px 20px;
    font-size: 18px;
  }

  .buttons {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .load-sheets-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Улучшенная типографика */
#importSheetModal * {
  box-sizing: border-box;
}

/* Фокус для доступности */
#importSheetModal button:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

#sendButton {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#sendButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#sendButton:active {
  transform: translateY(0);
}

/* Модальное окно импорта компании */
#importCompanyModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: none;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  min-width: 500px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1000;
  animation: modalFadeIn 0.3s ease-out;
}

#importCompanyModal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Заголовок модального окна */
#importCompanyModal h2 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin: 0;
  padding: 20px 30px;
  border-radius: 16px 16px 0 0;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
}

/* Форма */
#importCompanyForm {
  padding: 30px;
}

/* Группы полей */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

/* Поля ввода */
#googleCompanySheetIdInput,
#companySheetNameSelect {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

#googleCompanySheetIdInput:focus,
#companySheetNameSelect:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#companySheetNameSelect:disabled {
  background-color: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* Кнопка загрузки листов */
.load-sheets-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.load-sheets-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Статус листа */
.sheet-status {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
}

/* Группа радио кнопок */
.radio-group {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.radio-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #667eea;
  cursor: pointer;
}

.radio-option label {
  margin-bottom: 0;
  cursor: pointer;
  font-weight: 500;
  color: #374151;
}

.radio-option input[type="radio"]:checked + label {
  color: #667eea;
  font-weight: 600;
}

/* Кнопки действий */
.buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

/* Сообщения об ошибках и успехе */
.error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 15px;
  font-size: 14px;
}

.success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 15px;
  font-size: 14px;
}

/* Адаптивность */
@media (max-width: 640px) {
  #importCompanyModal {
    min-width: auto;
    width: 95vw;
    margin: 20px;
  }

  #importCompanyForm {
    padding: 20px;
  }

  #importCompanyModal h2 {
    padding: 15px 20px;
    font-size: 18px;
  }

  .radio-group {
    flex-direction: column;
    gap: 12px;
  }

  .buttons {
    flex-direction: column-reverse;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .ai-chatbot {
    width: calc(100vw - 40px);
    right: 20px;
    left: 20px;
    max-height: 70vh;
  }

  .ai-chatbot.collapsed {
    width: 90px;
    left: auto;
    right: 20px;
  }

  @keyframes chatbotExpand {
    0% {
      width: 90px;
      height: 90px;
      border-radius: 50%;
      max-height: 90px;
      left: auto;
      right: 20px;
    }
    100% {
      width: calc(100vw - 40px);
      max-height: 70vh;
      border-radius: 20px;
      left: 20px;
      right: 20px;
    }
  }

  .chat-messages {
    padding: 15px;
  }

  .chatbot-input-area {
    padding: 15px;
  }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
  .chatbot-content {
    background: #1a1a1a;
    color: #e0e0e0;
  }

  .typing-indicator {
    background: #2a2a2a;
    color: #b0b0b0;
  }

  .chatbot-input-area {
    background: #2a2a2a;
    border-top-color: #404040;
  }

  #searchWithAIInput {
    background: #1a1a1a;
    border-color: #404040;
    color: #e0e0e0;
  }

  #searchWithAIInput::placeholder {
    color: #666;
  }

  #searchWithAIInput:focus {
    border-color: #667eea;
  }
}

/* Nav sidebar + toggle styles unified in shared.css */

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-260px);
}

.sidebar.collapsed + .sidebar-toggle {
  left: 16px;
}

.sidebar.collapsed ~ .main-content {
  margin-left: 0;
}

#personDomainFieldsContainer,
#companyLocationFieldsContainer,
#personLocationFieldsContainer,
#companyFieldsContainer,
#titleFieldsContainer,
#notLocationFieldsContainer,
#technologiesFieldsContainer {
  max-height: 150px; /* Ограничиваем высоту */
  overflow-y: auto; /* Добавляем вертикальный скролл */
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 8px;
  margin-top: 8px;
}

/* Кастомный скроллбар для лучшего вида */
#personDomainFieldsContainer::-webkit-scrollbar,
#companyLocationFieldsContainer::-webkit-scrollbar,
#personLocationFieldsContainer::-webkit-scrollbar,
#companyFieldsContainer::-webkit-scrollbar,
#titleFieldsContainer::-webkit-scrollbar,
#notLocationFieldsContainer::-webkit-scrollbar,
#technologiesFieldsContainer::-webkit-scrollbar {
  width: 6px;
}

#personDomainFieldsContainer::-webkit-scrollbar-track,
#companyLocationFieldsContainer::-webkit-scrollbar-track,
#personLocationFieldsContainer::-webkit-scrollbar-track,
#companyFieldsContainer::-webkit-scrollbar-track,
#titleFieldsContainer::-webkit-scrollbar-track,
#notLocationFieldsContainer::-webkit-scrollbar-track,
#technologiesFieldsContainer::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

#personDomainFieldsContainer::-webkit-scrollbar-thumb,
#companyLocationFieldsContainer::-webkit-scrollbar-thumb,
#personLocationFieldsContainer::-webkit-scrollbar-thumb,
#companyFieldsContainer::-webkit-scrollbar-thumb,
#titleFieldsContainer::-webkit-scrollbar-thumb,
#notLocationFieldsContainer::-webkit-scrollbar-thumb,
#technologiesFieldsContainer::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.search-page-layout {
  display: flex;
  min-height: 100vh;
}

.search-sidebar {
  width: 360px;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: 24px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.search-main {
  flex: 1;
  padding: 24px;
  background: var(--gray-50);
}

.back-button {
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: var(--border-radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
}

.back-button:hover {
  background: var(--primary-blue-hover);
  transform: translateY(-1px);
}

.search-sidebar .sidebar-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.search-sidebar .sidebar-header h2 {
  color: var(--gray-900);
  margin-bottom: 4px;
  font-size: 18px;
  font-weight: 600;
}

.search-sidebar .sidebar-header p {
  color: var(--gray-600);
  font-size: 13px;
}

.main-header {
  margin-bottom: 32px;
  text-align: center;
}

.main-header h1 {
  color: var(--gray-900);
  margin-bottom: 8px;
  font-size: 28px;
  font-weight: 700;
}

.main-header p {
  color: var(--gray-600);
  font-size: 14px;
}

/* Modern Button Grid */
.parent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}

.div1,
.div2 {
  grid-area: auto;
}

/* Filter Section Styles */
.search-section {
  margin-bottom: 12px;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--gray-200);
  transition: all 0.2s ease;
}

.search-section:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-sm);
}

.section-header {
  padding: 12px 16px;
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  user-select: none;
}

.section-header:hover {
  background: var(--gray-100);
}

.section-header.active {
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
}

.section-header h3 {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-900);
}

.section-toggle {
  font-size: 12px;
  transition: transform 0.2s ease;
  color: var(--gray-400);
}

.section-toggle.active {
  transform: rotate(180deg);
}

.section-content {
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.3s ease,
    padding 0.3s ease;
  background: var(--white);
}

.section-content.active {
  max-height: 400px;
  padding: 16px;
}

.form-group {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group span {
  display: block;
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 4px;
  font-weight: 500;
}

/* Modern Form Controls */
input,
select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: 13px;
  transition: all 0.2s ease;
  background: var(--white);
  color: var(--gray-900);
}

input:hover,
select:hover {
  border-color: var(--gray-300);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

input::placeholder {
  color: var(--gray-400);
  font-size: 13px;
}

/* Modern Buttons */
.form-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.primary {
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  padding: 10px 16px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s ease;
}

.primary:hover {
  background: var(--primary-blue-hover);
}

.primary:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.secondary {
  background: var(--white);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  padding: 10px 16px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s ease;
}

.secondary:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

.secondary.active {
  background: var(--primary-blue);
  color: var(--white);
  border-color: var(--primary-blue);
}

/* Progress Bar */
#progressContainer {
  width: 100%;
  margin: 12px 0;
}

#progressLabel {
  font-size: 12px;
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 6px;
  font-weight: 500;
}

#progressBar {
  width: 100%;
  height: 8px;
  background-color: var(--gray-100);
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--primary-blue);
  transition: width 0.3s ease;
  border-radius: var(--border-radius);
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 500;
}

/* Results Area */
#apolloSearchResults {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.results-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

.results-count {
  color: var(--gray-600);
  font-size: 14px;
}

.results-count strong {
  color: var(--primary-blue);
  font-weight: 600;
}

.results-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Results List */
.results-body {
  max-height: 500px;
  overflow-y: auto;
}

.result-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.result-item:hover {
  border-color: var(--primary-blue);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.result-item:last-child {
  margin-bottom: 0;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 16px;
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-title {
  color: var(--primary-blue);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.result-company {
  color: var(--gray-600);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.reveal-btn {
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s ease;
  min-width: 120px;
  flex-shrink: 0;
}

.reveal-btn:hover {
  background: var(--primary-blue-hover);
  transform: translateY(-1px);
}

.reveal-btn:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
  transform: none;
}

.reveal-btn.loading {
  background: var(--gray-400);
}

.reveal-btn.success {
  background: var(--success-green);
}

/* Details Container */
.details-container {
  display: none;
  margin-top: 12px;
  transition: all 0.3s ease;
}

.details-container.revealed {
  display: block;
  opacity: 1;
}

.details-content {
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.detail-item {
  background: var(--white);
  padding: 12px;
  border-radius: var(--border-radius);
  border-left: 3px solid var(--primary-blue);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.detail-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.detail-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.detail-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-900);
  word-break: break-word;
}

.detail-value.empty {
  color: var(--gray-400);
  font-style: italic;
}

.detail-value a {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.detail-value a:hover {
  color: var(--primary-blue-hover);
  text-decoration: underline;
}

/* Special detail types */
.detail-item.contact {
  border-left-color: var(--success-green);
}
.detail-item.company {
  border-left-color: var(--warning-orange);
}
.detail-item.location {
  border-left-color: #8b5cf6;
}
.detail-item.social {
  border-left-color: #06b6d4;
}

/* Loading spinner */
.loading-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--white);
  animation: spin 1s linear infinite;
  margin-left: 6px;
}

/* Error message */
.error-message {
  background: #fef2f2;
  color: var(--error-red);
  padding: 12px;
  border-radius: var(--border-radius);
  border-left: 3px solid var(--error-red);
  font-weight: 500;
  font-size: 13px;
}

/* Empty State */
.empty-state {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 48px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.empty-state div:first-child {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.7;
}

.empty-state h3 {
  font-size: 20px;
  color: var(--gray-900);
  margin-bottom: 8px;
  font-weight: 600;
}

.empty-state p {
  color: var(--gray-600);
  font-size: 14px;
  line-height: 1.5;
  max-width: 320px;
  margin: 0 auto;
}

/* Auth Container */
#authContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--primary-blue) 0%,
    var(--primary-blue-hover) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-box {
  background: var(--white);
  padding: 32px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  min-width: 320px;
  border: 1px solid var(--gray-200);
}

.auth-box h1 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--gray-900);
  font-weight: 600;
}

.company-name-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

#company-content .form-group {
  display: block;
}

.add-field-btn {
  padding: 4px 8px;
  font-size: 14px;
}

.remove-field-btn {
  padding: 4px 8px;
  font-size: 14px;
}

/* Ensure vertical stacking and consistent spacing */
.search-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-section {
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 10px 0;
  font-size: 1.1em;
}

.section-header.active .section-toggle {
  transform: rotate(180deg);
}

.section-content {
  display: none;
  padding: 10px 0;
}

.section-content.active {
  display: block;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.form-group input[type="text"],
.form-group input[type="number"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 14px;
}

.form-group input[type="checkbox"] {
  margin-right: 5px;
}

.checkbox-group label {
  display: block;
  margin-bottom: 5px;
}

.input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.additional-title,
.additional-company-name,
.additional-industry,
.additional-country,
.additional-not-location,
.additional-technologies {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 14px;
}

.secondary {
  padding: 8px 16px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.secondary:hover {
  background: #878c8f;
}

.remove-field-btn {
  padding: 4px 8px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.remove-field-btn:hover {
  background: #c82333;
}

.primary {
  padding: 10px 20px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.primary:hover {
  background: #0056b3;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.parent {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.div1,
.div2 {
  flex: 1;
}

.div1 button,
.div2 button {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

.div1 button.active,
.div2 button.active {
  background: #007bff;
  color: white;
}

.additional-company-name {
  width: 100%;
  padding: 8px;
  margin-top: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-900);
  width: fit-content; /* Ограничивает ширину под содержимое */
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-blue);
  cursor: pointer;
  flex-shrink: 0; /* Предотвращает сжатие чекбокса */
  margin: 0; /* Убирает внешние отступы для единообразия */
}

.checkbox-group input[type="checkbox"]:checked {
  background-color: var(--primary-blue);
  border-color: var(--primary-blue);
}

select[multiple] {
  width: 100%;
  height: 120px;
  padding: 5px;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  background-color: var(--white);
}

select[multiple]:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

select[multiple] option:checked {
  background: var(--primary-blue-light); /* #dbeafe */
  color: var(--gray-900);
}

.auth-box p {
  color: var(--gray-600);
  margin-bottom: 20px;
  font-size: 14px;
}

.auth-box input {
  width: 100%;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: 14px;
}

.auth-box button {
  width: 100%;
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  padding: 12px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-box button:hover {
  background: var(--primary-blue-hover);
}

/* Responsive Design */

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }

  .search-sidebar {
    width: 320px;
    padding: 20px;
  }

  .search-main {
    padding: 24px;
  }
}

/* Mobile Large */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar-toggle {
    left: 16px;
    display: flex;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .search-page-layout {
    flex-direction: column;
  }

  .search-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
    padding: 16px;
  }

  .search-main {
    padding: 16px;
  }

  .main-header h1 {
    font-size: 24px;
  }

  .form-group {
    flex-direction: column;
  }

  .parent {
    grid-template-columns: 1fr;
  }

  .results-header {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .results-actions {
    flex-direction: column;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .reveal-btn {
    align-self: flex-start;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Small */
@media (max-width: 480px) {
  .search-sidebar {
    padding: 12px;
  }

  .search-main {
    padding: 12px;
  }

  .search-sidebar .sidebar-header {
    margin-bottom: 16px;
  }

  .search-sidebar .sidebar-header h2 {
    font-size: 18px;
  }

  .main-header {
    margin-bottom: 24px;
  }

  .main-header h1 {
    font-size: 20px;
  }

  .section-content.active {
    padding: 16px;
  }

  .form-actions {
    margin-top: 16px;
  }

  #apolloSearchResults {
    padding: 16px;
  }

  .result-item {
    padding: 16px;
  }

  .empty-state {
    padding: 32px 20px;
  }

  .empty-state div:first-child {
    font-size: 36px;
  }

  .empty-state h3 {
    font-size: 20px;
  }

  .auth-box {
    margin: 20px;
    min-width: auto;
    padding: 24px;
  }
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Button focus states */
button:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.nav-item:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: -2px;
}

/* Плавные переходы */
* {
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}
