/* Unified action button style */
.btn-action {
    background-color: #e5e7eb;
    color: #374151;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-size: 1rem;
    margin-right: 0.3em;
    cursor: pointer;
}
.btn-action:last-child {
    margin-right: 0;
}
.btn-edit {
    background-color: #3b82f6;
    color: #fff;
}
.btn-edit:hover {
    background-color: #2563eb;
}
.btn-test {
    background-color: #6366f1;
    color: #fff;
}
.btn-test:hover {
    background-color: #4338ca;
}
.btn-delete {
    background-color: #ef4444;
    color: #fff;
}
.btn-delete:hover {
    background-color: #b91c1c;
}
.btn-maintenance {
    background-color: #fbbf24;
    color: #fff;
}
.btn-maintenance:hover {
    background-color: #f59e0b;
}
.btn-maintenance-active {
    background-color: #10b981 !important;
    color: #fff !important;
}

/* Responsive pour les boutons d'action */
@media (max-width: 992px) {
    .btn-action {
        font-size: 0.9rem;
        padding: 0.35rem 0.65rem;
        gap: 0.3em;
    }
}

@media (max-width: 768px) {
    .btn-action {
        font-size: 0.85rem;
        padding: 0.3rem 0.55rem;
        gap: 0.25em;
    }
}

@media (max-width: 480px) {
    .btn-action {
        font-size: 0.75rem;
        padding: 0.25rem 0.45rem;
        gap: 0.2em;
        margin-right: 0.2em;
    }
}
/* Bouton maintenance custom */
.btn-maintenance {
    background-color: #fbbf24;
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}
.btn-maintenance:hover {
    background-color: #f59e0b;
}
.btn-maintenance-active {
    background-color: #10b981;
    color: #fff;
}
/* Stats row for Gestion UI */
.targets-stats .stat-row {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: flex-start;
    margin-top: 1rem;
}
/* Composants réutilisables */

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-primary);
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.table td {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.table tr:hover {
    background-color: var(--bg-secondary);
}

.table tr:last-child td {
    border-bottom: none;
}

/* Modales */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-in-out;
}

/* Modal plus large pour les formulaires */
.modal-content.modal-form {
    max-width: 600px;
    min-width: 400px;
}

/* Styles pour les formulaires dans les modals */
.modal-form {
    padding: 1.5rem;
}

.modal-form .form-group {
    margin-bottom: 1.5rem;
}

.modal-form .form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Onglets */
.tab-container {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tab-list {
    display: flex;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
}

.tab-item:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: var(--bg-primary);
}

.tab-content {
    padding: 1.5rem;
}

/* Notifications/Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-icon {
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.875rem;
    opacity: 0.9;
}

.alert-success {
    background-color: rgba(22, 163, 74, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.alert-error {
    background-color: rgba(220, 38, 38, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.alert-warning {
    background-color: rgba(234, 88, 12, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(234, 88, 12, 0.2);
}

.alert-info {
    background-color: rgba(14, 165, 233, 0.1);
    color: var(--info-color);
    border: 1px solid rgba(14, 165, 233, 0.2);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1rem;
}

.pagination-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
}

.pagination-item:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-item.disabled:hover {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.breadcrumb-item {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb-item:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-muted);
}

/* Progress bars */
.progress-container {
    width: 100%;
    height: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease-in-out;
}

.progress-bar.success {
    background-color: var(--success-color);
}

.progress-bar.warning {
    background-color: var(--warning-color);
}

.progress-bar.error {
    background-color: var(--error-color);
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

/* Tooltip dans une cellule de tableau - ne pas changer le display */
td.tooltip,
th.tooltip {
    display: table-cell;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-primary);
    color: var(--bg-primary);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.25rem;
}

.tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-primary);
    z-index: 1000;
}

/* Module Dossards */
.bibs-module {
    padding: 1.5rem;
}

.module-header {
    text-align: center;
    margin-bottom: 2rem;
}

.module-subtitle {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.stats-section {
    margin-bottom: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    padding: 0.75rem 0.5rem;
    border-radius: calc(var(--border-radius) / 2);
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.7rem;
    opacity: 0.9;
    line-height: 1.2;
}

.actions-section,
.forms-section,
.bibs-list-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.results-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.form-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.form-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead th {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
}

.data-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.data-table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    min-width: auto;
}

.result-message {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    font-weight: 500;
}

.result-message.success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.result-message.error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.result-message.info {
    background-color: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.import-preview {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1rem 0;
}

.import-preview h4 {
    margin-top: 0;
    color: var(--text-primary);
}

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

.no-data p {
    margin: 0.5rem 0;
}

.error-container {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.error-container h2 {
    color: var(--danger-color);
    margin-bottom: 1rem;
}

/* Responsive pour les composants */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .tab-list {
        overflow-x: auto;
    }
    
    .tab-item {
        padding: 0.75rem 1rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .breadcrumb {
        flex-wrap: wrap;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

/* Shot Data table responsive styles */
/* Curseur pour indiquer qu'il y a un tooltip sur le timestamp */
.timestamp-cell {
    cursor: help;
}

/* Table wrapper responsive pour permettre le scroll horizontal */
#shot-data-table {
    width: 100%;
    min-width: auto; /* Pas de largeur minimum fixe, s'adapte au contenu */
    table-layout: auto; /* Largeur des colonnes s'adapte au contenu */
}

@media (max-width: 768px) {
    /* Wrapper avec scroll horizontal */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling sur iOS */
    }
    
    /* Permettre au tableau de se réduire */
    #shot-data-table {
        font-size: 0.875rem;
    }
    
    /* Abréger les titres de colonnes pour gagner de l'espace */
    #shot-data-table th[data-short]::before {
        content: attr(data-short);
    }
    
    #shot-data-table th[data-short] {
        font-size: 0;
    }
    
    #shot-data-table th[data-short]::before {
        font-size: 0.875rem;
    }
    
    /* Réduire le padding des cellules dans les tables de shot data */
    #shot-data-table td,
    #shot-data-table th {
        padding: 0.4rem 0.3rem;
        font-size: 0.875rem;
    }
    
    /* Réduire encore plus le padding pour la colonne Timestamp */
    #shot-data-table .timestamp-cell {
        padding: 0.4rem 0.2rem;
        white-space: nowrap;
    }
    
    /* Réduire la largeur des colonnes numériques */
    #shotDataBody td:nth-child(3), /* X */
    #shotDataBody td:nth-child(4), /* Y */
    #shotDataBody td:nth-child(5), /* Score */
    #shotDataBody td:nth-child(6), /* Target */
    #shotDataBody td:nth-child(7)  /* Duration */ {
        max-width: 60px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 480px) {
    /* Encore plus compact sur très petits écrans */
    #shot-data-table {
        font-size: 0.8125rem;
    }
    
    #shot-data-table td,
    #shot-data-table th {
        padding: 0.3rem 0.2rem;
        font-size: 0.8125rem;
    }
    
    /* Titres encore plus courts sur très petits écrans */
    #shot-data-table th[data-short]::before {
        font-size: 0.8125rem;
    }
    
    /* Padding minimal pour Timestamp sur très petits écrans */
    #shot-data-table .timestamp-cell {
        padding: 0.3rem 0.15rem;
    }
    
    /* Réduire davantage les colonnes numériques */
    #shotDataBody td:nth-child(3), /* X */
    #shotDataBody td:nth-child(4), /* Y */
    #shotDataBody td:nth-child(5), /* Score */
    #shotDataBody td:nth-child(6), /* Target */
    #shotDataBody td:nth-child(7)  /* Duration */ {
        max-width: 50px;
        padding: 0.3rem 0.15rem;
    }
    
    /* Style du Shot Style plus compact */
    #shotDataBody td:nth-child(2),
    #shot-data-table tbody td:nth-child(2) {
        max-width: 70px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Animations pour les composants */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert {
    animation: slideDown 0.3s ease-in-out;
}

/* Utilitaires d'espacement */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

/* Utilitaires de texte */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 600; }
.font-normal { font-weight: 400; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

/* Classes d'icônes Unicode */
.icon-refresh:before { content: '🔄'; }
.icon-plus:before { content: '➕'; }
.icon-edit:before { content: '✏️'; }
.icon-wifi:before { content: '📶'; }
.icon-trash:before { content: '🗑️'; }
.icon-tools:before { content: '🔧'; }

/* Alternative avec icônes plus simples */
.icon-refresh.simple:before { content: '↻'; }
.icon-plus.simple:before { content: '+'; }
.icon-edit.simple:before { content: '✎'; }
.icon-wifi.simple:before { content: '📡'; }
.icon-trash.simple:before { content: '×'; }
.icon-tools.simple:before { content: '⚙'; }


/* ============================================================
   MODE SÉRIE — Tableau target-management (data-context="cible")
   ============================================================ */

/* Ligne série: fond distinct, séparateur haut */
tr.series-row {
  background-color: var(--bg-secondary, #eef1f8);
  font-weight: 600;
  border-top: 2px solid var(--border-color, #cdd3db);
}
tr.series-row:hover {
  background-color: var(--bg-hover, #dde4f5);
  cursor: default;
}

/* Cellule de bascule déplié/replié */
.series-toggle-cell {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.series-toggle-cell:hover {
  color: var(--accent-color, #0d6efd);
}
.series-toggle {
  display: inline-block;
  width: 1em;
  text-align: center;
  transition: transform 0.12s ease;
  font-size: 0.8em;
  margin-right: 0.2em;
}

/* Masquage des tirs repliés */
tr.shot-row.series-collapsed {
  display: none;
}

/* Ligne tir individuel: légèrement dé-emphasisée */
tr.shot-row td {
  color: var(--text-secondary, #555);
}
tr.shot-row .shot-label-cell {
  font-weight: 500;
  color: var(--text-primary, #222);
  font-family: monospace;
}

/* Cellules de visibilité */
.series-vis-cell,
.shot-visibility-cell {
  text-align: center;
  width: 2rem;
  min-width: 2rem;
  padding: 0 2px;
}

/* Athlète en italique sur la ligne série */
.series-athlete-cell {
  font-style: italic;
  color: var(--text-secondary, #666);
  font-size: 0.9em;
}

/* Cellule hit (0 ou 1) — centré */
.hit-cell {
  text-align: center;
}
