/* =============================================
   TIMPRO — Final Polish CSS
   Анимации, mobile, loading states, финальные детали
   ============================================= */

/* --- Плавные переходы страниц --- */
.workspace, .admin-layout {
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --- Skeleton loading --- */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-tertiary) 0%, var(--bg-hover) 50%, var(--bg-tertiary) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-circle { border-radius: 50%; }
.skeleton-avatar { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; }

/* --- Spinner --- */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Улучшенные hover-эффекты --- */
.btn-primary:active   { transform: scale(0.97); }
.btn-secondary:active { transform: scale(0.97); }
.send-btn:active      { transform: scale(0.92) !important; }

/* --- Анимация появления диалогов --- */
.dialog-item {
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}

/* --- Анимация появления сообщений --- */
.msg-group {
  animation: msgIn 0.18s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* --- Анимация карточек задач --- */
.task-card {
  animation: cardIn 0.2s ease;
}
@keyframes cardIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* --- Улучшенный скроллбар для чата --- */
.chat-messages::-webkit-scrollbar { width: 4px; }
.dialogs-list::-webkit-scrollbar  { width: 4px; }
.kanban-col-body::-webkit-scrollbar { width: 4px; }

/* --- Status indicator (онлайн) --- */
.online-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-secondary);
  position: absolute;
  bottom: 0; right: 0;
}

/* --- Горячие клавиши бейдж --- */
.kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
  color: var(--text-muted);
}

/* --- Floating action button (мобильный) --- */
.fab {
  position: fixed;
  bottom: 80px; right: 16px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 22px;
  display: none;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(46,125,255,0.4);
  cursor: pointer;
  border: none;
  z-index: 100;
  transition: var(--transition);
}
.fab:hover { transform: scale(1.08); }
.fab:active { transform: scale(0.95); }

/* --- Tooltips улучшенные --- */
[title]:not(.nav-item):not(button) {
  position: relative;
}

/* --- Индикатор набора текста --- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 8px 14px;
}
.typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* --- Пустые состояния --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; line-height: 1; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.empty-state-sub { font-size: 13px; max-width: 240px; line-height: 1.5; }
/* Фирменные иллюстрации пустых состояний (WebP с прозрачностью, ~20 КБ).
   Лёгкое «парение» — только transform (GPU), в reduced-motion отключается. */
.empty-state-img {
  width: 116px; height: auto;
  filter: drop-shadow(0 14px 24px rgba(124, 77, 255, .18));
  animation: es-float 4.5s ease-in-out infinite alternate;
  user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.notif-empty .empty-state-img { width: 88px; }
@keyframes es-float { from { transform: translateY(0) } to { transform: translateY(-8px) } }
@media (prefers-reduced-motion: reduce) { .empty-state-img { animation: none } }

/* =============================================
   MOBILE RESPONSIVE (< 768px)
   ============================================= */

/* (старая мобильная адаптация удалена — единый слой в responsive.css) */

@media (max-width: 480px) {
  .boards-grid { grid-template-columns: 1fr !important; }
  .kanban-view { padding: 10px 8px; gap: 10px; }
  .kanban-col { width: 260px; min-width: 260px; }
  .login-card { padding: 24px 16px !important; }
}

/* =============================================
   УЛУЧШЕНИЯ ИНТЕРФЕЙСА
   ============================================= */

/* Кнопка "наверх" в чате */
.chat-area { position: relative; }
.scroll-to-bottom {
  position: absolute;
  bottom: 96px;          /* JS уточняет под высоту поля ввода */
  right: 18px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(15,23,42,.16);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(8px) scale(.9);
  transition: opacity .2s var(--ease,ease), transform .2s var(--ease,ease), background .2s, color .2s, visibility .2s;
  z-index: 40;
}
.scroll-to-bottom svg { width: 20px; height: 20px; }
.scroll-to-bottom:hover { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(46,125,255,.35); }
.scroll-to-bottom.show { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }

/* Разделитель "непрочитанные сообщения" */
.unread-divider {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin: 12px 0;
  position: relative;
}
.unread-divider::before, .unread-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 60px);
  height: 1px;
  background: var(--accent);
  opacity: 0.3;
}
.unread-divider::before { left: 0; }
.unread-divider::after  { right: 0; }

/* Закреплённое сообщение */
.pinned-msg {
  padding: 8px 14px;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 8px;
}
.pinned-msg.show { display: flex; }

/* --- Улучшение кнопок тулбара --- */
.toolbar-btn {
  border-radius: var(--radius-sm) !important;
  font-size: 12px !important;
}

/* --- Cmd+K подсказка --- */
.cmdK-hint {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-muted);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 200;
}
.cmdK-hint.show { opacity: 1; }

/* --- Improved focus states --- */
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Print styles --- */
@media print {
  .nav-sidebar, .dialogs-panel, .chat-input-area, .milash-bar { display: none !important; }
  .chat-messages { overflow: visible !important; height: auto !important; }
  .msg-bubble { break-inside: avoid; }
}
