/* artboard.css */

/* ============================================================
   ARTBOARD — видимая рамка холста + меню размера
   ============================================================ */

/* Рамка вокруг viewBox — со затемнением снаружи */
.artboard-frame {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.25), 0 0 0 9999px rgba(0,0,0,.35);
  transition: box-shadow .15s ease;
  will-change: transform, width, height;
}

/* Бейдж размера — капсула над рамкой. Кликабельный. */
.artboard-size-badge {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 8px;
  padding: 6px 14px;
  background: rgba(13,15,23,.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 100px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.artboard-size-badge:hover {
  background: rgba(13,15,23,.82);
  border-color: var(--neon-border);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.5), 0 0 12px rgba(var(--neon-rgb),.2);
}
.artboard-size-badge:active,
.artboard-size-badge:focus-visible {
  background: rgba(var(--neon-rgb),.2);
  border-color: var(--neon);
  outline: none;
}

/* Маленькая стрелка ▾ — индикатор «это dropdown» */
.artboard-size-badge::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: .55;
  margin-top: 1px;
  transition: opacity .15s, transform .15s;
}
.artboard-size-badge:hover::after {
  opacity: 1;
  transform: translateY(1px);
}

/* Z-index: сетка под рамкой, SVG над, handles ещё выше */
.glass-preview .grid-overlay { z-index: 1; }
.glass-preview .artboard-frame { z-index: 4; }
.glass-preview .svg-viewport { z-index: 3; }
.glass-preview #handleLayer { z-index: 10; }

/* Меню размера */
.artboard-menu {
  position: fixed;
  z-index: 100000;
  min-width: 320px;
  background: rgba(15,17,26,.98);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.7);
  animation: popIn .15s ease both;
}

.am-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.am-size-row {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}
.am-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.am-field label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .02em;
}
.am-field input {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 5px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  text-align: center;
  transition: border-color .15s;
}
.am-field input:focus { border-color: var(--neon-border); }
.am-x {
  font-size: 16px;
  color: var(--text-muted);
  padding-bottom: 10px;
  user-select: none;
}

.am-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}
.am-presets button {
  padding: 6px 4px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 4px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.am-presets button:hover {
  background: rgba(var(--neon-rgb),.15);
  border-color: var(--neon-border);
  color: var(--neon);
}

.am-lock {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}
.am-lock input {
  width: 14px;
  height: 14px;
  accent-color: var(--neon);
  cursor: pointer;
  flex-shrink: 0;
}

.am-hint {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 6px 8px;
  margin-bottom: 10px;
  background: rgba(255,255,255,.02);
  border-left: 2px solid rgba(var(--neon-rgb),.35);
  border-radius: 3px;
}

.am-actions button {
  width: 100%;
  padding: 9px;
  background: var(--neon);
  border: 1px solid var(--neon);
  border-radius: 5px;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: .15s;
}
.am-actions button:hover { background: rgba(var(--neon-rgb),.85); }

@media (max-width: 900px) {
  .artboard-menu {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    border-radius: 18px 18px 0 0 !important;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    animation: bottomSheet .25s cubic-bezier(.16,1,.3,1) both;
    max-height: 85vh;
    overflow-y: auto;
  }
  .artboard-size-badge {
    padding: 5px 11px;
    font-size: 11px;
    margin-bottom: 6px;
  }
}