/* ==========================================
   КОМПОНЕНТЫ
   ========================================== */

/* Buttons */
.btn {
  align-items: center;
  border: none;
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 600;
  gap: var(--space-sm);
  justify-content: center;
  padding: 10px 20px;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: #d9ff33; }
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-accent); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--error); color: #fff; }
.btn-sm { font-size: 0.75rem; padding: 6px 12px; }
.btn-lg { font-size: 1rem; padding: 14px 28px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}
.card-hover:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 1px var(--border-accent);
  transition: all var(--transition);
}

/* Badges */
.badge {
  border-radius: 100px;
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 10px;
}
.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-secondary { background: rgba(255, 77, 0, 0.15); color: var(--secondary); }
.badge-success { background: rgba(0, 214, 143, 0.15); color: var(--success); }
.badge-warning { background: rgba(255, 170, 0, 0.15); color: var(--warning); }
.badge-muted { background: var(--bg-hover); color: var(--text-muted); }

/* Form group */
.form-group { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-md); }
.form-label { color: var(--text-secondary); font-size: 0.8rem; font-weight: 500; }
.form-error { color: var(--error); font-size: 0.8rem; }

/* Tabs */
.tabs { display: flex; gap: 2px; background: var(--bg-secondary); border-radius: var(--radius-sm); padding: 3px; }
.tab {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 16px;
}
.tab.active { background: var(--bg-card); color: var(--text-primary); }
.tab:hover:not(.active) { color: var(--text-secondary); }

/* Modal */
.modal-overlay {
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  opacity: 0;
  position: fixed;
  right: 0;
  top: 0;
  transition: opacity var(--transition);
  z-index: 100;
  pointer-events: none;
}
.modal-overlay.visible { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-height: 90vh;
  max-width: 560px;
  overflow-y: auto;
  padding: var(--space-xl);
  position: relative;
  transform: translateY(8px);
  transition: transform var(--transition);
  width: 100%;
}
.modal-overlay.visible .modal { transform: translateY(0); }
.modal-header { align-items: center; display: flex; justify-content: space-between; margin-bottom: var(--space-lg); }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }

/* Toast */
.toast-container {
  bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  position: fixed;
  right: var(--space-lg);
  z-index: 200;
}
.toast {
  align-items: center;
  animation: slideIn 200ms ease;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-md);
  max-width: 360px;
  padding: var(--space-md) var(--space-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--accent); }

/* Progress bar */
.progress { background: var(--bg-hover); border-radius: 100px; height: 4px; overflow: hidden; }
.progress-bar { background: var(--accent); border-radius: 100px; height: 100%; transition: width 600ms ease; }

/* Avatar */
.avatar {
  align-items: center;
  background: var(--bg-hover);
  border-radius: 50%;
  display: flex;
  font-weight: 700;
  justify-content: center;
  overflow: hidden;
  text-transform: uppercase;
}
.avatar img { height: 100%; object-fit: cover; width: 100%; }

/* Typing indicator */
.typing-dots { display: flex; gap: 4px; align-items: center; }
.typing-dots span {
  animation: blink 1.4s infinite;
  background: var(--text-muted);
  border-radius: 50%;
  height: 6px;
  width: 6px;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

.fade-up { animation: fadeUp 400ms ease forwards; }
