/**
 * MS Revendications - Styles front-end
 * Version: 1.0.0
 */

/* Variables CSS personnalisées */
:root {
  /* Couleurs principales */
  --primary: #4F46E5;
  --primary-hover: #1c13b2;
  --primary-light: #ffffff;
  --primary-dark: #020098;

  /* Couleurs secondaires */
  --secondary: #10B981;
  --secondary-hover: #00864e;
  --secondary-light: #f5ffff;

  /* Accent */
  --accent: #F59E0B;
  --accent-hover: #c26b00;

  /* Neutres */
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Statuts */
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* Variables spécifiques revendications */
  --rev-gap: 1.5rem;
  --rev-radius: 8px;
  --rev-radius-lg: 12px;
  --rev-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --rev-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --rev-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --rev-green: #10B981;
  --rev-orange: #F59E0B;
  --rev-bg: #ffffff;
  --rev-fg: #111827;
  --rev-muted: #6B7280;
  --rev-focus: #4F46E5;
  --transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
  :root {
    --rev-bg: #1F2937;
    --rev-fg: #F9FAFB;
    --rev-muted: #9CA3AF;
    --gray-50: #111827;
    --gray-100: #1F2937;
    --gray-200: #374151;
    --gray-300: #4B5563;
  }
}

/* Reset et base */
.rev-dashboard {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--rev-fg);
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.rev-dashboard * {
  box-sizing: border-box;
}

/* Toolbar */
.rev-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: var(--rev-radius);
}

.rev-search {
  flex: 1;
  min-width: 250px;
}

.rev-search__input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--rev-radius);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--rev-bg);
  color: var(--rev-fg);
}

.rev-search__input:focus {
  outline: none;
  border-color: var(--rev-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.rev-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.rev-filter {
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--rev-radius);
  font-size: 0.95rem;
  transition: var(--transition);
  background: var(--rev-bg);
  color: var(--rev-fg);
  cursor: pointer;
}

.rev-filter:focus {
  outline: none;
  border-color: var(--rev-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Layout Board */
.rev-board {
  display: grid;
  grid-template-columns: repeat(var(--columns, 2), 1fr);
  gap: var(--rev-gap);
}

.rev-board__column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rev-board__header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--rev-bg);
  border-radius: var(--rev-radius);
  box-shadow: var(--rev-shadow);
  margin-bottom: 0.5rem;
}

.rev-board__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--rev-fg);
}

.rev-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.75rem;
  background: var(--primary);
  color: white;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
}

.rev-board__content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Layout Masonry */
.rev-masonry {
  display: grid;
  grid-template-columns: repeat(var(--columns, 2), 1fr);
  gap: var(--rev-gap);
}

/* Layout Timeline */
.rev-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

/* Cartes */
.rev-card {
  position: relative;
  padding: 1.5rem;
  background: var(--rev-bg);
  border-radius: var(--rev-radius-lg);
  box-shadow: var(--rev-shadow);
  transition: var(--transition);
  cursor: pointer;
  border-left: 4px solid transparent;
  animation: revCardAppear 150ms ease-out;
}

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

.rev-card:hover {
  box-shadow: var(--rev-shadow-lg);
  transform: translateY(-2px);
}

.rev-card:focus {
  outline: 2px solid var(--rev-focus);
  outline-offset: 2px;
}

.rev-card--done {
  border-left-color: var(--rev-green);
}

.rev-card--progress {
  border-left-color: var(--rev-orange);
}

.rev-card--priority-critique {
  border-left-color: var(--danger);
}

.rev-card--priority-haute {
  border-left-color: var(--warning);
}

.rev-card--blocking {
  background: linear-gradient(135deg, var(--rev-bg) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.rev-card__title {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--rev-fg);
  line-height: 1.4;
}

.rev-card__title a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

.rev-card__title a:hover {
  color: var(--primary);
}

.rev-card__progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rev-card__bar {
  flex: 1;
  height: 8px;
  background: var(--gray-200);
  border-radius: 9999px;
  overflow: hidden;
}

.rev-card__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rev-green) 0%, var(--secondary) 100%);
  transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 9999px;
}

.rev-card--progress .rev-card__bar-fill {
  background: linear-gradient(90deg, var(--rev-orange) 0%, var(--accent) 100%);
}

.rev-card__percent {
  min-width: 3rem;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rev-muted);
}

.rev-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.rev-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: var(--gray-100);
  border-radius: var(--rev-radius);
  font-size: 0.875rem;
  color: var(--rev-muted);
  transition: var(--transition);
}

.rev-chip:hover {
  background: var(--gray-200);
}

.rev-chip__icon {
  font-size: 1rem;
  line-height: 1;
}

.rev-chip__text {
  line-height: 1;
}

.rev-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.rev-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--rev-radius);
  line-height: 1.4;
}

.rev-badge--priority {
  background: var(--gray-200);
  color: var(--rev-fg);
}

.rev-badge--basse {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.rev-badge--normale {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
}

.rev-badge--haute {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.rev-badge--critique {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.rev-badge--blocking {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  font-weight: 600;
}

.rev-badge--status {
  font-weight: 600;
}

.rev-badge--obtenue {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.rev-badge--en_cours {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.rev-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.rev-tag {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: var(--gray-100);
  color: var(--rev-muted);
  border-radius: var(--rev-radius);
  font-size: 0.8125rem;
  transition: var(--transition);
}

.rev-tag:hover {
  background: var(--gray-200);
}

/* État vide */
.rev-empty {
  grid-column: 1 / -1;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--rev-muted);
  background: var(--gray-50);
  border-radius: var(--rev-radius-lg);
}

.rev-empty p {
  margin: 0;
  font-size: 1.125rem;
}

/* Bouton charger plus */
.rev-load-more {
  margin-top: 2rem;
  text-align: center;
}

.rev-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--rev-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.rev-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--rev-shadow-md);
}

.rev-btn:focus {
  outline: 2px solid var(--rev-focus);
  outline-offset: 2px;
}

.rev-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Skeleton loading */
.rev-card--loading {
  pointer-events: none;
}

.rev-skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: revSkeleton 1.5s infinite;
  border-radius: var(--rev-radius);
}

@keyframes revSkeleton {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.rev-skeleton--title {
  height: 1.5rem;
  width: 80%;
  margin-bottom: 1rem;
}

.rev-skeleton--bar {
  height: 8px;
  width: 100%;
  margin-bottom: 1rem;
}

.rev-skeleton--chip {
  height: 2rem;
  width: 6rem;
  display: inline-block;
  margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .rev-board,
  .rev-masonry {
    grid-template-columns: 1fr;
  }
  
  .rev-toolbar {
    flex-direction: column;
  }
  
  .rev-search {
    min-width: 100%;
  }
}

@media (max-width: 640px) {
  .rev-dashboard {
    padding: 1rem 0.5rem;
  }
  
  .rev-card {
    padding: 1rem;
  }
  
  .rev-filters {
    flex-direction: column;
  }
  
  .rev-filter {
    width: 100%;
  }
}

/* Impression */
@media print {
  .rev-toolbar {
    display: none;
  }
  
  .rev-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--gray-300);
  }
  
  .rev-card:hover {
    transform: none;
  }
  
  .rev-load-more {
    display: none;
  }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible pour navigation clavier */
.rev-card:focus-visible,
.rev-search__input:focus-visible,
.rev-filter:focus-visible,
.rev-btn:focus-visible {
  outline: 2px solid var(--rev-focus);
  outline-offset: 2px;
}
