/* Design tool — asset placement editor */

.design-tool {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10001;
  width: 300px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text);
  user-select: none;
}

.design-tool.design-tool--hidden {
  display: none;
}

.design-tool.design-tool--dragging {
  cursor: grabbing;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.design-tool__drag-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: -0.25rem 0 0.75rem;
  padding: 0.35rem 0 0.65rem;
  border-bottom: 1px solid var(--border);
  cursor: grab;
}

.design-tool--dragging .design-tool__drag-bar {
  cursor: grabbing;
}

.design-tool__drag-grip {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--text-muted) 0,
    var(--text-muted) 2px,
    transparent 2px,
    transparent 4px
  );
  opacity: 0.5;
  flex-shrink: 0;
}

.design-tool__drag-label {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex: 1;
}

.design-tool__drag-hint {
  font-size: 0.58rem;
  color: var(--text-muted);
  opacity: 0.75;
}

.design-tool__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 0.25rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.design-tool__close:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}

.design-tool__title {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.design-tool__hint {
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 1rem;
}

.design-tool__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.design-tool__label {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.design-tool__value {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.design-tool__slider {
  width: 100%;
  margin: 0.25rem 0 1rem;
  accent-color: var(--teal);
}

.design-tool__select {
  width: 100%;
  margin: 0.25rem 0 0.75rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  cursor: pointer;
}

.design-tool__select:focus {
  outline: none;
  border-color: var(--gold-light);
}

.design-tool__catalog {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.design-tool__catalog-btn {
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 0;
}

.design-tool__catalog-btn:hover {
  border-color: var(--teal);
}

.design-tool__catalog-btn img {
  width: 100%;
  height: 48px;
  object-fit: contain;
  pointer-events: none;
}

.design-tool__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.design-tool__btn {
  flex: 1;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.design-tool__btn:hover {
  border-color: var(--gold-light);
}

.design-tool__btn--primary {
  background: var(--gold-bg);
  border-color: var(--gold-bg);
  color: var(--white);
}

.design-tool__btn--primary:hover {
  background: var(--gold-dark);
}

.design-tool__btn--danger {
  color: #a33;
  border-color: #e8c4c4;
}

.design-tool__status {
  margin-top: 0.65rem;
  font-size: 0.68rem;
  color: var(--teal);
  line-height: 1.4;
  min-height: 1rem;
}

.design-tool__divider {
  height: 1px;
  background: var(--border);
  margin: 0.85rem 0;
}

body.asset-editor-active .page-assets-layer {
  z-index: 5;
  pointer-events: none;
}

body.asset-editor-active .page-asset {
  pointer-events: auto;
  cursor: move;
  touch-action: none;
  z-index: 1;
}

body.asset-editor-active .page-asset.page-asset--selected {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
  z-index: 2;
}

body.logo-editor-active .logo {
  cursor: move;
  touch-action: none;
  pointer-events: auto !important;
}

body.logo-editor-active .logo.logo--editor-floating,
body.logo-editor-active .logo.logo--positioned {
  z-index: 10002;
}

body.logo-editor-active .logo.logo--selected {
  outline: 2px solid var(--gold-light);
  outline-offset: 4px;
  border-radius: 4px;
}

.logo-resize-handle {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 18px;
  height: 18px;
  background: var(--teal);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: nwse-resize;
  z-index: 3;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  display: none;
  pointer-events: auto;
}

body.logo-editor-active .logo.logo--selected .logo-resize-handle {
  display: block;
}

.page-asset__resize-handle {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 16px;
  height: 16px;
  background: var(--teal);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: nwse-resize;
  z-index: 3;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  display: none;
  pointer-events: auto;
}

body.asset-editor-active .page-asset.page-asset--selected .page-asset__resize-handle {
  display: block;
}

body.asset-editor-active .page-asset--locked .page-asset__resize-handle {
  display: none !important;
}

html[data-theme="dark"] .design-tool {
  background: rgba(22, 22, 22, 0.92);
  border-color: #333;
}

html[data-theme="dark"] .design-tool__btn {
  background: #1a1a1a;
  border-color: #333;
  color: #f2f2f2;
}

html[data-theme="dark"] .design-tool__btn--primary {
  background: var(--gold-bg);
  border-color: var(--gold-bg);
}

html[data-theme="dark"] .design-tool__catalog-btn {
  background: #141414;
  border-color: #333;
}

/* Background editor controls */
.design-tool__check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.design-tool__check input {
  accent-color: var(--teal);
}

.design-tool__color {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.design-tool__color--block {
  width: 100%;
  height: 32px;
  margin-bottom: 0.5rem;
}

.design-tool__text {
  width: 100%;
  margin: 0.25rem 0 0.75rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.72rem;
}

.design-tool__text:focus {
  outline: none;
  border-color: var(--gold-light);
}

.design-tool__file-btn {
  display: block;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-size: 0.72rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}

.design-tool__file-btn:hover {
  border-color: var(--teal);
  color: var(--text);
}

.design-tool__preview {
  width: 100%;
  height: 88px;
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f5f5f5;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.design-tool__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.design-tool__preview-empty {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.design-tool__status--bg {
  margin-top: 0.35rem;
  min-height: 0.85rem;
}

.design-tool__bg-image[hidden] {
  display: none !important;
}
