/* Figma keyboard compatibility layer for Penpot 2.16.2. */

/* Active only while the designer uses Figma's Ctrl+\\ Show/Hide UI command. */
body.figma-compat-hide-ui .main_ui_workspace__workspace {
  grid-template-columns: 0 minmax(0, 1fr) 0 !important;
}

body.figma-compat-hide-ui .main_ui_workspace_sidebar__left-settings-bar,
body.figma-compat-hide-ui .main_ui_workspace_sidebar__right-settings-bar,
body.figma-compat-hide-ui .main_ui_workspace_top_toolbar__main-toolbar {
  display: none !important;
}

#figma-shortcut-toast {
  position: fixed;
  left: 50%;
  bottom: 76px;
  z-index: 1400;
  min-width: 240px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 12px;
  color: #fff;
  background: #383838;
  border: 1px solid #555;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  font: 11px/1.45 Inter, ui-sans-serif, system-ui, sans-serif;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

#figma-shortcut-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

#figma-shortcut-toast[data-kind="unavailable"] {
  border-color: #8b5d24;
}

#figma-shortcut-toast[data-kind="approximate"] {
  border-color: #496f8f;
}

.figma-shortcut-toast-key {
  display: inline-flex;
  margin-right: 7px;
  padding: 1px 5px;
  color: #fff;
  background: #505050;
  border: 1px solid #666;
  border-radius: 4px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.figma-shortcut-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: start center;
  padding: 8vh 16px 24px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(2px);
  box-sizing: border-box;
}

.figma-shortcut-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(790px, 84vh);
  display: flex;
  flex-direction: column;
  color: #fff;
  background: #2c2c2c;
  border: 1px solid #4b4b4b;
  border-radius: 12px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.58);
  overflow: hidden;
  font: 11px/1.45 Inter, ui-sans-serif, system-ui, sans-serif;
}

.figma-shortcut-dialog.is-palette {
  width: min(620px, calc(100vw - 32px));
  max-height: min(620px, 76vh);
}

.figma-shortcut-dialog-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid #444;
  box-sizing: border-box;
}

.figma-shortcut-dialog-title {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
}

.figma-shortcut-search {
  min-width: 0;
  flex: 1 1 auto;
  height: 32px;
  padding: 0 10px;
  color: #fff !important;
  background: #383838 !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  outline: none;
}

.figma-shortcut-search:focus {
  border-color: #0d99ff !important;
}

.figma-shortcut-close {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #b3b3b3;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 18px;
  cursor: pointer;
}

.figma-shortcut-close:hover {
  color: #fff;
  background: #444;
}

.figma-shortcut-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  color: #a8a8a8;
  border-bottom: 1px solid #3f3f3f;
  font-size: 10px;
}

.figma-shortcut-summary span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.figma-shortcut-summary i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #31c48d;
}

.figma-shortcut-summary .mapped i { background: #0d99ff; }
.figma-shortcut-summary .approximate i { background: #e8a23b; }
.figma-shortcut-summary .unavailable i { background: #777; }

.figma-shortcut-body {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  overflow: hidden;
}

.figma-shortcut-categories {
  padding: 10px 8px;
  background: #292929;
  border-right: 1px solid #444;
  overflow-y: auto;
}

.figma-shortcut-category {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  color: #b3b3b3;
  background: transparent;
  border: 0;
  border-radius: 5px;
  text-align: left;
  font-size: 11px;
  cursor: pointer;
}

.figma-shortcut-category:hover,
.figma-shortcut-category.is-active {
  color: #fff;
  background: #383838;
}

.figma-shortcut-list {
  min-height: 0;
  padding: 10px 12px 18px;
  overflow-y: auto;
}

.figma-shortcut-section-title {
  margin: 8px 4px 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.figma-shortcut-row {
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 88px;
  align-items: center;
  gap: 10px;
  padding: 4px 7px;
  border-radius: 6px;
  box-sizing: border-box;
}

.figma-shortcut-row:hover,
.figma-shortcut-row.is-selected {
  background: #383838;
}

.figma-shortcut-row[data-runnable="true"] {
  cursor: pointer;
}

.figma-shortcut-label {
  min-width: 0;
  color: #ededed;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.figma-shortcut-keys {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
  white-space: nowrap;
}

.figma-shortcut-keys kbd {
  min-width: 19px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  color: #fff;
  background: #454545;
  border: 1px solid #606060;
  border-radius: 4px;
  box-sizing: border-box;
  box-shadow: 0 1px 0 #1c1c1c;
  font: 10px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.figma-shortcut-status {
  justify-self: end;
  min-width: 72px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #a9e9cf;
  background: rgba(49, 196, 141, 0.12);
  text-align: center;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.figma-shortcut-status[data-support="mapped"] {
  color: #9fd6ff;
  background: rgba(13, 153, 255, 0.14);
}

.figma-shortcut-status[data-support="approximate"] {
  color: #f5c983;
  background: rgba(232, 162, 59, 0.13);
}

.figma-shortcut-status[data-support="unavailable"] {
  color: #a5a5a5;
  background: rgba(150, 150, 150, 0.1);
}

.figma-shortcut-empty {
  padding: 34px 12px;
  color: #999;
  text-align: center;
}

.figma-shortcut-palette-list {
  min-height: 0;
  padding: 7px;
  overflow-y: auto;
}

.figma-shortcut-palette-list .figma-shortcut-row {
  grid-template-columns: minmax(0, 1fr) auto 86px;
  min-height: 40px;
}

.figma-shortcut-dialog-footer {
  padding: 8px 14px;
  color: #8d8d8d;
  border-top: 1px solid #444;
  font-size: 10px;
}

@media (max-width: 720px) {
  .figma-shortcut-backdrop { padding: 16px 8px; }
  .figma-shortcut-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 32px); }
  .figma-shortcut-body { grid-template-columns: 108px minmax(0, 1fr); }
  .figma-shortcut-row { grid-template-columns: minmax(0, 1fr) auto; }
  .figma-shortcut-status { display: none; }
}
