/* Liste des compétitions et page dossier */

.competition-status {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  margin: 0;
  white-space: nowrap;
}

.status-en-cours {
  background-color: #D1FAE5;
  color: #065F46;
}

.status-en-preparation {
  background-color: #FEF3C7;
  color: #92400E;
}

.status-terminee {
  background-color: #DBEAFE;
  color: #0C4A6E;
}

.status-archivee {
  background-color: #F1F5F9;
  color: #334155;
}

/* ─────────────────────────────────────────────────
   DOSSIER COMPÉTITION - Groupement par date/lieu/org
   ───────────────────────────────────────────────── */
.competition-folder {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  cursor: pointer;
  border-left: 5px solid var(--accent-blue);
  display: flex;
  flex-direction: column;
}

.competition-folder:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.competition-folder.en-cours {
  border-left-color: var(--accent-green);
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.05), transparent);
}

.competition-folder.en-preparation {
  border-left-color: var(--accent-yellow);
}

.competition-folder.terminee {
  border-left-color: var(--accent-blue);
}

.folder-header {
  background: transparent;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.folder-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--fg-primary);
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.folder-count-badge {
  display: inline-block;
  background: var(--accent-blue);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.folder-info {
  padding: 1.5rem;
  flex: 1;
}

.folder-info .info-row {
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.folder-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

/* ─────────────────────────────────────────────────
   MODAL - Dossier ouvert
   ───────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2rem;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 90%;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideDown 0.3s ease;
}

.modal-header {
  padding: 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1001;
}

.modal-header h2 {
  margin: 0;
  color: var(--fg-primary);
  font-size: 1.5rem;
}

.modal-close-btn {
  background: var(--border);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.modal-close-btn:hover {
  background: var(--accent-red);
  color: white;
}

.modal-body {
  padding: 2rem;
}

.competitions-in-folder {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.competitions-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 0.25rem;
}

.competition-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  cursor: pointer;
  border-left: 5px solid var(--accent-blue);
}

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

.competition-card.en-cours {
  border-left-color: var(--accent-green);
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.05), transparent);
}

.competition-card.terminee {
  border-left-color: var(--accent-blue);
}

.competition-card.en-preparation {
  border-left-color: var(--accent-yellow);
}

.competition-card header {
  background: transparent;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin: 0;
  position: static;
  top: auto;
  z-index: auto;
  box-shadow: none;
}

.competition-card header .logo {
  font-size: 1rem;
  font-weight: bold;
}

.competition-card h3 {
  margin: 0.5rem 0 0 0;
  color: var(--fg-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.competition-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}

.competition-title {
  flex: 1;
}

.competition-info {
  padding: 1.5rem;
}

.info-row {
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.info-label {
  font-weight: bold;
  color: var(--fg-secondary);
}

.info-value {
  color: var(--fg-primary);
}

.competition-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: var(--radius);
  display: inline-block;
  transition: all 0.3s ease;
}

.btn-view {
  background: var(--accent-blue);
  color: white;
  flex: 1;
  text-align: center;
}

.btn-view:hover {
  background: var(--bg-sidebar);
}

.btn-live {
  background: var(--accent-orange);
  color: white;
  flex: 1;
  text-align: center;
}

.btn-live:hover {
  background: #EA6317;
}

.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--fg-primary);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.no-competitions {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--fg-secondary);
}

.no-competitions p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* Search bar avec view toggle */
.search-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.search-bar {
  flex: 1;
  max-width: 400px;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.view-toggle {
  display: flex;
  gap: 0.5rem;
}

.view-toggle-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.view-toggle-btn.active {
  background: var(--accent-blue);
  color: white;
}

.view-toggle-btn:not(.active) {
  background: var(--border);
  color: var(--fg-primary);
}

.view-toggle-btn:hover {
  opacity: 0.8;
}

.live-badge {
  display: inline-block;
  background: var(--accent-red);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
  margin-left: 0.5rem;
  animation: pulse 2s infinite;
}

/* Vue Liste - Tableau */
.competitions-list.list-view {
  display: block;
  width: 100%;
  overflow-x: auto;
}

.competitions-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.competitions-table thead {
  background: var(--accent-blue);
  color: white;
}

.competitions-table th {
  padding: 1rem 1.5rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.competitions-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease;
}

.competitions-table tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.05);
}

.competitions-table td {
  padding: 0.75rem 1.5rem;
  vertical-align: middle;
  color: var(--fg-primary);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-title {
  font-weight: 600;
  min-width: 200px;
  white-space: normal;
}

.table-date, .table-lieu, .table-arme, .table-categorie {
  min-width: 100px;
}

.table-tireurs, .table-org {
  min-width: 90px;
}

.table-statut-col {
  min-width: 120px;
}

.table-statut {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.table-actions-col {
  min-width: 180px;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  white-space: nowrap;
}

.table-actions .btn-small {
  flex: 0 0 auto;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* Vue Carte */
.competitions-list.card-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

@media (max-width: 768px) {
  .competitions-list {
    grid-template-columns: 1fr;
  }

  .competition-footer {
    flex-direction: column;
  }

  .filters {
    flex-direction: column;
  }

  .filter-btn {
    width: 100%;
  }
}

/* Lien vers la page d'un dossier */
.btn-share {
  background: var(--bg-card);
  color: var(--accent-blue);
  border: 2px solid var(--accent-blue);
  text-align: center;
  cursor: pointer;
}

.btn-share:hover {
  background: var(--accent-blue);
  color: white;
}

.btn-share[hidden] {
  display: none;
}

.modal-header .btn-share {
  margin-left: auto;
}

.folder-footer .btn-view {
  border: 2px solid var(--accent-blue);
  cursor: pointer;
  font-family: inherit;
}
