/* ===========================================================
   TD Design Engine — Plugin Styles
   =========================================================== */

/* ── Panel ──────────────────────────────────────────────── */
#td-design-engine {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 99999;
  background: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 16px 16px 12px;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  width: 290px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border: 1px solid #e6e1ff;
  max-height: 88vh;
  overflow-y: auto;
  transition: all 0.3s ease;
  font-size: 12px;
  line-height: 1.4;
  color: #333;
}

/* ── Header ─────────────────────────────────────────────── */
.tdde-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.tdde-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.tdde-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#btn-toggle-minimize {
  background: none;
  border: 1px solid #e6e1ff;
  color: #6145ff;
  font-size: 15px;
  cursor: pointer;
  font-weight: bold;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

/* ── Tabs ───────────────────────────────────────────────── */
.tdde-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e6e1ff;
}

.tdde-tab {
  flex: 1;
  padding: 8px 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-align: center;
  cursor: pointer;
  border: none;
  background: #f5f3ff;
  color: #7c6fc2;
  transition:
    background 0.2s,
    color 0.2s;
}

.tdde-tab:hover {
  background: #ede9ff;
}

.tdde-tab-active {
  background: #0d0c54;
  color: #fff;
}

/* ── FAB ────────────────────────────────────────────────── */
#td-design-fab {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 99999;
  background: #6145ff;
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(97, 69, 255, 0.4);
  cursor: pointer;
  font-family: sans-serif;
  font-size: 18px;
  font-weight: 900;
  align-items: center;
  justify-content: center;
  border: none;
  transition: transform 0.2s;
}

#td-design-fab:hover {
  transform: scale(1.08);
}

/* ── Toggle switches ────────────────────────────────────── */
.td-toggle {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 16px;
  flex-shrink: 0;
}

.td-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.td-toggle-track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  border-radius: 20px;
  transition: background-color 0.25s;
}

.td-toggle-track::before {
  content: "";
  position: absolute;
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
}

.td-toggle input:checked + .td-toggle-track::before {
  transform: translateX(14px);
}

/* ── Accordions ─────────────────────────────────────────── */
.td-accordion {
  margin-bottom: 6px;
  border: 1px solid #e6e1ff;
  border-radius: 12px;
  overflow: hidden;
}

.td-acc-trigger {
  width: 100%;
  background: #f5f3ff;
  border: none;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 900;
  color: #0d0c54;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s;
}

.td-acc-trigger:hover {
  background: #ede9ff;
}

.td-acc-arrow {
  font-size: 12px;
  color: #9e95c7;
  transition: transform 0.25s;
}

.td-accordion.td-acc-open .td-acc-arrow {
  transform: rotate(180deg);
}

.td-acc-body {
  display: none;
  padding: 12px 14px 14px;
  background: #fff;
}

.td-accordion.td-acc-open .td-acc-body {
  display: block;
}

/* ── Common UI blocks ───────────────────────────────────── */
.tdde-section {
  margin-bottom: 10px;
}

.tdde-label {
  font-size: 10px;
  font-weight: 800;
  color: #4b5563;
  display: block;
  margin-bottom: 5px;
}

.tdde-label-sm {
  font-size: 9px;
  font-weight: bold;
  color: #666;
}

.tdde-label-title {
  font-size: 9px;
  font-weight: 900;
  color: #0d0c54;
  letter-spacing: 0.5px;
}

.tdde-label-muted {
  font-size: 9px;
  font-weight: 900;
  color: #aaa;
  letter-spacing: 0.5px;
  display: block;
}

.tdde-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tdde-targets-box {
  background: #f9f9ff;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid #e6e1ff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tdde-box {
  background: #f9f9ff;
  border-radius: 10px;
  padding: 12px;
  border: 1px solid #e6e1ff;
}

.tdde-sliders-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9f9ff;
  padding: 12px;
  border-radius: 10px;
}

.tdde-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tdde-slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-weight: bold;
  color: #666;
}

.tdde-separator-top {
  border-top: 1px solid #e6e1ff;
  padding-top: 10px;
}

.tdde-shadow-options {
  display: none;
  flex-direction: column;
  gap: 10px;
}

/* ── Selects ────────────────────────────────────────────── */
#td-design-engine select {
  width: 100%;
  padding: 8px;
  font-size: 11px;
  border-radius: 8px;
  border: 1px solid #e6e1ff;
  background: #f9f9ff;
}

/* ── Color pickers ──────────────────────────────────────── */
#td-design-engine input[type="color"] {
  width: 34px;
  height: 34px;
  border: none;
  cursor: pointer;
  background: none;
  padding: 0;
  border-radius: 6px;
}

/* ── Range inputs ───────────────────────────────────────── */
#td-design-engine input[type="range"] {
  width: 100%;
  cursor: pointer;
}

/* ── Buttons ────────────────────────────────────────────── */
.tdde-btn-dashed {
  width: 100%;
  background: transparent;
  border: 1.5px dashed #c7c0f0;
  color: #6145ff;
  padding: 7px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  margin-top: 10px;
  transition: all 0.2s;
}

.tdde-actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tdde-btn-reset {
  width: 100%;
  background: none;
  border: 1.5px solid #ffdddd;
  color: #ff4545;
  padding: 9px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.tdde-btn-primary {
  width: 100%;
  background: #0d0c54;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 10px;
  font-weight: bold;
}

/* ── Color slots ────────────────────────────────────────── */
.td-color-slot {
  background: #f9f9ff;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid #e6e1ff;
  margin-bottom: 8px;
}

.td-color-slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.td-color-slot-label {
  font-size: 9px;
  font-weight: 900;
  color: #4b5563;
  letter-spacing: 0.5px;
}

.td-color-slot-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.td-color-picker {
  width: 28px;
  height: 28px;
  border: none;
  cursor: pointer;
  background: none;
  border-radius: 6px;
  padding: 0;
}

.td-color-remove {
  background: none;
  border: none;
  color: #ff4545;
  font-size: 10px;
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
  padding: 2px 4px;
}

.td-color-targets {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid #e6e1ff;
}

.td-color-target-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.td-color-target-label {
  font-size: 9px;
  font-weight: bold;
  color: #666;
}

/* ── Contrast panel ─────────────────────────────────────── */
.tdde-contrast-panel {
  background: #f9f9ff;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid #e6e1ff;
  margin-top: 10px;
}

.tdde-contrast-header {
  margin-bottom: 8px;
}

.tdde-contrast-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 10px;
}

.tdde-contrast-row + .tdde-contrast-row {
  border-top: 1px solid #eee;
}

.tdde-contrast-label {
  font-weight: 600;
  color: #555;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tdde-contrast-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.tdde-contrast-value {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tdde-contrast-ratio {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tdde-contrast-badge {
  font-size: 8px;
  font-weight: 900;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.tdde-badge-aaa {
  background: #d1fae5;
  color: #065f46;
}

.tdde-badge-aa {
  background: #dbeafe;
  color: #1e40af;
}

.tdde-badge-fail {
  background: #fee2e2;
  color: #991b1b;
}

/* ── Accessibility panel ────────────────────────────────── */
.tdde-a11y-intro {
  text-align: center;
  padding: 12px 0 8px;
}

.tdde-a11y-global-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.tdde-a11y-score-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  background: #94a3b8;
  transition: background 0.3s;
}

.tdde-a11y-score-label {
  font-size: 10px;
  font-weight: 700;
  color: #666;
}

.tdde-a11y-note {
  font-size: 9px;
  color: #888;
  line-height: 1.4;
  padding: 0 8px;
  margin: 0;
}

.tdde-a11y-cat {
  margin-bottom: 6px;
  border: 1px solid #e6e1ff;
  border-radius: 12px;
  overflow: hidden;
}

.tdde-a11y-cat-header {
  width: 100%;
  background: #f5f3ff;
  border: none;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}

.tdde-a11y-cat-header:hover {
  background: #ede9ff;
}

.tdde-a11y-cat-title {
  font-size: 10px;
  font-weight: 900;
  color: #0d0c54;
  letter-spacing: 0.5px;
}

.tdde-a11y-cat-score-badge {
  font-size: 9px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.tdde-a11y-cat-body {
  display: none;
  padding: 10px 14px;
  background: #fff;
}

.tdde-a11y-cat.tdde-a11y-cat-open .tdde-a11y-cat-body {
  display: block;
}

.tdde-a11y-criterion {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 6px 0;
  gap: 8px;
}

.tdde-a11y-criterion + .tdde-a11y-criterion {
  border-top: 1px solid #f0eeff;
}

.tdde-a11y-crit-text {
  font-size: 9px;
  color: #555;
  line-height: 1.5;
  flex: 1;
}

.tdde-a11y-crit-ref {
  font-weight: 700;
  color: #0d0c54;
}

.tdde-a11y-crit-status {
  font-size: 8px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.tdde-status-pass {
  background: #d1fae5;
  color: #065f46;
}

.tdde-status-warn {
  background: #fef3c7;
  color: #92400e;
}

.tdde-status-fail {
  background: #fee2e2;
  color: #991b1b;
}

.tdde-status-na {
  background: #f1f5f9;
  color: #64748b;
}

/* ── Shadow body classes ────────────────────────────────── */
body.td-shadow-cards [id^="e-n-tab-content-"],
body.td-shadow-cards .card,
body.td-shadow-cards [class*="bento-"],
body.td-shadow-cards .td-value-card,
body.td-shadow-cards .td-process-step {
  box-shadow: var(--td-shadow) !important;
}

body.td-shadow-images
  .elementor-widget-image
  > img:not(.card img):not(.card *) {
  box-shadow: var(--td-shadow) !important;
}

body.td-shadow-buttons .elementor-button {
  box-shadow: var(--td-shadow) !important;
}

body.td-links-colored p > a,
body.td-links-colored strong > a,
body.td-links-colored b > a,
body.td-links-colored li > a {
  color: var(--td-link-color, #6145ff) !important;
}

/* ── Visual style selector ──────────────────────────────── */
.tdde-visual-style-fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.tdde-visual-style-fieldset legend {
  margin-bottom: 8px;
}

.tdde-visual-style-group {
  display: flex;
  gap: 6px;
}

.tdde-style-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1.5px solid #e6e1ff;
  background: #f9f9ff;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}

.tdde-style-option:hover {
  background: #ede9ff;
}

.tdde-style-option-active {
  border-color: var(--td-accent, #6145ff);
  background: #fff;
  box-shadow: 0 0 0 1px var(--td-accent, #6145ff);
}

.tdde-style-option-icon {
  font-size: 18px;
  line-height: 1;
}

.tdde-style-option-label {
  font-size: 9px;
  font-weight: 800;
  color: #4b5563;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.tdde-style-option-active .tdde-style-option-label {
  color: var(--td-accent, #6145ff);
}

.tdde-visual-style-hint {
  font-size: 9px;
  color: #999;
  line-height: 1.5;
  margin: 10px 0 0;
}

.tdde-visual-style-hint code {
  background: #f0eeff;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 8px;
}

/* ── Dynamic style image transitions ───────────────────── */
.dynamic-style-img img {
  transition:
    filter 0.3s ease,
    opacity 0.3s ease;
}

/* ── CVD — Bannière d'état persistante ──────────────────── */
.tdde-cvd-banner {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px 7px 12px;
  border-radius: 10px;
  background: #faf5ff;
  border: 1px solid #ddd6fe;
  border-left: 3px solid #7c3aed;
  margin-bottom: 8px;
}

.tdde-cvd-banner-hidden {
  display: none;
}

.tdde-cvd-banner[data-cvd="protanopia"] {
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: #b45309;
}
.tdde-cvd-banner[data-cvd="tritanopia"] {
  background: #eff6ff;
  border-color: #bfdbfe;
  border-left-color: #1d4ed8;
}
.tdde-cvd-banner[data-cvd="achromatopsia"] {
  background: #f9fafb;
  border-color: #e5e7eb;
  border-left-color: #4b5563;
}

.tdde-cvd-banner-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7c3aed;
  flex-shrink: 0;
  animation: tdde-pulse 2s infinite;
}

.tdde-cvd-banner[data-cvd="protanopia"] .tdde-cvd-banner-dot {
  background: #b45309;
}
.tdde-cvd-banner[data-cvd="tritanopia"] .tdde-cvd-banner-dot {
  background: #1d4ed8;
}
.tdde-cvd-banner[data-cvd="achromatopsia"] .tdde-cvd-banner-dot {
  background: #4b5563;
}

@keyframes tdde-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.tdde-cvd-banner-text {
  flex: 1;
  font-size: 9px;
  font-weight: 800;
  color: #374151;
  letter-spacing: 0.3px;
}

.tdde-cvd-banner-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  transition:
    color 0.15s,
    background 0.15s;
}

.tdde-cvd-banner-close:hover {
  color: #374151;
  background: rgba(0, 0, 0, 0.06);
}

/* ── CVD — Boutons radio ────────────────────────────────── */
.tdde-cvd-fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.tdde-cvd-fieldset legend {
  margin-bottom: 8px;
}

.tdde-cvd-group {
  display: grid;
  gap: 5px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 10px;
}

.tdde-cvd-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1.5px solid #e6e1ff;
  background: #f9f9ff;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}

.tdde-cvd-option:hover {
  background: #ede9ff;
}

.tdde-cvd-active {
  border-color: #7c3aed;
  background: #fff;
  box-shadow: 0 0 0 1px #7c3aed;
}

.tdde-cvd-icon {
  font-size: 16px;
  line-height: 1;
}

.tdde-cvd-label {
  font-size: 8px;
  font-weight: 800;
  color: #4b5563;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.tdde-cvd-active .tdde-cvd-label {
  color: #7c3aed;
}

/* ── CVD — Description + intro ──────────────────────────── */
.tdde-cvd-intro {
  font-size: 9px;
  color: #888;
  line-height: 1.5;
  margin: 0 0 10px;
}

.tdde-cvd-desc {
  font-size: 9px;
  color: #555;
  line-height: 1.5;
  margin: 0 0 8px;
  padding: 7px 10px;
  background: #f5f3ff;
  border-radius: 8px;
  border-left: 2px solid #c4b5fd;
}

/* ── CVD — Aperçu miniature palette ─────────────────────── */
.tdde-cvd-preview-wrap {
  background: #f9f9ff;
  border: 1px solid #e6e1ff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.tdde-cvd-preview-hidden {
  display: none;
}

.tdde-cvd-preview-header {
  display: flex;
  padding-left: 74px;
  margin-bottom: 6px;
}

.tdde-cvd-preview-col-label {
  flex: 1;
  font-size: 8px;
  font-weight: 800;
  color: #9ca3af;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-align: center;
}

.tdde-cvd-preview-swatches {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tdde-cvd-preview-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tdde-cvd-preview-name {
  font-size: 8px;
  font-weight: 700;
  color: #6b7280;
  width: 62px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tdde-cvd-preview-swatch {
  width: 28px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  position: relative;
  display: inline-block;
}

.tdde-cvd-preview-arrow {
  font-size: 9px;
  color: #d1d5db;
  flex-shrink: 0;
  line-height: 1;
}

/* Point indicateur de delta perceptible */
.tdde-cvd-preview-changed {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  border: 1.5px solid #fff;
  display: block;
}

/* ── CVD — Tableau d'analyse des contrastes ─────────────── */
.tdde-cvd-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.tdde-cvd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 0;
  border-top: 1px solid #f0eeff;
}

.tdde-cvd-row:first-child {
  border-top: none;
}

.tdde-cvd-swatches {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tdde-cvd-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.tdde-cvd-arrow {
  font-size: 9px;
  color: #d1d5db;
  line-height: 1;
}

.tdde-cvd-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.tdde-cvd-color-label {
  font-size: 8px;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tdde-cvd-ratio {
  font-size: 8px;
  color: #6b7280;
}

.tdde-cvd-ratio strong {
  font-weight: 800;
  color: #374151;
}

/* ── CVD — États vides / avertissement ──────────────────── */
.tdde-cvd-no-data {
  font-size: 9px;
  color: #9ca3af;
  text-align: center;
  padding: 8px 0;
  margin: 0;
}

.tdde-cvd-warning {
  font-size: 8px;
  color: #92400e;
  background: #fef3c7;
  border-radius: 6px;
  padding: 6px 8px;
  margin: 6px 0 0;
  line-height: 1.5;
  border-left: 2px solid #f59e0b;
}
