/* Styles personnalisés pour l'application Feuille de Tir */

:root {
  --cell-border: #334155; /* slate-700 */
  --cell-bg: #0f172a;     /* slate-900 */
  --cell-bg-alt: #111827; /* slate-900 légèrement plus clair */
  --header-bg: #1e293b;   /* slate-800 */
  --header-fg: #94a3b8;   /* slate-400 */
  --cell-hover: #1e293b;
  --cell-edit: #312e81;   /* indigo-900 */
}

html, body {
  min-width: 1024px;
}

body {
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
}

/* Grille Excel-like */
.excel-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: 'Inter', system-ui, sans-serif;
  table-layout: fixed;
}

.excel-grid th,
.excel-grid td {
  border: 1px solid var(--cell-border);
  padding: 0;
  vertical-align: middle;
  background: var(--cell-bg);
  min-width: 90px;
  height: 30px;
}

/* En-tête colonnes (A, B, C...) */
.excel-grid thead th {
  background: var(--header-bg);
  color: var(--header-fg);
  font-weight: 600;
  font-size: 12px;
  text-align: center;
  padding: 6px 8px;
  position: sticky;
  top: 0;
  z-index: 3;
  letter-spacing: 0.5px;
}

/* Colonne des numéros de ligne (la toute première) */
.excel-grid th.row-header,
.excel-grid td.row-header {
  background: var(--header-bg);
  color: var(--header-fg);
  font-weight: 600;
  font-size: 11px;
  text-align: center;
  min-width: 48px;
  width: 48px;
  position: sticky;
  left: 0;
  z-index: 2;
  user-select: none;
}
.excel-grid thead th.row-header {
  z-index: 4;
}

/* Cellules éditables */
.excel-grid td .cell {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 30px;
  padding: 6px 10px;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
  color: #e2e8f0;
}

.excel-grid td .cell:hover {
  background: var(--cell-hover);
}

.excel-grid td .cell:focus {
  background: var(--cell-edit);
  outline: 2px solid #6366f1;
  outline-offset: -2px;
  white-space: normal;
  overflow: visible;
  z-index: 5;
  position: relative;
}

/* Lignes d'en-tête utilisateur (ligne 1) */
.excel-grid tr.row-header-user td:not(.row-header) {
  background: #1e293b;
  font-weight: 600;
  color: #f1f5f9;
}

/* Cellules spéciales (ex. K1 pour la date) */
.excel-grid td.special-cell {
  background: #164e63;
}

/* Onglets */
.tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  margin-bottom: -1px;
}
.tab-btn:hover {
  color: #e2e8f0;
  background: rgba(99, 102, 241, 0.08);
}
.tab-btn.active {
  color: #a5b4fc;
  border-bottom-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}

/* Boutons d'actions */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.action-btn-primary {
  background: #4f46e5;
  color: white;
}
.action-btn-primary:hover { background: #4338ca; }

.action-btn-success {
  background: #059669;
  color: white;
}
.action-btn-success:hover { background: #047857; }

.action-btn-secondary {
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.3);
}
.action-btn-secondary:hover { background: rgba(99, 102, 241, 0.2); }

.action-btn-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.3);
}
.action-btn-warning:hover { background: rgba(245, 158, 11, 0.2); }

.action-btn-danger {
  background: rgba(244, 63, 94, 0.1);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
}
.action-btn-danger:hover { background: rgba(244, 63, 94, 0.2); }

/* Badges de compteur */
.counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Label champ date */
.date-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: rgba(14, 116, 144, 0.2);
  border: 1px solid rgba(14, 116, 144, 0.4);
  border-radius: 8px;
  font-size: 13px;
  color: #67e8f9;
}
.date-field input {
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
}

/* Toast */
.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 10px;
  min-width: 240px;
  max-width: 360px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s ease;
}

/* Recherche par référence - mise en surbrillance */
tr.bdc-search-highlight {
  background-color: rgba(34, 197, 94, 0.25) !important;
  box-shadow: inset 0 0 6px rgba(34, 197, 94, 0.4);
  border-left: 3px solid rgb(34, 197, 94);
  position: relative;
}

tr.bdc-search-highlight td {
  background-color: transparent !important;
}

/* Cacher les lignes qui ne correspondent pas à la recherche */
tr.bdc-search-hidden {
  display: none;
}
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.success { background: rgba(5, 150, 105, 0.95); color: white; }
.toast.error   { background: rgba(220, 38, 38, 0.95); color: white; }
.toast.info    { background: rgba(79, 70, 229, 0.95); color: white; }

/* Scrollbars sombres */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Texte aligné à gauche (colonne C dans Feuille de Tir) */
.align-left .cell { text-align: left; }
.align-center .cell { text-align: center; }

/* Limite hauteur grille */
#grid-container { max-height: calc(100vh - 200px); }
