/* ==========================================================================
   machine.css — Styles de la Machine a Decisions unifiee
   Onglets categorie + rouleaux slot machine + eliminate mode + match result
   Theme clair
   ========================================================================== */

/* --------------------------------------------------------------------------
   Category Tabs
   -------------------------------------------------------------------------- */

.machine__tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.machine__tabs::-webkit-scrollbar {
  display: none;
}

.machine__tab {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.machine__tab:hover {
  color: var(--text-secondary);
  border-color: var(--border-hover);
}

.machine__tab--active {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
}

.machine__tab-icon {
  font-size: var(--text-sm);
  line-height: 1;
}

.machine__tab-label {
  line-height: 1;
}

.machine__tab-badge {
  font-size: 8px;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Header & Description
   -------------------------------------------------------------------------- */

.machine__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.machine__header-icon {
  font-size: var(--text-xl);
  line-height: 1;
}

.machine__desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Pre-selection Chips
   -------------------------------------------------------------------------- */

.machine__preselect {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.machine__preselect-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(99, 102, 241, 0.08);
  border: 1.5px solid var(--primary-light);
  border-radius: var(--radius-full);
  color: var(--primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.machine__preselect-chip:hover {
  background: rgba(99, 102, 241, 0.15);
}

.machine__preselect-chip--off {
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.machine__preselect-chip--off:hover {
  background: var(--bg-secondary);
  border-color: var(--border-hover);
}

.machine__preselect-check {
  display: flex;
  align-items: center;
  width: 16px;
  height: 16px;
}

.machine__preselect-check svg {
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------------------
   Reels Container
   -------------------------------------------------------------------------- */

.machine__reels {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Individual Reel
   -------------------------------------------------------------------------- */

.machine__reel {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  transition: opacity 200ms ease;
}

.machine__reel--disabled {
  opacity: 0.25;
  pointer-events: none;
}

.machine__reel-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.machine__reel-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-full);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 150ms ease;
  padding: 0;
  flex-shrink: 0;
}

.machine__reel-custom:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  transform: scale(1.1);
}

/* --------------------------------------------------------------------------
   Reel Window (visible area)
   -------------------------------------------------------------------------- */

.machine__reel-window {
  width: 100%;
  height: 100px;
  overflow: hidden;
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* Ligne de selection au centre */
.machine__reel-window-line {
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 32px;
  transform: translateY(-50%);
  border: 1.5px solid var(--primary-light);
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.04);
  z-index: 2;
  pointer-events: none;
}

/* Top/bottom fade gradients */
.machine__reel-window::before,
.machine__reel-window::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 28px;
  z-index: 1;
  pointer-events: none;
}

.machine__reel-window::before {
  top: 0;
  background: linear-gradient(180deg, var(--bg), transparent);
}

.machine__reel-window::after {
  bottom: 0;
  background: linear-gradient(0deg, var(--bg), transparent);
}

/* --------------------------------------------------------------------------
   Reel Strip (animated)
   -------------------------------------------------------------------------- */

.machine__reel-strip {
  position: absolute;
  width: 100%;
  will-change: transform;
}

.machine__reel-strip--settling {
  transition: transform 1200ms cubic-bezier(0.23, 1, 0.32, 1);
}

/* --------------------------------------------------------------------------
   Reel Item
   -------------------------------------------------------------------------- */

.machine__reel-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.machine__reel--stopped .machine__reel-item {
  color: var(--text);
}

.machine__reel--stopped .machine__reel-item--selected {
  font-weight: 800;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Lock Button
   -------------------------------------------------------------------------- */

.machine__reel-lock {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  opacity: 0;
  pointer-events: none;
  transition: all 150ms ease;
  cursor: pointer;
}

.machine__reel-lock svg {
  width: 14px;
  height: 14px;
}

.machine__reel-lock--visible {
  opacity: 1;
  pointer-events: auto;
}

.machine__reel-lock--visible:hover {
  color: var(--primary);
  border-color: var(--primary-light);
}

.machine__reel-lock--locked {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.machine__reel-lock--locked:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
}

/* --------------------------------------------------------------------------
   Eliminate Mode Toggle
   -------------------------------------------------------------------------- */

.machine__reel-eliminate {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
  min-height: 24px;
}

.machine__reel-eliminate svg {
  flex-shrink: 0;
}

.machine__reel-eliminate:hover {
  color: var(--text-secondary);
  border-color: var(--border-hover);
}

.machine__reel-eliminate--active {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
}

.machine__reel-eliminate-count {
  font-size: 9px;
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-weight: 600;
  text-align: center;
  margin-top: 2px;
  transition: color 150ms ease;
}

.machine__reel-eliminate--active + .machine__reel-eliminate-count {
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Match Result Card (Activites, Weekend, Defi)
   -------------------------------------------------------------------------- */

.machine__match-result {
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  background: rgba(99, 102, 241, 0.04);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-lg);
  text-align: center;
  animation: fadeInUp 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.machine__match-emoji {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-sm);
  line-height: 1;
}

.machine__match-label {
  font-family: var(--font-body);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xs);
}

.machine__match-desc {
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.4;
}

.machine__match-tags {
  display: flex;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.machine__match-tag {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.machine__draw-btn {
  margin-bottom: var(--space-lg);
}

.machine__reset-btn {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* --------------------------------------------------------------------------
   History
   -------------------------------------------------------------------------- */

.machine__history {
  margin-top: var(--space-md);
}

.machine__history-title {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.machine__history-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.machine__history-emoji {
  flex-shrink: 0;
  font-size: var(--text-base);
}

.machine__history-text {
  flex: 1;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.machine__history-text strong {
  color: var(--primary);
  font-weight: 600;
}

.machine__history-date {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   WIP Badge (En developpement)
   -------------------------------------------------------------------------- */

.machine__wip {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.machine__wip-icon {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-md);
}

.machine__wip-text {
  font-family: var(--font-body);
  color: var(--text-tertiary);
  font-size: var(--text-base);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .machine__reel {
    max-width: 90px;
  }

  .machine__reel-window {
    height: 85px;
  }

  .machine__reel-label {
    font-size: 9px;
  }

  .machine__preselect-chip {
    font-size: 10px;
    padding: 3px 8px;
  }

  .machine__reel-eliminate {
    font-size: 8px;
    padding: 3px 6px;
  }

  .machine__tab {
    padding: var(--space-xs) var(--space-sm);
    font-size: 10px;
  }
}

@media (min-width: 480px) {
  .machine__reel-window {
    height: 108px;
  }

  .machine__reel-item {
    font-size: var(--text-base);
  }

  .machine__reel-window-line {
    height: 36px;
  }

  .machine__reel-window::before,
  .machine__reel-window::after {
    height: 28px;
  }

  .machine__reels {
    gap: var(--space-md);
  }
}

@media (min-width: 768px) {
  .machine__reel-window {
    height: 120px;
  }

  .machine__reel {
    max-width: 160px;
  }

  .machine__match-label {
    font-size: var(--text-3xl);
  }
}

@media (min-width: 1024px) {
  .machine__reel {
    max-width: 180px;
  }

  .machine__reel-window {
    height: 130px;
  }
}

/* --------------------------------------------------------------------------
   Vote UI (post-tirage)
   -------------------------------------------------------------------------- */

.machine__vote {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  animation: fadeInUp 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.machine__vote-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.machine__vote-stars {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: var(--space-sm);
}

.machine__vote-star {
  font-size: var(--text-2xl);
  color: var(--border);
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  transition: color 150ms, transform 150ms;
  font-family: inherit;
}

.machine__vote-star:hover {
  transform: scale(1.15);
}

.machine__vote-star--active {
  color: var(--amber);
}

.machine__vote-note {
  width: 100%;
  margin-bottom: var(--space-sm);
  resize: none;
  font-size: var(--text-sm);
}

/* --------------------------------------------------------------------------
   Post-draw actions (Partager, etc.)
   -------------------------------------------------------------------------- */

.machine__post-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .machine__reel-strip--settling {
    transition: none;
  }

  .machine__match-result,
  .machine__vote {
    animation: none;
  }
}
