/* AlphaMed v5 visual typography + position editor
   Activated only when the page URL contains ?typeedit=1. */

html.type-editor-active {
  scroll-padding-bottom: 220px;
}

.type-editor-launcher,
.type-editor-panel,
.type-editor-size-chip,
.type-editor-toast {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.type-editor-launcher {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 100000;
  min-width: 112px;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  padding: 9px 15px;
  background: #0d2943;
  color: #fff;
  box-shadow: 0 10px 30px rgba(13,41,67,.2);
  cursor: pointer;
  font-size: 14px !important;
  font-weight: 750;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

.type-editor-launcher:hover { background: #123b60; }
.type-editor-launcher:focus-visible,
.type-editor-panel button:focus-visible,
.type-editor-panel input:focus-visible,
.type-editor-panel textarea:focus-visible {
  outline: 3px solid rgba(219,67,93,.28);
  outline-offset: 2px;
}

.type-editor-panel {
  position: fixed;
  left: 18px;
  bottom: 74px;
  z-index: 100000;
  width: min(480px, calc(100vw - 36px));
  border: 1px solid rgba(13,41,67,.16);
  border-radius: 18px;
  background: rgba(255,255,255,.98);
  color: #12263a;
  box-shadow: 0 18px 55px rgba(13,41,67,.22);
  padding: 14px;
}

.type-editor-panel[hidden] { display: none !important; }
.type-editor-panel * { box-sizing: border-box; }

.type-editor-panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.type-editor-panel__title {
  margin: 0;
  font-size: 14px !important;
  line-height: 1.2 !important;
  font-weight: 800;
  color: #0d2943;
  white-space: nowrap;
}

.type-editor-panel__mode {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.type-editor-panel button {
  min-height: 36px;
  border: 1px solid rgba(13,41,67,.18);
  border-radius: 10px;
  background: #fff;
  color: #16324a;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px !important;
  line-height: 1 !important;
  font-weight: 750;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.type-editor-panel button:hover:not(:disabled) { background: #f2f7f9; }
.type-editor-panel button.is-active {
  border-color: #0d2943;
  background: #0d2943;
  color: #fff;
}
.type-editor-panel button:disabled,
.type-editor-panel input:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.type-editor-target-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid rgba(13,41,67,.10);
  border-bottom: 1px solid rgba(13,41,67,.10);
  padding: 10px 0;
}

.type-editor-target-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px !important;
  line-height: 1.3 !important;
  color: #547083;
}

.type-editor-current-values {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.type-editor-current-size {
  min-width: 62px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 15px !important;
  line-height: 1 !important;
  color: #d33152;
  font-weight: 850;
}

.type-editor-current-position {
  font-size: 10px !important;
  line-height: 1 !important;
  color: #547083;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0 !important;
  white-space: nowrap;
}

.type-editor-section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.type-editor-section-label strong {
  font-size: 11px !important;
  line-height: 1 !important;
  color: #0d2943;
}

.type-editor-section-label span {
  font-size: 10px !important;
  line-height: 1.2 !important;
  color: #8294a2;
}

.type-editor-section-label--position {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid rgba(13,41,67,.08);
}

.type-editor-controls {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 72px 40px;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
}

.type-editor-controls button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 18px !important;
}

.type-editor-controls input[type="range"] {
  width: 100%;
  accent-color: #d33152;
}

.type-editor-controls input[type="number"],
.type-editor-position-controls input[type="number"] {
  min-height: 40px;
  border: 1px solid rgba(13,41,67,.18);
  border-radius: 10px;
  padding: 7px 8px;
  background: #fff;
  color: #16324a;
  text-align: center;
  font-size: 14px !important;
  line-height: 1 !important;
  font-variant-numeric: tabular-nums;
}

.type-editor-controls input[type="number"] { width: 72px; }

.type-editor-position-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
  margin-top: 7px;
}

.type-editor-position-controls > label {
  display: grid;
  grid-template-columns: auto minmax(58px, 1fr) auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 11px !important;
  line-height: 1 !important;
  color: #547083;
  font-weight: 800;
}

.type-editor-position-controls > label span {
  font-size: 10px !important;
  line-height: 1 !important;
  color: #8294a2;
}

.type-editor-position-controls input[type="number"] {
  width: 100%;
  min-width: 0;
}

.type-editor-position-nudges {
  display: grid;
  grid-template-columns: repeat(2, 34px);
  gap: 4px;
}

.type-editor-position-nudges button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 15px !important;
}

.type-editor-reset-position {
  min-height: 40px !important;
  white-space: nowrap;
}

.type-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.type-editor-actions button { flex: 1 1 auto; }
.type-editor-actions .type-editor-danger { color: #b62d49; }

.type-editor-help {
  margin: 9px 0 0;
  font-size: 11px !important;
  line-height: 1.45 !important;
  color: #708798;
}

html.type-editor-active.type-editor-pick [data-type-editable="1"] {
  cursor: text;
  transition: outline-color .12s ease, background-color .12s ease;
}

html.type-editor-active.type-editor-move [data-type-editable="1"] {
  cursor: grab;
  transition: outline-color .12s ease, background-color .12s ease;
}

html.type-editor-active.type-editor-pick [data-type-editable="1"]:hover,
html.type-editor-active.type-editor-move [data-type-editable="1"]:hover {
  outline: 1px dashed rgba(211,49,82,.58);
  outline-offset: 4px;
  background-color: rgba(211,49,82,.035);
}

html.type-editor-active [data-type-editable="1"].type-editor-selected {
  outline: 2px solid rgba(211,49,82,.82) !important;
  outline-offset: 5px !important;
  background-color: rgba(211,49,82,.055) !important;
}

html.type-editor-active.type-editor-move [data-type-editable="1"].type-editor-drag-target {
  outline-style: solid !important;
  cursor: grabbing !important;
}

html.type-editor-dragging,
html.type-editor-dragging * {
  user-select: none !important;
  cursor: grabbing !important;
}

.type-editor-size-chip {
  position: fixed;
  z-index: 100001;
  pointer-events: none;
  border-radius: 7px;
  padding: 5px 7px;
  background: #d33152;
  color: #fff;
  box-shadow: 0 5px 16px rgba(13,41,67,.18);
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0 !important;
  white-space: nowrap;
}

.type-editor-size-chip[hidden] { display: none !important; }

.type-editor-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100002;
  transform: translateX(-50%);
  max-width: calc(100vw - 36px);
  border-radius: 999px;
  padding: 9px 14px;
  background: #0d2943;
  color: #fff;
  box-shadow: 0 8px 28px rgba(13,41,67,.2);
  font-size: 12px !important;
  line-height: 1.25 !important;
  font-weight: 650;
}

.type-editor-export {
  width: 100%;
  min-height: 120px;
  margin-top: 10px;
  resize: vertical;
  border: 1px solid rgba(13,41,67,.16);
  border-radius: 10px;
  padding: 9px;
  background: #f7fafb;
  color: #173149;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  white-space: pre;
}

@media (max-width: 600px) {
  .type-editor-launcher { left: 10px; bottom: 10px; }
  .type-editor-panel {
    left: 10px;
    bottom: 64px;
    width: calc(100vw - 20px);
    border-radius: 14px;
    padding: 12px;
  }
  .type-editor-panel__top {
    align-items: flex-start;
  }
  .type-editor-panel__title {
    padding-top: 9px;
  }
  .type-editor-position-controls {
    grid-template-columns: 1fr 1fr;
  }
  .type-editor-position-nudges {
    grid-template-columns: repeat(4, 34px);
  }
  .type-editor-reset-position {
    width: 100%;
  }
}
