/* ================================= */
/* COMPOSANTS TAILWINDCSS RÉUTILISABLES - GO WORK */
/* ================================= */

/* Configuration Tailwind custom pour GO Work */
@config {
  theme: {
    extend: {
      colors: {
        'go-primary': '#0e2f59',
        'go-secondary': '#f5e100',
        'go-success': '#4caf50',
        'go-danger': '#dc3545',
        'go-warning': '#ffc107',
        'go-info': '#17a2b8',
        'go-light': '#f8f9fa',
        'go-dark': '#1a1a1a',
        'go-text': '#333333',
        'go-text-muted': '#6c757d',
        'go-border': '#dee2e6'
      },
      fontFamily: {
        'neulis': ['neulis-sans', 'sans-serif']
      },
      borderRadius: {
        'go': '18px'
      },
      boxShadow: {
        'go': '0 2px 10px rgba(0,0,0,0.1)'
      }
    }
  }
}

/* ================================= */
/* CONTENEURS ET LAYOUT */
/* ================================= */

/* Layout principal avec sidebar */
.go-main-layout {
  margin-left: 250px !important; /* Décalage pour la sidebar fixe de 250px */
  min-height: 100vh;
  background-color: #f9fafb;
  padding-top: 81px; /* Décalage pour le header fixe */
}

/* Layout pour la page d'accueil sans header */
.go-main-layout.no-header {
  padding-top: 0; /* Pas de décalage si pas de header */
}

/* Contenu avec marges égales à gauche et droite */
.go-content-centered {
  padding-top: 32px; /* Marge après le header (le header fixe est déjà géré par go-main-layout) */
  padding-bottom: 32px;
  /* Marges égales de chaque côté */
  margin-left: 32px;
  margin-right: 32px;
}

/* Header qui prend toute la largeur après sidebar - ALIGNÉ avec le logo */
.go-header-centered {
  position: fixed;
  top: 0;
  left: 250px; /* Position après la sidebar de 250px */
  right: 0;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 0; /* Padding vertical seulement */
  height: 81px; /* Hauteur exacte du header de la sidebar */
  display: flex;
  align-items: center;
  z-index: 30;
}

/* Header mobile caché par défaut, visible sur mobile */
.header-mobile {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 16px;
}

/* Header desktop visible par défaut - CENTRÉ avec bouton retour à gauche */
.header-desktop {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  position: relative;
}

/* Bouton retour positionné à gauche */
.header-back-btn {
  position: absolute;
  left: 15px;
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.header-back-btn:hover {
  background-color: #f3f4f6;
  color: #111827;
}

/* Titre et sous-titre centrés sur la même ligne avec / */
.header-desktop > div:not(.relative) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Menu admin positionné à droite */
.header-desktop > .relative,
.header-desktop > div.flex.items-center {
  position: absolute;
  right: 15px;
}

.header-desktop h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.header-separator {
  font-size: 1.25rem;
  color: #9ca3af;
  margin: 0 4px;
}

.header-subtitle {
  font-size: 1rem;
  color: #6b7280;
  font-weight: 400;
}

/* Spacer pour équilibrer le bouton retour (pas affiché mais prend la place) */
.header-spacer {
  width: 40px;
  height: 40px;
}

/* Conteneur principal (legacy) */
.go-container {
  @apply max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 mb-8;
}

.go-container-fluid {
  @apply w-full px-4 sm:px-6 lg:px-8 mb-8;
}

.go-header-content {
  @apply flex items-center justify-between;
}

/* Layout responsive - Mobile sans sidebar */
@media (max-width: 768px) {
  .go-main-layout {
    margin-left: 0 !important; /* Pas de sidebar sur mobile */
  }

  .go-content-centered {
    margin-left: 16px; /* Marges réduites sur mobile */
    margin-right: 16px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .go-header-centered {
    padding: 12px 16px;
    margin-bottom: 16px;
  }

  /* Sur mobile : afficher header mobile, cacher desktop */
  .header-mobile {
    display: flex;
  }

  .header-desktop {
    display: none;
  }
}

/* ================================= */
/* BOUTONS RÉUTILISABLES */
/* ================================= */

/* Bouton principal */
.go-btn {
  @apply px-6 py-3 rounded-go font-medium transition-all duration-300
         focus:outline-none focus:ring-2 focus:ring-offset-2
         disabled:opacity-50 disabled:cursor-not-allowed
         inline-flex items-center justify-center text-sm;
}

.go-btn-primary {
  @apply go-btn bg-go-primary text-white hover:bg-blue-700
         focus:ring-go-primary shadow-go;
}

.go-btn-secondary {
  @apply go-btn bg-go-secondary text-go-primary hover:bg-yellow-400
         focus:ring-go-secondary shadow-go;
}

.go-btn-success {
  @apply go-btn bg-go-success text-white hover:bg-green-600
         focus:ring-go-success shadow-go;
}

.go-btn-danger {
  @apply go-btn bg-go-danger text-white hover:bg-red-600
         focus:ring-go-danger shadow-go;
}

.go-btn-outline {
  @apply go-btn border-2 border-go-primary text-go-primary bg-transparent
         hover:bg-go-primary hover:text-white focus:ring-go-primary;
}

.go-btn-ghost {
  @apply go-btn text-go-primary bg-transparent hover:bg-go-light
         focus:ring-go-primary;
}

/* Tailles de boutons */
.go-btn-sm {
  @apply px-4 py-2 text-xs;
}

.go-btn-lg {
  @apply px-8 py-4 text-base;
}

/* ================================= */
/* CARTES ET CONTENEURS */
/* ================================= */

.go-card {
  @apply bg-white rounded-go shadow-go border border-go-border p-6;
}

.go-card-header {
  @apply border-b border-go-border pb-4 mb-4;
}

.go-card-title {
  @apply text-xl font-semibold text-go-text;
}

.go-card-body {
  @apply space-y-4;
}

.go-card-footer {
  @apply border-t border-go-border pt-4 mt-4;
}

/* ================================= */
/* FORMULAIRES */
/* ================================= */

.go-form-group {
  @apply space-y-2;
}

.go-label {
  @apply block text-sm font-medium text-go-text;
}

.go-input {
  @apply w-full px-4 py-3 border border-go-border rounded-go
         focus:ring-2 focus:ring-go-primary focus:border-go-primary
         transition-colors duration-200 text-go-text placeholder-go-text-muted;
}

.go-textarea {
  @apply go-input resize-vertical min-h-32;
}

.go-select {
  @apply go-input bg-white cursor-pointer;
}

.go-checkbox {
  @apply h-4 w-4 text-go-primary border-go-border rounded
         focus:ring-go-primary focus:ring-2;
}

.go-radio {
  @apply h-4 w-4 text-go-primary border-go-border
         focus:ring-go-primary focus:ring-2;
}

/* États des inputs */
.go-input-error {
  @apply border-go-danger focus:ring-go-danger focus:border-go-danger;
}

.go-input-success {
  @apply border-go-success focus:ring-go-success focus:border-go-success;
}

/* ================================= */
/* NAVIGATION ET MENU */
/* ================================= */

.go-nav {
  @apply bg-white shadow-go border-b border-go-border;
}

.go-nav-item {
  @apply px-4 py-3 text-go-text hover:bg-go-light transition-colors duration-200;
}

.go-nav-item-active {
  @apply go-nav-item bg-go-primary text-white;
}

.go-breadcrumb {
  @apply flex items-center space-x-2 text-sm text-go-text-muted;
}

.go-breadcrumb-item {
  @apply hover:text-go-primary transition-colors duration-200;
}

/* ================================= */
/* ALERTES ET NOTIFICATIONS */
/* ================================= */

.go-alert {
  @apply p-4 rounded-go border flex items-start space-x-3;
}

.go-alert-success {
  @apply go-alert bg-green-50 border-green-200 text-green-800;
}

.go-alert-error {
  @apply go-alert bg-red-50 border-red-200 text-red-800;
}

.go-alert-warning {
  @apply go-alert bg-yellow-50 border-yellow-200 text-yellow-800;
}

.go-alert-info {
  @apply go-alert bg-blue-50 border-blue-200 text-blue-800;
}

/* ================================= */
/* BADGES ET STATUTS */
/* ================================= */

.go-badge {
  @apply inline-flex items-center px-3 py-1 rounded-full text-xs font-medium;
}

.go-badge-primary {
  @apply go-badge bg-go-primary text-white;
}

.go-badge-secondary {
  @apply go-badge bg-go-secondary text-go-primary;
}

.go-badge-success {
  @apply go-badge bg-green-100 text-green-800;
}

.go-badge-danger {
  @apply go-badge bg-red-100 text-red-800;
}

.go-badge-warning {
  @apply go-badge bg-yellow-100 text-yellow-800;
}

.go-badge-info {
  @apply go-badge bg-blue-100 text-blue-800;
}

/* ================================= */
/* PRIORITY BADGES POUR TÂCHES */
/* ================================= */

.go-priority-urgent {
  @apply go-badge bg-red-500 text-white animate-pulse;
}

.go-priority-high {
  @apply go-badge bg-red-100 text-red-800;
}

.go-priority-medium {
  @apply go-badge bg-yellow-100 text-yellow-800;
}

.go-priority-low {
  @apply go-badge bg-gray-100 text-gray-800;
}

/* ================================= */
/* LOADING ET ANIMATIONS */
/* ================================= */

.go-spinner {
  @apply animate-spin rounded-full h-6 w-6 border-2 border-go-primary border-t-transparent;
}

.go-skeleton {
  @apply animate-pulse bg-gray-200 rounded;
}

/* ================================= */
/* UTILITAIRES RESPONSIVE */
/* ================================= */

/* Masquer sur mobile */
.go-hidden-mobile {
  @apply hidden sm:block;
}

/* Masquer sur desktop */
.go-mobile-only {
  @apply block sm:hidden;
}

/* Flexbox responsive */
.go-flex-mobile {
  @apply flex flex-col sm:flex-row sm:items-center sm:justify-between;
}

/* Grid responsive */
.go-grid-responsive {
  @apply grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4;
}

/* ================================= */
/* MODALES ET OVERLAYS */
/* ================================= */

.go-modal {
  @apply fixed inset-0 z-50 flex items-center justify-center;
}

.go-modal-backdrop {
  @apply absolute inset-0 bg-black bg-opacity-50;
}

.go-modal-content {
  @apply relative bg-white rounded-go shadow-go max-w-lg w-full mx-4 p-6;
}

.go-modal-header {
  @apply flex items-center justify-between pb-4 border-b border-go-border;
}

.go-modal-title {
  @apply text-lg font-semibold text-go-text;
}

.go-modal-close {
  @apply text-go-text-muted hover:text-go-text transition-colors duration-200;
}

/* ================================= */
/* TABLES RESPONSIVE */
/* ================================= */

.go-table {
  @apply w-full border-collapse bg-white rounded-go overflow-hidden shadow-go;
}

.go-table-header {
  @apply bg-go-light border-b border-go-border;
}

.go-table-cell {
  @apply px-4 py-3 text-go-text border-b border-go-border;
}

.go-table-cell-center {
  @apply go-table-cell text-center;
}

.go-table-responsive {
  @apply overflow-x-auto;
}

/* ================================= */
/* STATUS SPÉCIFIQUES GO WORK */
/* ================================= */

.go-task-draft {
  @apply bg-gray-100 text-gray-600 border-gray-200;
}

.go-task-not-started {
  @apply bg-blue-100 text-blue-600 border-blue-200;
}

.go-task-in-progress {
  @apply bg-yellow-100 text-yellow-600 border-yellow-200;
}

.go-task-completed {
  @apply bg-green-100 text-green-600 border-green-200;
}

/* ================================= */
/* ANIMATIONS PERSONNALISÉES */
/* ================================= */

.go-fade-in {
  @apply animate-in fade-in duration-300;
}

.go-slide-up {
  @apply animate-in slide-in-from-bottom-4 duration-300;
}

.go-scale-in {
  @apply animate-in zoom-in-95 duration-200;
}

/* ================================= */
/* LISTES AVEC CARTES (FAQ & ANNONCES) */
/* ================================= */

/* Container de liste */
.go-list-container {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  overflow: hidden;
}

/* Container de liste avec scroll (pour pages avec beaucoup de contenu) */
.go-list-container-scrollable {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  overflow-y: auto;
  height: calc(100vh - 280px);
}

/* Message quand aucun contenu (centré verticalement dans le container) */
.no-sessions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 280px);
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.no-sessions i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-sessions h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
}

.no-sessions p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Empêcher le scroll sur les pages avec container scrollable */
body.no-scroll {
  overflow: hidden;
}

.go-main-layout.fixed-height {
  overflow: hidden;
}

/* Carte de liste */
.go-list-card {
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s ease;
  cursor: pointer;
  gap: 20px;
}

.go-list-card:last-child {
  border-bottom: none;
}

.go-list-card:hover {
  background-color: #f9fafb;
}

/* Thumbnail 16:9 pour annonces */
.go-thumbnail {
  position: relative;
  flex-shrink: 0;
  width: 192px;
  aspect-ratio: 16 / 9;
  background-color: #f1f5f9;
  border-radius: 8px;
  overflow: hidden;
}

.go-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Badge "NOUVEAU" */
.go-badge-nouveau {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 9999px;
  animation: pulse-badge 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-badge {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .8;
  }
}

/* Icône de victoire (trophée) */
.go-victoire-icon {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #0e2f59 0%, #000000 50%, #f5e100 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.go-victoire-icon i {
  font-size: 2rem;
  color: #f5e100;
}

/* Stats de victoire (likes et commentaires) */
.go-victoire-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  padding-left: 20px;
}

.go-victoire-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #6b7280;
}

.go-victoire-stat i {
  font-size: 12px;
}

/* Contenu de la carte */
.go-list-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.go-list-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 8px 0;
  line-height: 1.4;
}

.go-list-excerpt {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.4;
  margin: 0 0 12px 0;
}

.go-list-meta {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: #9ca3af;
  gap: 12px;
}

/* Actions (menu 3 points) */
.go-list-actions {
  position: relative;
  margin-left: auto;
  padding-left: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.go-list-card:hover .go-list-actions {
  opacity: 1;
}

.go-actions-btn {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 16px;
}

.go-actions-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.go-actions-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  min-width: 120px;
  z-index: 1000;
  display: none;
}

.go-actions-menu.show {
  display: block;
}

.go-action-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: #374151;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f3f4f6;
}

.go-action-item:last-child {
  border-bottom: none;
}

.go-action-item:hover {
  background: #f9fafb;
}

.go-action-item.delete {
  color: #dc2626;
}

.go-action-item.delete:hover {
  background: #fef2f2;
}

/* Message quand liste vide */
.go-list-empty {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.go-list-empty i {
  font-size: 4rem;
  margin-bottom: 20px;
  color: #d1d5db;
}

.go-list-empty h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: #374151;
}

/* Pagination */
.go-pagination-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid #e5e5e5;
  padding: 20px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  margin-left: 250px;
}

.go-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.go-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  color: #6b7280;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
}

.go-pagination-btn:hover {
  border-color: var(--main-bg-color);
  color: var(--main-bg-color);
  background: #eff6ff;
}

.go-pagination-btn.active {
  background: var(--main-bg-color);
  border-color: var(--main-bg-color);
  color: #ffffff;
}

.go-pagination-btn.active:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.go-pagination-btn i {
  font-size: 12px;
}

.go-pagination-number {
  min-width: 40px;
}

.go-pagination-info {
  color: #6b7280;
  font-size: 14px;
  white-space: nowrap;
}

/* ================================= */
/* DARK MODE SUPPORT */
/* ================================= */

@media (prefers-color-scheme: dark) {
  .go-card {
    @apply bg-go-dark border-gray-700;
  }

  .go-input {
    @apply bg-go-dark border-gray-700 text-white;
  }

  .go-nav {
    @apply bg-go-dark border-gray-700;
  }
}