/* Canva Editor panel styles */
.editor-sidebar {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 260px; background: #181815; border-left: 1px solid rgba(255,255,255,.09);
  z-index: 48; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
}
.editor-sidebar.open { transform: translateX(0); }
.editor-backdrop { position: fixed; inset: 0; z-index: 47; border: 0; background: rgba(0,0,0,.58); backdrop-filter: blur(2px); }
.editor-backdrop[hidden] { display: none; }

.editor-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.09);
  font-size: 13px; font-weight: 600; color: #c9b37e;
}
.editor-sidebar-header button {
  background: none; border: none; color: #9e9c92; cursor: pointer; font-size: 18px; padding: 2px 6px;
}
.editor-sidebar-header button:hover { color: #f5eee0; }

.editor-sidebar-body { flex: 1; overflow-y: auto; padding: 10px; }

.editor-sidebar-tabs {
  display: flex; gap: 2px; padding: 8px 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.editor-sidebar-tabs button {
  flex: 1; padding: 8px 6px; background: none; border: none;
  color: #9e9c92; font-size: 12px; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.editor-sidebar-tabs button.active { color: #c9b37e; border-bottom-color: #c9b37e; }

/* Open sidebar button */
.editor-toggle {
  position: fixed; right: 12px; top: 50%; transform: translateY(-50%);
  z-index: 49; width: auto; min-width: 96px; height: 40px; padding: 0 14px;
  background: #181815; border: 1px solid rgba(255,255,255,.09);
  border-radius: 999px;
  color: #c9b37e; font-size: 11px; cursor: pointer;
  writing-mode: horizontal-tb; text-orientation: mixed; white-space: nowrap;
  letter-spacing: .18em; line-height: 1;
  transition: right .25s ease;
}
.editor-toggle.shifted { right: 272px; }
.editor-toggle:hover { background: #22221e; }

/* Layers panel */
.layer-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 6px; cursor: pointer;
  font-size: 12px; color: #c5c0b0; transition: background .12s;
}
.layer-row:hover { background: rgba(255,255,255,.05); }
.layer-row.selected { background: rgba(74,158,255,.12); color: #fff; }
.layer-vis { cursor: pointer; font-size: 14px; opacity: .6; flex-shrink: 0; }
.layer-vis:hover { opacity: 1; }
.layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-actions { display: flex; gap: 2px; flex-shrink: 0; }
.layer-actions button {
  background: none; border: none; color: #9e9c92;
  cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 3px;
}
.layer-vis {
  display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px;
  padding: 0; border: 0; border-radius: 5px; background: transparent; color: #a7a297; cursor: pointer;
}
.layer-vis:hover { color: #f5eee0; background: rgba(255,255,255,.08); }
.layer-actions button:hover { color: #f5eee0; background: rgba(255,255,255,.08); }

/* Stickers grid */
.stickers-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px;
}
.sticker-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px 6px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06); border-radius: 8px;
  color: #c5c0b0; cursor: pointer; font-size: 10px;
  transition: all .15s;
}
.sticker-btn:hover { background: rgba(255,255,255,.1); border-color: #c9b37e; color: #f5eee0; }
.sticker-btn svg { color: #d8b86f; }

/* Inline editor */
.inline-edit {
  display: none; font-family: inherit; font-size: 14px;
  padding: 4px 8px; border: 2px solid #4a9eff; border-radius: 4px;
  background: #1a1a18; color: #f5eee0; outline: none; resize: none;
  overflow: hidden; line-height: 1.5;
}

/* Selection overlay */
.poster, .poster * { -webkit-user-select: none; user-select: none; }
.poster .inline-edit { -webkit-user-select: text; user-select: text; }
.canva-handle { transition: opacity .1s; }
.canva-handle:hover { fill: #4a9eff; }

/* Editor toolbar */
.editor-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 6px 12px; background: #181815;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.selected-label { font-size: 12px; color: #9e9c92; flex: 1; }
.editor-toolbar button {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09);
  border-radius: 4px; color: #c5c0b0; cursor: pointer; font-size: 11px; padding: 4px 10px;
}
.editor-toolbar button:hover { background: rgba(255,255,255,.12); color: #f5eee0; }
.btn-delete:hover { background: rgba(220,50,50,.2) !important; border-color: #dc3232 !important; color: #dc3232 !important; }
.editor-color { display: none; align-items: center; gap: 5px; color: #8f8b81; font-size: 9px; }
.editor-color input { width: 30px; height: 28px; padding: 2px; border: 1px solid rgba(255,255,255,.12); background: transparent; cursor: pointer; }
.editor-align { flex: 0 0 100%; display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.08); }
.editor-align[hidden] { display: none; }
.editor-align > span { color: #77746c; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.align-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
.editor-toolbar .align-row button { min-width: 0; padding: 7px 4px; }
.editor-toolbar .align-row button.active { border-color: #4a9eff; background: rgba(74,158,255,.16); color: #dbeaff; }
.text-align-row { display: grid; gap: 5px; padding-top: 4px; border-top: 1px solid rgba(255,255,255,.06); }
.text-align-row[hidden] { display: none; }
.text-align-row > span { color: #77746c; font-size: 9px; letter-spacing: .08em; }

@media (min-width: 1201px) {
  body.editor-sidebar-open .workspace { padding-right: 260px; transition: padding-right .25s ease; }
  body.editor-sidebar-open .topbar { padding-right: calc(260px + 4vw); }
}

@media (max-width: 1200px) {
  .editor-sidebar { box-shadow: -20px 0 70px rgba(0,0,0,.65); }
}

@media (max-width: 900px) {
  .editor-sidebar { width: min(340px, 88vw); box-shadow: -20px 0 70px rgba(0,0,0,.65); }
  .editor-toggle { top: 88px; right: 12px; bottom: auto; transform: none; width: auto; height: 44px; padding: 0 16px; border-right: 1px solid rgba(255,255,255,.09); border-radius: 999px; writing-mode: initial; letter-spacing: .12em; }
  .editor-toggle.shifted { right: 12px; opacity: 0; pointer-events: none; }
  .editor-sidebar-header button, .layer-actions button { min-width: 44px; min-height: 44px; }
  .layer-row { min-height: 52px; padding: 5px 8px; }
  .editor-toolbar button { min-height: 38px; }
}

/* Hide legacy drag tools */
.canvas-tools { display: none !important; }
