/* filename: public/style.css */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d;
  --bg-selected: #1f6feb1a;
  --border-color: #30363d;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #656d76;
  --accent-primary: #1f6feb;
  --accent-hover: #1158c7;
  --accent-secondary: #238636;
  --danger: #da3633;
  --danger-hover: #b92b29;
  --warning: #d29922;
  --success: #238636;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3);
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden; /* по умолчанию для админки */
}

/* --- страница статистики: разрешаем скролл и центрируем контент --- */
body.stats-page {
  overflow: auto;
}

.stats-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}

/* липкая панель фильтров */
.stats-filters {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: color-mix(in srgb, var(--bg-secondary), transparent 15%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  backdrop-filter: blur(6px);
}

/* ограничения по ширине для grid внутри статистики */
.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.hidden {
  display: none !important;
}

/* === LOGIN SCREEN === */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header i {
  font-size: 3rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.login-header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--text-secondary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  position: relative;
}

.input-group i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.input-group input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.status-message {
  padding: 12px;
  border-radius: var(--radius-sm);
  text-align: center;
  margin-top: 1rem;
}

.status-message.success {
  background: rgba(35, 134, 54, 0.2);
  border: 1px solid var(--success);
  color: var(--success);
}

.status-message.error {
  background: rgba(218, 54, 51, 0.2);
  border: 1px solid var(--danger);
  color: var(--danger);
}

/* === ADMIN PANEL === */
.admin-panel {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left i {
  font-size: 1.5rem;
  color: var(--accent-primary);
}

.header-left h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.welcome-text {
  color: var(--text-secondary);
  font-size: 14px;
}

.main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* === SIDEBAR === */
.sidebar {
  width: 500px; /* Увеличиваем до 500px для полного отображения названий */
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible; /* Разрешаем горизонтальную прокрутку если нужно */
  padding: 0.5rem;
  min-width: 0;
}

.category-tree {
  user-select: none;
}

.tree-children {
  display: block;
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  max-height: 1000px;
  opacity: 1;
}

.tree-children.collapsed {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
}

/* Визуальные линии связи - убираем вертикальные линии */
.tree-children::before {
  display: none;
}

/* Отступы для вложенности - строго вертикальное расположение */
.tree-children .tree-item {
  margin-left: 0 !important;
  margin-top: 2px;
  width: 100% !important;
  background: var(--bg-secondary);
  position: relative;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  padding-left: 12px !important;
}

.tree-children .tree-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border-color);
  opacity: 0.3;
}

.tree-children .tree-item:hover {
  border-left-color: var(--accent-primary);
  background: var(--bg-hover);
}

.tree-children .tree-item:hover::before {
  background: var(--accent-primary);
  opacity: 0.6;
}

/* Специальные стили для разных уровней вложенности */
.tree-children .tree-children .tree-item {
  margin-left: 0 !important;
  margin-top: 2px;
  width: 100% !important;
  background: var(--bg-tertiary);
  border-left: 3px solid var(--border-color);
  padding-left: 24px !important;
}

.tree-children .tree-children .tree-item::before {
  left: 0;
  width: 3px;
}

.tree-children .tree-children .tree-children .tree-item {
  margin-left: 0 !important;
  margin-top: 2px;
  width: 100% !important;
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-primary);
  padding-left: 36px !important;
}



/* === CONTENT === */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
  font-size: 14px;
}

.breadcrumb-item {
  color: var(--text-secondary);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--text-muted);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.selection-info {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 14px;
}

.questions-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.questions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 3rem;
  font-size: 16px;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.question-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.question-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow);
}

.question-card.selected {
  background: var(--bg-selected);
  border-color: var(--accent-primary);
}

.question-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: between;
  margin-bottom: 0.5rem;
}

.question-id {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.question-difficulty {
  margin-left: auto;
  color: var(--warning);
  font-size: 12px;
}

.question-text {
  font-weight: 500;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.question-answers {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.answer-option.correct {
  color: var(--success);
  font-weight: 500;
}

.answer-letter {
  width: 16px;
  height: 16px;
  background: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
}

.answer-option.correct .answer-letter {
  background: var(--success);
  color: white;
}

/* === CONTEXT MENU === */
.context-menu {
  position: fixed;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 180px;
  padding: 4px 0;
}

.context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}

.context-item:hover {
  background: var(--bg-hover);
}

.context-item.danger {
  color: var(--danger);
}

.context-item.danger:hover {
  background: rgba(218, 54, 51, 0.1);
}

.context-item.warning {
  color: var(--warning);
}

.context-item.warning:hover {
  background: rgba(210, 153, 34, 0.1);
}

.context-menu hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 4px 0;
}

/* === MODALS === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.modal-content.large {
  max-width: 700px;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.answer-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.answer-input input[type="text"] {
  flex: 1;
}

.answer-input input[type="radio"] {
  width: auto;
  margin: 0;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* === LOADING === */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* === TOAST === */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 300px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success {
  border-color: var(--success);
  color: var(--success);
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

.toast.info {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: 200px;
  }
  
  .questions-grid {
    grid-template-columns: 1fr;
  }
}

.sidebar-actions {
  display: flex;
  gap: 4px;
}

/* === TREE SEARCH === */
.tree-search {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-group i {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-size: 12px;
  z-index: 1;
}

.search-input-group input {
  width: 100%;
  padding: 8px 10px 8px 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--transition);
}

.search-input-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.1);
}

.search-input-group input::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.btn-clear-search {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  transition: var(--transition);
  opacity: 0;
}

.search-input-group input:not(:placeholder-shown) + .btn-clear-search {
  opacity: 1;
}

.btn-clear-search:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* === ARCHIVE === */
.archived-categories {
  max-height: 400px;
  overflow-y: auto;
}

.archived-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.archived-item-info {
  flex: 1;
}

.archived-item-info strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.archived-item-info small {
  color: var(--text-secondary);
  font-size: 12px;
}

.archived-item-actions {
  display: flex;
  gap: 8px;
}

.btn-restore {
  background: var(--accent-secondary);
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.btn-restore:hover {
  background: #2ea043;
}
/* === TREE ITEM === */
.tree-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 32px;
  border: 1px solid transparent;
  background: var(--bg-secondary);
}

/* Стили для корневых элементов дерева (не вложенных) */
.category-tree > .tree-item {
  background: var(--bg-secondary);
}

.category-tree > .tree-item .tree-label {
  color: var(--text-primary) !important;
}

.category-tree > .tree-item .tree-icon {
  color: var(--text-secondary) !important;
}

.tree-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
  transform: translateX(2px);
}

.tree-item.selected {
  background: var(--bg-selected);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.tree-item.drag-over {
  background: rgba(31, 111, 235, 0.3);
  border: 2px dashed var(--accent-primary);
  transform: scale(1.02);
}

.tree-item.category-dragging {
  opacity: 0.6;
  transform: rotate(1deg) scale(0.95);
  box-shadow: var(--shadow-lg);
}

.tree-item.category-drag-over {
  background: rgba(35, 134, 54, 0.3);
  border: 2px dashed var(--accent-secondary);
  transform: scale(1.02);
}

.tree-item.drag-invalid {
  background: rgba(218, 54, 51, 0.3);
  border: 2px dashed var(--danger);
  cursor: not-allowed;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.tree-expand {
  width: 20px;
  height: 20px;
  margin-right: 6px;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.tree-expand:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tree-expand i {
  transition: transform 0.2s ease;
}

.tree-expand.expanded i {
  transform: rotate(90deg);
}

.tree-icon {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  color: var(--text-secondary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.tree-item:hover .tree-icon {
  color: var(--accent-primary);
  transform: scale(1.1);
}

/* Убеждаемся, что иконки видны на всех уровнях вложенности */
.tree-children .tree-item .tree-icon {
  color: var(--text-secondary);
}

.tree-children .tree-children .tree-item .tree-icon {
  color: var(--text-secondary);
}

.tree-children .tree-children .tree-children .tree-item .tree-icon {
  color: var(--text-secondary);
}

.tree-label {
  flex: 1;
  margin-right: 8px;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  min-width: auto !important;
  font-weight: 500;
  transition: color 0.2s ease;
  color: var(--text-primary);
  word-wrap: break-word;
  line-height: 1.3;
  max-width: none !important;
  width: auto !important;
}

.tree-item:hover .tree-label {
  color: var(--text-primary);
}

/* Убеждаемся, что текст виден на всех уровнях вложенности */
.tree-children .tree-item .tree-label {
  color: var(--text-primary) !important;
}

.tree-children .tree-children .tree-item .tree-label {
  color: var(--text-primary) !important;
}

.tree-children .tree-children .tree-children .tree-item .tree-label {
  color: var(--text-primary) !important;
}

/* Общий стиль для всех элементов дерева */
.tree-item .tree-label {
  color: var(--text-primary) !important;
  font-weight: 500;
  text-shadow: none;
}

.tree-item .tree-icon {
  color: var(--text-secondary) !important;
}

/* Принудительные стили для видимости текста */
.category-tree .tree-item .tree-label,
.category-tree .tree-children .tree-item .tree-label,
.category-tree .tree-children .tree-children .tree-item .tree-label {
  color: var(--text-primary) !important;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

.tree-item.search-highlight {
  background: rgba(31, 111, 235, 0.15);
  border-color: var(--accent-primary);
}

.tree-item.search-highlight .tree-label {
  color: var(--accent-primary);
  font-weight: 600;
}

/* === QUESTION COUNT BADGE === */
.question-count {
  background: var(--accent-primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 1.2;
  flex-shrink: 0;
}

/* === IMAGE UPLOAD === */
.image-upload-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.5rem;
  background: var(--bg-tertiary);
}

.image-upload-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 1rem;
}

.tab-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}

.tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.tab-content {
  display: none;
  gap: 8px;
  align-items: center;
}

.tab-content.active {
  display: flex;
}

.tab-content input[type="file"],
.tab-content input[type="url"] {
  flex: 1;
  margin: 0;
}

.image-preview {
  margin-top: 1rem;
}

.image-preview-item {
  position: relative;
  display: inline-block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
}

.image-preview-item img {
  max-width: 200px;
  max-height: 150px;
  display: block;
}

.btn-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.btn-remove:hover {
  background: var(--danger-hover);
}

/* === IMAGE INDICATOR === */
.image-indicator {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 16px;
  opacity: 0.7;
  transition: var(--transition);
  z-index: 1;
}

.question-card:hover .image-indicator {
  opacity: 1;
  transform: scale(1.1);
}

.question-card {
  position: relative; /* Добавляем для позиционирования индикатора */
}

.ranks-table {
  width: 100%;
  border-collapse: collapse;
}
.ranks-table th, .ranks-table td {
  border-bottom: 1px solid var(--border-color);
  padding: 8px 10px;
}
.ranks-table td:last-child {
  width: 80px;
  text-align: right;
}
