/* Styles personnalisés AG-Grid pour Diata */
/* Couleurs et thème adaptés à l'identité visuelle Diata */

.ag-theme-alpine {
  --ag-alpine-active-color: rgb(59 130 246);
  --ag-border-color: rgb(229 231 235);
  --ag-header-background-color: rgb(249 250 251);
  --ag-header-foreground-color: rgb(55 65 81);
  --ag-row-hover-color: rgb(249 250 251);
  --ag-selected-row-background-color: rgb(239 246 255);
  --ag-font-size: 14px;
  --ag-font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* Headers avec style Diata */
.ag-theme-alpine .ag-header {
  border-bottom: 2px solid rgb(229 231 235);
  background: linear-gradient(to bottom, rgb(249 250 251), rgb(243 244 246));
}

.ag-theme-alpine .ag-header-cell-text {
  font-weight: 500;
  text-transform: uppercase;
  font-size: 12px;
  color: rgb(107 114 128);
  letter-spacing: 0.025em;
}

/* Rows avec alternance subtile */
.ag-theme-alpine .ag-row-even {
  background-color: rgb(255 255 255);
}

.ag-theme-alpine .ag-row-odd {
  background-color: rgb(249 250 251);
}

/* Hover states */
.ag-theme-alpine .ag-row-hover {
  background-color: rgb(243 244 246) !important;
}

/* Focus et sélection */
.ag-theme-alpine .ag-cell-focus {
  border: 2px solid rgb(59 130 246) !important;
  border-radius: 4px;
}

.ag-theme-alpine .ag-cell-range-selected-1 {
  background-color: rgba(59, 130, 246, 0.1) !important;
}

/* Styles des erreurs - Rouge pour UNIQUE */
.cell-error-unique {
  background-color: rgb(254 242 242) !important;
  border: 1px solid rgb(252 165 165) !important;
  color: rgb(153 27 27) !important;
  font-weight: 500;
}

.cell-error-unique:hover {
  background-color: rgb(252 232 232) !important;
}

/* Styles des erreurs - Orange pour CHECK */
.cell-error-check {
  background-color: rgb(255 247 237) !important;
  border: 1px solid rgb(253 186 116) !important;
  color: rgb(154 52 18) !important;
  font-weight: 500;
}

.cell-error-check:hover {
  background-color: rgb(254 243 199) !important;
}

/* Styles des cellules valides - Vert */
.cell-valid {
  background-color: rgb(240 253 244) !important;
  border: 1px solid rgb(167 243 208) !important;
  color: rgb(21 128 61) !important;
  font-weight: 500;
}

.cell-valid:hover {
  background-color: rgb(220 252 231) !important;
}

/* Tooltips personnalisés */
.ag-tooltip {
  background: rgb(17 24 39) !important;
  color: white !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  max-width: 320px !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
  font-family: ui-sans-serif, system-ui, sans-serif !important;
  z-index: 1000 !important;
}

/* Pagination */
.ag-theme-alpine .ag-paging-panel {
  border-top: 1px solid rgb(229 231 235);
  background-color: rgb(249 250 251);
  padding: 12px 16px;
}

/* Loading overlay */
.ag-theme-alpine .ag-overlay-loading-wrapper {
  background-color: rgba(255, 255, 255, 0.9);
}

.ag-theme-alpine .ag-overlay-loading-center {
  background-color: white;
  border: 1px solid rgb(229 231 235);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Filtres dans les headers */
.ag-theme-alpine .ag-header-cell-menu-button {
  color: rgb(107 114 128);
}

.ag-theme-alpine .ag-header-cell-menu-button:hover {
  color: rgb(59 130 246);
}

/* Scrollbars personnalisées */
.ag-theme-alpine .ag-body-horizontal-scroll::-webkit-scrollbar,
.ag-theme-alpine .ag-body-vertical-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.ag-theme-alpine .ag-body-horizontal-scroll::-webkit-scrollbar-track,
.ag-theme-alpine .ag-body-vertical-scroll::-webkit-scrollbar-track {
  background: rgb(249 250 251);
}

.ag-theme-alpine .ag-body-horizontal-scroll::-webkit-scrollbar-thumb,
.ag-theme-alpine .ag-body-vertical-scroll::-webkit-scrollbar-thumb {
  background: rgb(209 213 219);
  border-radius: 4px;
}

.ag-theme-alpine .ag-body-horizontal-scroll::-webkit-scrollbar-thumb:hover,
.ag-theme-alpine .ag-body-vertical-scroll::-webkit-scrollbar-thumb:hover {
  background: rgb(156 163 175);
}

/* Animation pour les cellules qui changent */
.ag-theme-alpine .ag-cell-data-changed {
  background-color: rgb(254 249 195) !important;
}

.ag-theme-alpine .ag-cell-data-changed-animation {
  transition: background-color 1s;
}

/* Container principal avec bordures arrondies */
.diata-grid-container {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgb(229 231 235);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Responsive design pour mobile */
@media (max-width: 768px) {
  .ag-theme-alpine {
    --ag-font-size: 12px;
  }
  
  .ag-theme-alpine .ag-header-cell-text {
    font-size: 11px;
  }
}