// Rôle : définit les bases globales HTML, body, typographie et contrôles natifs.
* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

html {
  min-height: 100%;
  background: var(--color-bg-page);
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  color: var(--color-text-primary);
  background: var(--gradient-page);
  background-attachment: fixed;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
.button,
select,
input,
textarea,
.import-button {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(21, 26, 48, 0.92);
  color: var(--color-text-primary);
  font: inherit;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

button,
.button,
.import-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  cursor: pointer;
}

button:hover,
.button:hover,
.import-button:hover {
  border-color: rgba(196, 181, 253, 0.34);
  background:
    linear-gradient(135deg, rgba(31, 37, 68, 0.96), rgba(22, 26, 51, 0.96)) padding-box,
    linear-gradient(135deg, rgba(139, 92, 246, 0.32), rgba(196, 181, 253, 0.2)) border-box;
  box-shadow:
    0 0 14px rgba(139, 92, 246, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

button:active,
.button:active,
.import-button:active {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--color-accent-gold);
  outline-offset: 3px;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  width: 20px;
  min-width: 20px;
  max-width: 20px;
  inline-size: 20px;
  min-inline-size: 20px;
  max-inline-size: 20px;
  aspect-ratio: 1;
  height: 20px;
  min-height: 20px;
  max-height: 20px;
  block-size: 20px;
  min-block-size: 20px;
  max-block-size: 20px;
  place-content: center;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  line-height: 0;
  background:
    linear-gradient(135deg, rgba(27, 34, 66, 0.92), rgba(16, 20, 44, 0.94)) padding-box,
    linear-gradient(135deg, rgba(246, 196, 83, 0.5), rgba(139, 92, 246, 0.44)) border-box;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(5, 7, 17, 0.42);
  cursor: pointer;
}

input[type="checkbox"]::before {
  content: "";
  width: 11px;
  height: 11px;
  background: #fff;
  transform: scale(0);
  transition: transform var(--duration-fast) var(--ease-standard);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 18%, 84% 5%, 34% 68%);
}

input[type="checkbox"]:hover {
  border-color: rgba(246, 196, 83, 0.6);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 14px rgba(246, 196, 83, 0.14);
}

input[type="checkbox"]:checked {
  border-color: rgba(246, 196, 83, 0.88);
  background:
    linear-gradient(135deg, rgba(246, 196, 83, 0.96), rgba(139, 92, 246, 0.86)) padding-box,
    linear-gradient(135deg, var(--color-accent-gold), rgba(196, 181, 253, 0.88)) border-box;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 16px rgba(246, 196, 83, 0.2);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-accent-gold);
  outline-offset: 3px;
}

.themed-scrollbar,
.legacy-scrollbar {
  scrollbar-color: rgb(79, 26, 114) transparent;
  scrollbar-width: thin;
}

.filter-options::-webkit-scrollbar,
.drawer-panel::-webkit-scrollbar,
.damage-table-wrap::-webkit-scrollbar,
.themed-scrollbar::-webkit-scrollbar,
.legacy-scrollbar::-webkit-scrollbar {
  background-color: transparent;
  width: 6px;
  height: 6px;
  border-radius: 0;
}

.filter-options::-webkit-scrollbar-track,
.drawer-panel::-webkit-scrollbar-track,
.damage-table-wrap::-webkit-scrollbar-track,
.themed-scrollbar::-webkit-scrollbar-track,
.legacy-scrollbar::-webkit-scrollbar-track {
  background-color: transparent;
  border-radius: 0;
  box-shadow: none;
}

.filter-options::-webkit-scrollbar-thumb,
.drawer-panel::-webkit-scrollbar-thumb,
.damage-table-wrap::-webkit-scrollbar-thumb,
.themed-scrollbar::-webkit-scrollbar-thumb,
.legacy-scrollbar::-webkit-scrollbar-thumb {
  background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.5, rgb(79, 26, 114)), color-stop(1, rgb(44, 1, 135)));
  border-radius: 10px;
}

body.is-modal-open {
  overflow: hidden;
}

.startup-error {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.primary {
  border-color: rgba(246, 196, 83, 0.34);
  background:
    linear-gradient(135deg, rgba(72, 43, 160, 0.96), rgba(45, 52, 146, 0.94)) padding-box,
    linear-gradient(135deg, rgba(246, 196, 83, 0.66), rgba(139, 92, 246, 0.36)) border-box;
  box-shadow:
    0 8px 22px rgba(5, 7, 17, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 700;
}

.primary:hover {
  border-color: rgba(246, 196, 83, 0.72);
  background:
    linear-gradient(135deg, rgba(109, 40, 217, 0.98), rgba(67, 56, 202, 0.96)) padding-box,
    linear-gradient(135deg, rgba(246, 196, 83, 0.96), rgba(196, 181, 253, 0.68)) border-box;
  box-shadow:
    0 0 0 1px rgba(246, 196, 83, 0.16),
    0 0 18px rgba(139, 92, 246, 0.3),
    0 0 30px rgba(246, 196, 83, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--color-text-secondary);
}

.ghost:hover {
  border-color: rgba(196, 181, 253, 0.18);
  background: rgba(139, 92, 246, 0.08);
  color: var(--color-text-primary);
  box-shadow: none;
}

.danger {
  color: var(--color-danger);
}

.danger:hover {
  border-color: rgba(251, 113, 133, 0.48);
  background:
    linear-gradient(135deg, rgba(80, 25, 42, 0.72), rgba(48, 18, 34, 0.82)) padding-box,
    linear-gradient(135deg, rgba(251, 113, 133, 0.56), rgba(196, 181, 253, 0.16)) border-box;
  color: #fff;
  box-shadow:
    0 0 14px rgba(251, 113, 133, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

:is(
  .sidebar-action-button,
  .import-icon-button,
  .toolbox-icon-button,
  .card-icon-button,
  .drawer-action-button,
  .drawer-close-button,
  .filter-reset-button,
  .image-viewer-button,
  .module-edit-button,
  .module-delete-button,
  .image-annotate-button,
  .image-delete-button,
  .checklist-delete-button,
  .tool-quick-add-button
) {
  display: inline-flex;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(21, 26, 48, 0.88);
  color: var(--color-text-primary);
  font: inherit;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

:is(
  .sidebar-action-button,
  .import-icon-button,
  .toolbox-icon-button,
  .card-icon-button,
  .drawer-action-button,
  .drawer-close-button,
  .filter-reset-button,
  .image-viewer-button,
  .module-edit-button,
  .module-delete-button,
  .image-annotate-button,
  .image-delete-button,
  .checklist-delete-button,
  .tool-quick-add-button
) .ui-icon {
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    filter var(--duration-fast) var(--ease-standard);
}

:is(
  .sidebar-action-button,
  .import-icon-button,
  .toolbox-icon-button,
  .card-icon-button,
  .drawer-action-button,
  .drawer-close-button,
  .filter-reset-button,
  .image-viewer-button,
  .module-edit-button,
  .module-delete-button,
  .image-annotate-button,
  .image-delete-button,
  .checklist-delete-button,
  .tool-quick-add-button
):hover {
  border-color: rgba(196, 181, 253, 0.32);
  background:
    linear-gradient(135deg, rgba(31, 37, 68, 0.94), rgba(18, 22, 44, 0.96)) padding-box,
    linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(196, 181, 253, 0.2)) border-box;
  color: #ddd6fe;
  box-shadow:
    0 0 12px rgba(139, 92, 246, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:is(
  .sidebar-action-button,
  .import-icon-button,
  .toolbox-icon-button,
  .card-icon-button,
  .drawer-action-button,
  .drawer-close-button,
  .filter-reset-button,
  .image-viewer-button,
  .module-edit-button,
  .module-delete-button,
  .image-annotate-button,
  .image-delete-button,
  .tool-quick-add-button
).primary {
  border-color: rgba(246, 196, 83, 0.34);
  background:
    linear-gradient(135deg, rgba(72, 43, 160, 0.96), rgba(45, 52, 146, 0.94)) padding-box,
    linear-gradient(135deg, rgba(246, 196, 83, 0.66), rgba(139, 92, 246, 0.36)) border-box;
  color: #fff;
  box-shadow:
    0 8px 22px rgba(5, 7, 17, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:is(
  .sidebar-action-button,
  .import-icon-button,
  .toolbox-icon-button,
  .card-icon-button,
  .drawer-action-button,
  .drawer-close-button,
  .filter-reset-button,
  .image-viewer-button,
  .module-edit-button,
  .module-delete-button,
  .image-annotate-button,
  .image-delete-button,
  .tool-quick-add-button
).primary:hover {
  border-color: rgba(246, 196, 83, 0.72);
  background:
    linear-gradient(135deg, rgba(109, 40, 217, 0.98), rgba(67, 56, 202, 0.96)) padding-box,
    linear-gradient(135deg, rgba(246, 196, 83, 0.96), rgba(196, 181, 253, 0.68)) border-box;
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(246, 196, 83, 0.16),
    0 0 18px rgba(139, 92, 246, 0.3),
    0 0 30px rgba(246, 196, 83, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

:is(
  .sidebar-action-button,
  .import-icon-button,
  .toolbox-icon-button,
  .card-icon-button,
  .drawer-action-button,
  .drawer-close-button,
  .filter-reset-button,
  .image-viewer-button,
  .module-edit-button,
  .module-delete-button,
  .image-annotate-button,
  .image-delete-button,
  .checklist-delete-button,
  .tool-quick-add-button
):hover .ui-icon {
  background-color: #c4b5fd;
  filter: drop-shadow(0 0 6px rgba(196, 181, 253, 0.28));
}

:is(.card-icon-button, .module-delete-button, .image-delete-button, .checklist-delete-button).danger {
  border-color: rgba(251, 113, 133, 0.2);
  color: var(--color-danger);
}

:is(.card-icon-button, .module-delete-button, .image-delete-button, .checklist-delete-button).danger:hover {
  border-color: rgba(251, 113, 133, 0.56);
  background:
    linear-gradient(135deg, rgba(80, 25, 42, 0.72), rgba(48, 18, 34, 0.82)) padding-box,
    linear-gradient(135deg, rgba(251, 113, 133, 0.56), rgba(196, 181, 253, 0.16)) border-box;
  color: #fff;
  box-shadow:
    0 0 14px rgba(251, 113, 133, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

:is(.card-icon-button, .module-delete-button, .image-delete-button, .checklist-delete-button).danger:hover .ui-icon {
  background-color: #fff;
  filter: drop-shadow(0 0 6px rgba(251, 113, 133, 0.26));
}
