/**
 * Styles pour le système d'icônes SVG de Taskora
 * Design cohérent et responsive
 */

/* Classe de base pour toutes les icônes */
.icon {
  display: inline-block;
  vertical-align: middle;
  width: 1.25em;
  height: 1.25em;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

/* Tailles d'icônes */
.icon-xs {
  width: 0.875em;
  height: 0.875em;
}

.icon-sm {
  width: 1em;
  height: 1em;
}

.icon-md {
  width: 1.25em;
  height: 1.25em;
}

.icon-lg {
  width: 1.5em;
  height: 1.5em;
}

.icon-xl {
  width: 2em;
  height: 2em;
}

.icon-2xl {
  width: 2.5em;
  height: 2.5em;
}

/* Icônes avec remplissage (pour certaines icônes spéciales) */
.icon-filled {
  fill: currentColor;
  stroke: none;
}

/* Icônes animées */
.icon-spin {
  animation: icon-spin 1s linear infinite;
}

@keyframes icon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.icon-pulse {
  animation: icon-pulse 2s ease-in-out infinite;
}

@keyframes icon-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Icônes dans les boutons */
button .icon,
a.button .icon {
  margin-right: 0.5em;
}

button .icon:only-child,
a.button .icon:only-child {
  margin-right: 0;
}

/* Icônes dans les inputs */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .icon {
  position: absolute;
  left: 1rem;
  pointer-events: none;
  color: var(--text-tertiary, #9ca3af);
  z-index: 1;
}

.input-with-icon input {
  padding-left: 2.75rem;
}

/* Icônes de couleurs contextuelles */
.icon-primary {
  color: var(--primary-color, #3b82f6);
}

.icon-success {
  color: var(--success-color, #10b981);
}

.icon-warning {
  color: var(--warning-color, #f59e0b);
}

.icon-danger {
  color: var(--danger-color, #ef4444);
}

.icon-info {
  color: var(--info-color, #3b82f6);
}

.icon-muted {
  color: var(--text-tertiary, #9ca3af);
}

/* Icônes interactives */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  color: var(--text-secondary, #6b7280);
}

.icon-button:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.05));
  color: var(--text-primary, #1f2937);
}

.icon-button:active {
  transform: scale(0.95);
}

.icon-button.active {
  background: var(--primary-color, #3b82f6);
  color: white;
}

/* Thème clair */
body.light-theme .icon {
  stroke: currentColor;
}

body.light-theme .input-with-icon .icon {
  color: #9ca3af;
}

body.light-theme .icon-button {
  color: #6b7280;
}

body.light-theme .icon-button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1f2937;
}

/* Thème sombre */
body:not(.light-theme) .icon {
  stroke: currentColor;
}

body:not(.light-theme) .input-with-icon .icon {
  color: #6b7280;
}

body:not(.light-theme) .icon-button {
  color: #9ca3af;
}

body:not(.light-theme) .icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}

/* Icônes dans les badges de statut */
.status-badge .icon {
  width: 1em;
  height: 1em;
  margin-right: 0.375rem;
}

/* Icônes dans les notifications */
.toast .icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  margin-right: 0.75rem;
}

.toast.success .icon {
  color: #10b981;
}

.toast.error .icon {
  color: #ef4444;
}

.toast.warning .icon {
  color: #f59e0b;
}

.toast.info .icon {
  color: #3b82f6;
}

/* Icônes dans les menus */
.menu-item .icon {
  width: 1.125em;
  height: 1.125em;
  margin-right: 0.75rem;
}

/* Icônes dans les cartes de tâches */
.task-card .icon {
  width: 1em;
  height: 1em;
}

.task-card .priority-icon {
  margin-right: 0.5rem;
}

/* Icônes dans les en-têtes */
.section-header .icon {
  margin-right: 0.625rem;
}

/* Groupes d'icônes */
.icon-group {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-group .icon {
  margin: 0;
}

/* Icônes avec badges de notification */
.icon-badge {
  position: relative;
  display: inline-flex;
}

.icon-badge::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0.5em;
  height: 0.5em;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--bg-primary, white);
}

.icon-badge.has-count::after {
  content: attr(data-count);
  width: auto;
  height: auto;
  min-width: 1.125em;
  padding: 0.125em 0.375em;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.625rem;
}

/* Icônes désactivées */
.icon-button:disabled .icon,
button:disabled .icon {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Icônes dans les listes */
ul.icon-list {
  list-style: none;
  padding-left: 0;
}

ul.icon-list li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

ul.icon-list li .icon {
  margin-right: 0.75rem;
  margin-top: 0.125rem;
}

/* États de chargement */
.icon-loading {
  opacity: 0.6;
  animation: icon-pulse 1.5s ease-in-out infinite;
}

/* Transitions douces */
.icon {
  transition: color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

/* Responsive - tailles sur mobile */
@media (max-width: 640px) {
  .icon-xl {
    width: 1.75em;
    height: 1.75em;
  }

  .icon-2xl {
    width: 2em;
    height: 2em;
  }
}

/* Alignement vertical précis pour différents contextes */
.icon-text-align {
  vertical-align: -0.125em;
}

/* Icônes avec ombre portée (pour les modales et overlays) */
.icon-shadow {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Support pour les icônes en ligne dans le texte */
p .icon,
span .icon,
h1 .icon,
h2 .icon,
h3 .icon,
h4 .icon,
h5 .icon,
h6 .icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}

/* Icônes dans les tooltips */
[data-tooltip] .icon {
  cursor: help;
}

/* Accessibilité - focus visible */
.icon-button:focus-visible {
  outline: 2px solid var(--primary-color, #3b82f6);
  outline-offset: 2px;
}

/* Icônes de groupe dans les filtres */
.group-icon {
  width: 1.125em;
  height: 1.125em;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Icônes de priorité avec couleurs */
.priority-icon {
  width: 1.125em;
  height: 1.125em;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.priority-icon.priority-urgent {
  color: #ef4444;
  stroke: #ef4444;
}

.priority-icon.priority-high {
  color: #f59e0b;
  stroke: #f59e0b;
}

.priority-icon.priority-medium {
  color: #eab308;
  stroke: #eab308;
}

.priority-icon.priority-low {
  color: #10b981;
  stroke: #10b981;
}

/* Icônes de statut avec couleurs */
.status-done {
  color: #10b981;
  stroke: #10b981;
}

.status-in-progress {
  color: #3b82f6;
  stroke: #3b82f6;
}

.status-todo {
  color: #94a3b8;
  stroke: #94a3b8;
}

/* Print styles */
@media print {
  .icon {
    stroke: black;
  }

  .icon-button {
    display: none;
  }
}
