/* ═══════════════════════════════════════════════════════════
   ECLYSS WEB — COMPONENTS
   ═══════════════════════════════════════════════════════════ */

/* ── Button ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  border: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--primary {
  background: var(--gradient-h);
  color: white;
  box-shadow: var(--shadow-purple);
}
.btn--primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn--primary:active { filter: brightness(0.95); transform: translateY(0); }

.btn--secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn--secondary:hover { background: var(--bg-elevated); border-color: var(--border-medium); }

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn--ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn--danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn--danger:hover { background: rgba(239,68,68,0.18); }

.btn--icon {
  padding: 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
}
.btn--icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn--icon:active { background: var(--bg-active); color: var(--accent-glow); }

.btn--icon-lg {
  width: 44px;
  height: 44px;
  font-size: var(--text-lg);
}

.btn--full { width: 100%; }
.btn--sm   { padding: 8px 14px; font-size: var(--text-sm); border-radius: var(--radius-md); }
.btn--lg   { padding: 15px 28px; font-size: var(--text-lg); border-radius: var(--radius-xl); }

/* Spinner em botão */
.btn.loading .btn__label { opacity: 0; }
.btn.loading::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Input ───────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.field__wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  overflow: hidden;
}

.field__wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

.field__wrap--error {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.10) !important;
}

.field__input {
  flex: 1;
  padding: 12px 14px;
  font-size: var(--text-md);
  color: var(--text-primary);
  background: transparent;
  outline: none;
  caret-color: var(--accent-glow);
}

.field__input::placeholder { color: var(--text-tertiary); }

.field__icon {
  padding: 0 12px 0 14px;
  color: var(--text-tertiary);
  font-size: 16px;
  display: flex;
  align-items: center;
}

.field__right {
  padding: 0 14px;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}
.field__right:hover { color: var(--text-primary); }

.field__error {
  font-size: var(--text-xs);
  color: var(--error);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field__hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Textarea variant */
.field__input--area {
  resize: none;
  min-height: 80px;
  padding: 12px 14px;
  line-height: 1.5;
}

/* ── Avatar ──────────────────────────────────────────────── */
.avatar {
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-secondary);
  position: relative;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm  { width: var(--avatar-sm);  height: var(--avatar-sm);  font-size: 13px; }
.avatar--md  { width: var(--avatar-md);  height: var(--avatar-md);  font-size: 15px; }
.avatar--lg  { width: var(--avatar-lg);  height: var(--avatar-lg);  font-size: 18px; }
.avatar--xl  { width: var(--avatar-xl);  height: var(--avatar-xl);  font-size: 26px; }

.avatar--group {
  border-radius: var(--radius-lg);
}

/* Online indicator */
.avatar__status {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}
.avatar__status--online  { background: var(--success); }
.avatar__status--offline { background: var(--text-tertiary); }

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  background: var(--accent);
  color: white;
  line-height: 1;
}
.badge--muted { background: var(--bg-tertiary); color: var(--text-tertiary); }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-subtle);
  width: 100%;
}

.divider--text {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}
.divider--text::before,
.divider--text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Toast ───────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--sp-xl);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: all;
  animation: toastIn 0.25s ease both;
  max-width: 360px;
  backdrop-filter: blur(12px);
}

.toast--success { border-color: rgba(16,185,129,0.3); }
.toast--error   { border-color: rgba(239,68,68,0.3); }
.toast--warning { border-color: rgba(245,158,11,0.3); }
.toast.removing { animation: toastOut 0.2s ease both; }

.toast__icon { font-size: 16px; flex-shrink: 0; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--sp-xl);
  width: min(480px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
  animation: scaleInSpring 0.3s ease;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
}

.modal__title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.3px;
}

.modal__body { margin-bottom: var(--sp-lg); }

.modal__footer {
  display: flex;
  gap: var(--sp-sm);
  justify-content: flex-end;
}

/* ── Context menu ────────────────────────────────────────── */
.context-menu {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-xs);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-tooltip);
  animation: scaleIn 0.15s ease;
}

.context-menu__item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.context-menu__item:hover { background: var(--bg-hover); }
.context-menu__item--danger { color: var(--error); }
.context-menu__item--danger:hover { background: var(--error-bg); }
.context-menu__icon { font-size: 14px; width: 20px; text-align: center; }
.context-menu__sep { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* ── Tooltip ─────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Skeleton loader ─────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-elevated) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Typing indicator ────────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 10px 14px;
}
.typing-indicator span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: typingBounce 1.2s ease infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
