/* Avatar improvements - ensure letters are properly centered */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.avatar > div {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 600;
  user-select: none;
}

/* Better avatar sizes */
.avatar-xs > div { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.avatar-sm > div { width: 2rem;   height: 2rem;   font-size: 0.75rem;  }
.avatar-md > div { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }

/* Task card improvements */
.card { transition: transform .2s ease, box-shadow .2s ease; }
[data-task-card].drag-enabled { cursor: move; }
[data-task-card]:hover { transform: translateY(-2px); }

/* Loading states */
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-indicator { display: none; opacity: 0; transition: opacity .15s ease; }
html.htmx-request .htmx-indicator { opacity: 1; }

/* Better modal backdrop */
.modal-backdrop {
  background-color: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

/* Accessibility improvements */
[aria-label]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Better form validation states */
.input-error { border-color: #f87171; }
.label-text-alt.text-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Toast notifications */
.toast { z-index: 9999; animation: slide-in .3s ease-out; }
@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* Better badge contrast */
.badge { font-weight: 500; }

/* Shared compact tag style. Color modifiers may vary; shape, border, and type stay fixed. */
.eg-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 1.25rem;
  max-width: 12rem;
  padding: 0 0.5rem;
  border: 1px solid;
  border-radius: 9999px;
  font-size: 0.625rem;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: middle;
}

.eg-tag-dot {
  width: 0.375rem;
  height: 0.375rem;
  flex: 0 0 auto;
  border-radius: 9999px;
  background: currentColor;
}

.eg-tag-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eg-tag-neutral {
  color: rgb(203 213 225);
  background: rgb(30 41 59 / 0.35);
  border-color: rgb(203 213 225 / 0.45);
}

.eg-tag-primary {
  color: rgb(129 140 248);
  background: rgb(129 140 248 / 0.12);
  border-color: rgb(129 140 248 / 0.55);
}

.eg-tag-info {
  color: rgb(56 189 248);
  background: rgb(56 189 248 / 0.12);
  border-color: rgb(56 189 248 / 0.55);
}

.eg-tag-success {
  color: rgb(16 185 129);
  background: rgb(16 185 129 / 0.12);
  border-color: rgb(16 185 129 / 0.55);
}

.eg-tag-warning {
  color: rgb(250 204 21);
  background: rgb(250 204 21 / 0.12);
  border-color: rgb(250 204 21 / 0.55);
}

.eg-tag-error {
  color: rgb(248 113 113);
  background: rgb(248 113 113 / 0.12);
  border-color: rgb(248 113 113 / 0.55);
}

/* Project create/edit controls */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: eg-fade-in 0.3s ease-in-out;
}

@keyframes eg-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.member-search-results {
  max-height: 300px;
  overflow-y: auto;
}

.link-item {
  transition: all 0.2s ease;
}

.link-item.removing {
  opacity: 0;
  transform: translateX(-20px);
}

.quick-link-btn {
  transition: all 0.2s ease;
}

.quick-link-btn.active {
  background-color: var(--fallback-p, oklch(var(--p)));
  color: var(--fallback-pc, oklch(var(--pc)));
}

.field-valid {
  border-color: var(--fallback-su, oklch(var(--su)));
}

.field-invalid {
  border-color: var(--fallback-er, oklch(var(--er)));
}

.member-avatar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Task edit modal controls */
#task-edit-modal-backdrop input:not([type="checkbox"]):not([type="radio"]),
#task-edit-modal-backdrop textarea {
  background-color: hsl(var(--b2)) !important;
  color: hsl(var(--nc)) !important;
}

#task-edit-modal-backdrop input:not([type="checkbox"]):not([type="radio"]):focus,
#task-edit-modal-backdrop textarea:focus {
  background-color: hsl(var(--b2)) !important;
  color: hsl(var(--nc)) !important;
}

#task-edit-modal-backdrop select,
#task-edit-modal-backdrop .form-control select {
  background-color: #1d232a !important;
  color: #e5e7eb !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color-scheme: dark;
}

#task-edit-modal-backdrop select:focus,
#task-edit-modal-backdrop .form-control select:focus {
  background-color: #1d232a !important;
  color: #e5e7eb !important;
}

#task-edit-modal-backdrop select option {
  background-color: #1d232a !important;
  color: #e5e7eb !important;
}

#task-edit-modal-backdrop .form-control {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  padding: 0.4rem 0.75rem 0.6rem;
  margin-top: 0.25rem;
}

#task-edit-modal-backdrop .form-control .label {
  padding-left: 0;
  padding-right: 0;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Responsive improvements */
@media (max-width: 640px) {
  [data-task-card].drag-enabled { cursor: default; }

  /* Mobile touch ergonomics without changing desktop density */
  .btn { min-height: 2.5rem; }
  .btn.btn-xs { min-height: 2.25rem; }
  .select, .input, .textarea { min-height: 2.5rem; }

  .mobile-stack { display: flex; flex-direction: column; gap: .5rem; }
  .mobile-stack > * { width: 100%; }

  /* Keep task filter trigger readable and thumb-friendly on smaller screens */
  #filters-toggle { min-height: 2.5rem; gap: .4rem; }
  #filters-toggle [data-active-filter-count] { min-width: 1.25rem; }
}
