/* ═══════════════════════════════════════════════
   mini task ai — Reusable Components
   ═══════════════════════════════════════════════ */

/* ══════════════ BUTTONS ══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: var(--text-sm);
  line-height: 1.4;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--duration-base) var(--ease-smooth);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Ripple Effect */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--glow-soft);
}
.btn-primary:hover {
  box-shadow: var(--glow-purple);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Danger */
.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}
.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.2);
}

/* Icon Only */
.btn-icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
}

/* Sizes */
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-md); }

/* ══════════════ BADGES ══════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
}

.badge-purple {
  background: rgba(124, 58, 237, 0.2);
  color: var(--purple-300);
}
.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}
.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}
.badge-rose {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}
.badge-cyan {
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent-cyan);
}

/* Notification Badge */
.badge-count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent-rose);
  color: white;
  font-size: 10px;
  font-weight: 700;
}

/* ══════════════ CHIPS / TAGS ══════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
}
.chip:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}
.chip-active {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--accent-violet);
  color: var(--purple-200);
}
.chip .chip-remove {
  font-size: 10px;
  opacity: 0.6;
  cursor: pointer;
  margin-left: 2px;
}
.chip .chip-remove:hover { opacity: 1; }

/* ══════════════ INPUTS ══════════════ */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-group .input-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-lg);
  pointer-events: none;
}
.input-group input {
  padding-left: var(--space-10);
  width: 100%;
}

.input-field {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: all var(--duration-fast) var(--ease-smooth);
}
.input-field:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
  background: var(--bg-surface);
}

/* ══════════════ CHECKBOX ══════════════ */
.checkbox-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.checkbox-wrapper input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-pill); /* Makes it a circle */
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-base) var(--ease-spring);
  flex-shrink: 0;
}
.checkbox-wrapper:hover .checkbox-custom {
  border-color: var(--accent-violet);
}
.checkbox-wrapper input:checked + .checkbox-custom {
  background: var(--gradient-primary);
  border-color: transparent;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.5);
  transform: scale(1.05); /* Springy pop */
}
.checkbox-custom svg {
  width: 12px;
  height: 12px;
  stroke: white;
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
}
.checkbox-wrapper input:checked + .checkbox-custom svg {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s var(--ease-smooth) 0.1s;
}

/* ══════════════ TOGGLE ══════════════ */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  transition: all var(--duration-base) var(--ease-smooth);
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--duration-base) var(--ease-spring);
}
.toggle input:checked ~ .toggle-track {
  background: var(--purple-600);
  border-color: var(--purple-500);
}
.toggle input:checked ~ .toggle-thumb {
  transform: translateX(20px);
  background: white;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.5);
}

/* ══════════════ CARDS ══════════════ */
.card {
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: all var(--duration-base) var(--ease-smooth);
}
.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-elevated);
  transform: translateY(-2px);
}
.card-glass {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(26, 19, 54, 0.75);
}

/* ══════════════ AVATAR ══════════════ */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  border: 2px solid var(--border-subtle);
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: var(--text-md); }
.avatar-group {
  display: flex;
}
.avatar-group .avatar { margin-left: -8px; }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ══════════════ DROPDOWN ══════════════ */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  box-shadow: var(--shadow-elevated);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--duration-fast) var(--ease-smooth);
}
.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  white-space: nowrap;
}
.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-1) 0;
}

/* ══════════════ TOOLTIPS ══════════════ */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--duration-fast) var(--ease-smooth);
  z-index: 9990;
}
.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════ PROGRESS BAR ══════════════ */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-pill);
  transition: width var(--duration-slow) var(--ease-smooth);
  position: relative;
}
.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: shimmer 2s infinite;
  background-size: 200% 100%;
}

/* ══════════════ TABS ══════════════ */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0;
}
.tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color var(--duration-fast) var(--ease-smooth);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-secondary); }
.tab.active {
  color: var(--accent-violet);
  border-bottom-color: var(--accent-violet);
}

/* ══════════════ EMPTY STATE ══════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  animation: fadeIn var(--duration-slow) var(--ease-spring);
}
.empty-state-icon {
  font-size: 56px;
  margin-bottom: var(--space-5);
  opacity: 0.7;
  color: var(--text-muted);
  background: var(--bg-hover);
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}
.empty-state h3 {
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.empty-state p {
  color: var(--text-secondary);
  max-width: 360px;
}

/* ══════════════ SKELETON ══════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton-avatar { width: 32px; height: 32px; border-radius: 50%; }

/* ══════════════ TOAST NOTIFICATIONS ══════════════ */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(20px);
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  animation: slideInRight var(--duration-enter) var(--ease-spring) both;
  position: relative;
  overflow: hidden;
}
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.toast-message {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}
.toast-close {
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-lg);
  transition: color var(--duration-fast) var(--ease-smooth);
}
.toast-close:hover { color: var(--text-primary); }
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 0 0 0 var(--radius-md);
  animation: toast-timer linear forwards;
}
@keyframes toast-timer {
  from { width: 100%; }
  to   { width: 0; }
}

.toast-success { border-left: 3px solid var(--accent-emerald); }
.toast-error   { border-left: 3px solid var(--accent-rose); }
.toast-warning { border-left: 3px solid var(--accent-amber); }
.toast-info    { border-left: 3px solid var(--accent-indigo); }
.toast-ai      { border-left: 3px solid var(--accent-violet); border-image: var(--gradient-primary) 1; }

/* ══════════════ MODAL ══════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 15, 0.7);
  backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-base) var(--ease-smooth);
}
.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elevated);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform var(--duration-base) var(--ease-spring);
}
.modal-backdrop.open .modal {
  transform: scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.modal-header h3 { font-size: var(--text-lg); }
.modal-body {
  padding: var(--space-5);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

/* ══════════════ COMMAND PALETTE ══════════════ */
.command-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 15, 0.6);
  backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-fast) var(--ease-smooth);
}
.command-palette-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.command-palette {
  width: 90%;
  max-width: 640px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated), var(--glow-purple);
  overflow: hidden;
  transform: translateY(-12px) scale(0.98);
  transition: transform var(--duration-base) var(--ease-spring);
}
.command-palette-backdrop.open .command-palette {
  transform: translateY(0) scale(1);
}
.command-palette-input {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.command-palette-input input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: var(--text-lg);
  color: var(--text-primary);
  outline: none;
}
.command-palette-input input::placeholder { color: var(--text-muted); }
.command-palette-results {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--space-2);
}
.command-palette-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-smooth);
}
.command-palette-item:hover,
.command-palette-item.selected {
  background: var(--bg-hover);
}
.command-palette-item-icon {
  width: 28px;
  text-align: center;
  font-size: var(--text-lg);
  flex-shrink: 0;
}
.command-palette-item-title {
  font-size: var(--text-sm);
  font-weight: 500;
}
.command-palette-item-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.command-palette-item-shortcut {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  gap: 4px;
}
.command-palette-item-shortcut kbd {
  background: var(--bg-elevated);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
}
.command-palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ══════════════ CONTEXT MENU ══════════════ */
.context-menu {
  position: fixed;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  box-shadow: var(--shadow-elevated);
  z-index: 8000;
  min-width: 180px;
  animation: scaleIn var(--duration-fast) var(--ease-spring);
}

/* ══════════════ PRIORITY INDICATORS ══════════════ */
.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.priority-critical { background: var(--priority-critical); box-shadow: 0 0 6px var(--priority-critical); }
.priority-high     { background: var(--priority-high); }
.priority-medium   { background: var(--priority-medium); }
.priority-low      { background: var(--priority-low); }
.priority-none     { background: var(--text-disabled); }

/* ══════════════ STATUS INDICATORS ══════════════ */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-backlog    { background: var(--status-backlog); }
.status-todo       { background: var(--status-todo); }
.status-progress   { background: var(--status-progress); animation: pulse-dot 2s infinite; }
.status-review     { background: var(--status-review); }
.status-done       { background: var(--status-done); }
.status-cancelled  { background: var(--status-cancelled); }
.status-hold       { background: var(--status-hold); }

/* ══════════════ SPARKLINE ══════════════ */
.sparkline {
  width: 80px;
  height: 24px;
}
.sparkline path {
  fill: none;
  stroke: var(--accent-violet);
  stroke-width: 1.5;
}
.sparkline .sparkline-area {
  fill: url(#sparkline-grad);
  stroke: none;
}

/* ══════════════ GLOBAL ICONS ══════════════ */
.app-icon {
  display: inline-block;
  vertical-align: middle;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.toast-icon .app-icon { width: 24px; height: 24px; }
.toast-success .app-icon { color: var(--accent-emerald); }
.toast-error .app-icon { color: var(--accent-rose); }
.toast-warning .app-icon { color: var(--accent-amber); }
.toast-info .app-icon, .toast-ai .app-icon { color: var(--accent-indigo); }

.nav-icon .app-icon { width: 22px; height: 22px; color: var(--text-muted); }
.nav-item.active .nav-icon .app-icon, .nav-item:hover .nav-icon .app-icon { color: var(--accent-violet); }

.filter-item span:first-child .app-icon { width: 16px; height: 16px; margin-inline-end: 8px; color: var(--text-muted); }
.filter-item:hover span:first-child .app-icon { color: var(--accent-violet); }

.lang-icon .app-icon { width: 18px; height: 18px; color: var(--text-primary); }

.ai-action-btn span .app-icon { width: 16px; height: 16px; margin-inline-end: 6px; }

/* Remove emojis spacing weirdness */
.nav-icon { display: flex; align-items: center; justify-content: center; }

/* ══════════════ USER DROPDOWN ══════════════ */
.user-dropdown {
  position: fixed;
  top: calc(var(--header-height) - 4px);
  right: var(--space-4);
  min-width: 220px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  z-index: 6000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--duration-base) var(--ease-spring);
}
.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

[dir="rtl"] .user-dropdown {
  right: auto;
  left: var(--space-4);
}

/* ══════════════ LANG TOGGLE ══════════════ */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
}
.lang-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}

