/* Dark mode activé automatiquement selon les préférences système */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1C2022;
    color: #e4e4e7;
  }

  .swagger-ui {
    background-color: #1C2022;
    color: #e4e4e7;
  }

  /* Topbar */
  .swagger-ui .topbar {
    background-color: #1C2022;
  }

  /* Containers */
  .swagger-ui .wrapper {
    background-color: #1C2022;
  }

  /* Info section - description en haut */
  .swagger-ui .info {
    background-color: #1C2022;
  }

  .swagger-ui .info .description {
    background-color: #1C2022;
  }

  /* Textes */
  .swagger-ui .info h1,
  .swagger-ui .info h2 {
    color: #f1f5f9;
  }

  .swagger-ui .info p,
  .swagger-ui .info .description p,
  .swagger-ui .info .description li,
  .swagger-ui .markdown p,
  .swagger-ui .opblock-description-wrapper p {
    color: #cbd5e1 !important;
  }

  /* Description - renderedMarkdown */
  .swagger-ui .info .renderedMarkdown,
  .swagger-ui .info .renderedMarkdown pre,
  .swagger-ui .info .renderedMarkdown code {
    background-color: #1C2022 !important;
    color: #cbd5e1 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  /* Liens */
  .swagger-ui a {
    color: #60a5fa;
  }
  .swagger-ui a:visited {
    color: #a78bfa;
  }

  /* Tags et sections */
  .swagger-ui .opblock-tag {
    color: #f1f5f9;
    border-bottom-color: #374151;
  }

  .swagger-ui .opblock-tag-section {
    background-color: #1C2022;
  }

  /* Opblocks - fond sombre adapté */
  .swagger-ui .opblock {
    background-color: #0f172a;
    border: 1px solid #374151;
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.4);
  }

  .swagger-ui .opblock.opblock-get {
    border-left: 5px solid #61affe;
    background-color: rgba(97, 175, 254, 0.05);
  }

  .swagger-ui .opblock.opblock-post {
    border-left: 5px solid #49cc90;
    background-color: rgba(73, 204, 144, 0.05);
  }

  .swagger-ui .opblock.opblock-put {
    border-left: 5px solid #fca130;
    background-color: rgba(252, 161, 48, 0.05);
  }

  .swagger-ui .opblock.opblock-delete {
    border-left: 5px solid #f93e3e;
    background-color: rgba(249, 62, 62, 0.05);
  }

  .swagger-ui .opblock .opblock-summary-description {
    color: #cbd5e1;
  }

  .swagger-ui .opblock-body {
    background-color: #0a0f1e;
  }

  /* Paramètres et tableaux */
  .swagger-ui table thead tr td,
  .swagger-ui table thead tr th {
    color: #f1f5f9;
    border-bottom: 1px solid #374151;
  }

  .swagger-ui .parameter__name,
  .swagger-ui .parameter__type {
    color: #e879f9;
  }

  .swagger-ui .parameter__name.required::after {
    color: #f87171;
  }

  .swagger-ui table tbody tr td {
    color: #cbd5e1;
    border-color: #374151;
  }

  /* Inputs et selects */
  .swagger-ui select,
  .swagger-ui input[type=text],
  .swagger-ui input[type=password],
  .swagger-ui input[type=email],
  .swagger-ui textarea {
    background-color: #0f172a;
    color: #e4e4e7;
    border: 1px solid #4b5563;
  }

  .swagger-ui select:focus,
  .swagger-ui input[type=text]:focus,
  .swagger-ui textarea:focus {
    border-color: #60a5fa;
  }

  /* Responses */
  .swagger-ui .response-col_status {
    color: #f1f5f9;
  }

  .swagger-ui .response-col_description {
    color: #cbd5e1;
  }

  .swagger-ui .responses-inner h4,
  .swagger-ui .responses-inner h5 {
    color: #f1f5f9;
  }

  /* Tabs */
  .swagger-ui .tab li {
    color: #cbd5e1;
  }

  .swagger-ui .tab li.active {
    background-color: #0f172a;
    color: #f1f5f9;
  }

  /* Models (si affichés) */
  .swagger-ui .model-box {
    background-color: #0f172a;
  }

  .swagger-ui .model-title {
    color: #f1f5f9;
  }

  .swagger-ui .model {
    color: #cbd5e1;
  }

  /* Highlight - JSON */
  .swagger-ui .highlight-code {
    background-color: #0a0f1e;
  }

  .swagger-ui .microlight {
    color: #cbd5e1;
  }

  /* Authorization modal */
  .swagger-ui .modal-ux {
    background-color: rgba(0, 0, 0, 0.8);
  }

  .swagger-ui .modal-ux-content {
    background-color: #1C2022;
    border: 1px solid #374151;
  }

  .swagger-ui .modal-ux-header h3 {
    color: #f1f5f9;
  }

  /* Schéma server selector */
  .swagger-ui .scheme-container {
    background-color: #1C2022;
    box-shadow: none;
  }

  .swagger-ui .servers > label {
    color: #f1f5f9;
  }

  .swagger-ui .servers select {
    background-color: #0f172a;
    color: #e4e4e7;
    border: 1px solid #4b5563;
  }
}
