/* ============================================================================
   Nexus — nexus.css
   Version : 1.1.0

   Styles spécifiques au dashboard Nexus.
   Dépend de vnct-design-system.css (chargé avant).
   ============================================================================ */

/* --- Écran de login --- */
.nexus-login {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 9999;
  padding: var(--space-4);
}

.nexus-login__card {
  width: 100%;
  max-width: 380px;
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  text-align: center;
}

.nexus-login__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.nexus-login__logo {
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--accent);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.nexus-login__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0;
}

.nexus-login__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}

.nexus-login__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: left;
}

.nexus-login__form .vnct-input {
  height: 44px;
  font-size: var(--text-base);
}

.nexus-login__btn {
  width: 100%;
  height: 44px;
  font-size: var(--text-base);
}

.nexus-login__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nexus-login__error {
  font-size: var(--text-sm);
  color: var(--danger);
  margin: var(--space-1) 0 0;
}

.nexus-login__footer {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: 0;
}

/* Bouton déconnexion dans la nav */
.nexus-logout-btn {
  background: none;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  transition: all var(--duration-fast) ease;
}

.nexus-logout-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Bouton refresh */
.nexus-refresh-btn {
  background: none;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) ease;
}

.nexus-refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.nexus-refresh-btn svg {
  transition: transform 0.3s ease;
}

.nexus-refresh-btn--spinning svg {
  animation: nexus-spin 0.8s linear infinite;
}

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

/* Masquer le FAB VNCT — Nexus utilise son propre bouton + */
.vnct-fab,
.vnct-fab-menu,
.vnct-fab-overlay {
  display: none !important;
}

/* --- Container principal --- */
.nexus-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

/* --- Recherche --- */
.nexus-search-wrapper {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.nexus-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.nexus-search {
  padding-left: calc(var(--space-3) + 16px + var(--space-2)) !important;
  font-size: var(--text-sm) !important;
  height: 36px;
}

.nexus-search-mobile {
  position: relative;
  display: none;
  margin-bottom: var(--space-4);
}

.nexus-search-mobile .nexus-search {
  height: 44px;
  font-size: var(--text-base) !important;
}

@media (max-width: 768px) {
  .nexus-search-mobile {
    display: block;
  }
}

/* --- Filtres --- */
.nexus-filters {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-2) 0 var(--space-4);
}

.nexus-filters__tabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--space-1);
}

.nexus-filters__tabs::-webkit-scrollbar {
  display: none;
}

.nexus-filters__tab {
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) ease;
}

.nexus-filters__tab:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.nexus-filters__tab--active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.nexus-filters__dropdowns {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.nexus-filters__select {
  width: auto;
  min-width: 180px;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4);
  height: 36px;
}

/* --- Grille d'idées --- */
.nexus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
  animation: vnct-fade-in var(--duration-normal) ease;
}

/* --- Carte d'idée --- */
.nexus-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  padding-left: calc(var(--space-6) + 4px);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s var(--ease-smooth);
}

/* Barre latérale de priorité */
.nexus-card__priority-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.nexus-card[data-priority="haute"] .nexus-card__priority-bar {
  background: var(--danger);
  box-shadow: 0 0 8px hsla(355, 80%, 55%, 0.3);
}

.nexus-card[data-priority="moyenne"] .nexus-card__priority-bar {
  background: var(--warning);
}

.nexus-card[data-priority="basse"] .nexus-card__priority-bar {
  background: var(--success);
}

.nexus-card__priority-badge[data-priority="haute"] {
  color: var(--danger);
  border-color: var(--danger);
}

.nexus-card__priority-badge[data-priority="moyenne"] {
  color: var(--warning);
  border-color: var(--warning);
}

.nexus-card__priority-badge[data-priority="basse"] {
  color: var(--success);
  border-color: var(--success);
}

/* Header : titre + badge statut */
.nexus-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}

.nexus-card__title-wrap {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.nexus-card__id {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.6;
}

.nexus-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  flex: 1;
  min-width: 0;
  margin: 0;
}

/* Badge statut */
.nexus-card__status {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.nexus-card__status[data-status="idee"] {
  background: hsla(0, 0%, 50%, 0.1);
  color: var(--text-muted);
}

.nexus-card__status[data-status="planifie"] {
  background: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.1);
  color: var(--accent);
}

.nexus-card__status[data-status="en-cours"] {
  background: hsla(35, 90%, 50%, 0.1);
  color: var(--warning);
}

.nexus-card__status[data-status="fait"] {
  background: hsla(140, 60%, 45%, 0.1);
  color: var(--success);
}

.nexus-card__status[data-status="abandonne"] {
  background: hsla(355, 80%, 55%, 0.1);
  color: var(--danger);
}

/* Description tronquée */
.nexus-card__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

/* Meta : catégorie + priorité */
.nexus-card__meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.nexus-card__category,
.nexus-card__priority-badge {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
}

.nexus-card__category[data-category="infra"] {
  color: var(--accent);
  border-color: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.3);
}

.nexus-card__category[data-category="dev"] {
  color: #60a0ff;
  border-color: rgba(96, 160, 255, 0.3);
}

.nexus-card__category[data-category="design"] {
  color: #a070f0;
  border-color: rgba(160, 112, 240, 0.3);
}

.nexus-card__category[data-category="organisation"] {
  color: var(--warning);
  border-color: hsla(35, 90%, 50%, 0.3);
}

.nexus-card__category[data-category="autre"] {
  color: var(--text-muted);
}

/* Tags */
.nexus-card__tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.nexus-card__tag {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Date */
.nexus-card__date {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: auto;
}

/* Carte abandonnée : opacité réduite */
.nexus-card[data-status="abandonne"] {
  opacity: 0.5;
}

.nexus-card[data-status="abandonne"]:hover {
  opacity: 0.8;
}

/* Hover desktop (néon) */
@media (min-width: 769px) {
  .nexus-card:hover {
    border-color: var(--accent);
    box-shadow: var(--neon-shadow-md);
    transform: translateY(-2px);
  }

  .nexus-card:active {
    transform: translateY(0);
    box-shadow: var(--neon-shadow-sm);
  }
}

/* Tap mobile */
@media (max-width: 768px) {
  .nexus-card {
    border-radius: var(--radius-md);
    padding: var(--space-5);
    padding-left: calc(var(--space-5) + 4px);
  }

  .nexus-card:active {
    transform: scale(0.98);
    background: var(--surface-active);
  }
}

/* --- Stats widget (desktop only) --- */
.nexus-stats {
  position: fixed;
  bottom: calc(var(--space-8) + var(--space-4));
  right: var(--space-6);
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  z-index: 50;
}

.nexus-stats__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.nexus-stats__value {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--accent);
}

.nexus-stats__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .nexus-stats {
    display: none;
  }
}

/* --- Bouton + flottant mobile --- */
.nexus-fab-add {
  display: none;
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #000;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neon-shadow-md);
  transition: all 0.3s ease;
  z-index: 900;
}

.nexus-fab-add:hover {
  transform: scale(1.08);
  box-shadow: var(--neon-shadow-lg);
}

@media (max-width: 768px) {
  .nexus-fab-add {
    display: flex;
  }
}

/* --- Sections (En cours / À faire / Terminées) --- */
.nexus-section {
  margin-bottom: var(--space-6);
}

.nexus-section:last-child {
  margin-bottom: 0;
}

.nexus-section__header {
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  padding: var(--space-2) 0;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nexus-section__header--accent {
  color: var(--accent);
}

.nexus-section__toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
  padding: var(--space-2) 0;
  margin-bottom: var(--space-3);
  transition: color var(--duration-fast) ease;
}

.nexus-section__toggle:hover {
  color: var(--text-secondary);
}

.nexus-section__chevron {
  transition: transform var(--duration-fast) ease;
  flex-shrink: 0;
}

.nexus-section__chevron--open {
  transform: rotate(90deg);
}

.nexus-section__count {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--surface-hover);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  text-transform: none;
  letter-spacing: normal;
}

/* Section terminées — cartes atténuées */
.nexus-section--muted .nexus-card {
  opacity: 0.55;
}

.nexus-section--muted .nexus-card:hover {
  opacity: 0.85;
}

/* Message "tout est terminé" */
.nexus-all-done {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.nexus-all-done__icon {
  font-size: 2rem;
}

.nexus-all-done__text {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: var(--space-2) 0 0;
}

/* --- État vide --- */
.nexus-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-16) var(--space-4);
  text-align: center;
}

.nexus-empty__icon {
  font-size: 3rem;
  opacity: 0.5;
}

.nexus-empty__title {
  font-size: var(--text-xl);
  color: var(--text-primary);
  margin: 0;
}

.nexus-empty__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0;
}

/* --- Formulaire modal --- */
.nexus-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.nexus-form__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nexus-form__row {
  display: flex;
  gap: var(--space-4);
}

.nexus-form__row .nexus-form__field {
  flex: 1;
}

.nexus-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.nexus-form__actions--between {
  justify-content: space-between;
}

/* --- Modal détail --- */
.nexus-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.nexus-detail__title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0;
}

.nexus-detail__badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.nexus-detail__desc {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  white-space: pre-wrap;
  margin: 0;
}

.nexus-detail__notes {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  white-space: pre-wrap;
  padding: var(--space-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin: 0;
}

.nexus-detail__notes-label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin: 0 0 var(--space-2);
}

.nexus-detail__tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.nexus-detail__dates {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nexus-detail__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.nexus-detail__actions--between {
  justify-content: space-between;
  align-items: center;
}

.nexus-detail__actions-right {
  display: flex;
  gap: var(--space-3);
}

.nexus-detail__status-select select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-default);
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-3);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s;
}

.nexus-detail__status-select select:hover {
  border-color: var(--accent);
}

.nexus-detail__status-select select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 236, 72, 153), 0.15);
}

/* --- Rendu Markdown --- */
.nexus-md > *:first-child {
  margin-top: 0;
}

.nexus-md > *:last-child {
  margin-bottom: 0;
}

.nexus-md p {
  margin: 0 0 0.15em;
}

.nexus-md strong {
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.nexus-md em {
  font-style: italic;
}

.nexus-md ul,
.nexus-md ol {
  margin: 0 0 0.15em;
  padding-left: var(--space-4);
}

.nexus-md li {
  margin: 0;
  padding: 0;
}

.nexus-md li p {
  margin: 0;
}

.nexus-md p + ul,
.nexus-md p + ol {
  margin-top: 0;
}

.nexus-md code {
  font-size: var(--text-xs);
  background: var(--bg-tertiary);
  padding: 2px var(--space-1);
  border-radius: var(--radius-sm);
}

.nexus-md pre {
  background: var(--bg-tertiary);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 0.15em 0;
}

.nexus-md pre code {
  background: none;
  padding: 0;
}

.nexus-md a {
  color: var(--accent);
  text-decoration: underline;
}

.nexus-md blockquote {
  border-left: 3px solid var(--border-default);
  padding-left: var(--space-3);
  color: var(--text-muted);
  margin: 0.15em 0;
}

/* --- Responsive mobile --- */
@media (max-width: 768px) {
  .nexus-container {
    padding: var(--space-4) var(--space-3);
  }

  .nexus-grid {
    grid-template-columns: 1fr;
  }

  .nexus-filters__dropdowns {
    flex-direction: column;
  }

  .nexus-filters__select {
    width: 100%;
    min-width: unset;
    height: 44px;
  }

  .nexus-form__row {
    flex-direction: column;
    gap: var(--space-3);
  }
}

/* --- Bouton push notifications (desktop + mobile) --- */
.nexus-push-btn--active {
  border-color: var(--accent);
  color: var(--accent);
  background: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.1);
}
