/* Keyboard shortcuts modal */
.shortcuts-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.shortcuts-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.shortcuts-modal {
  background: var(--ds-sidebar-bg);
  border: var(--border-width-1) solid var(--chat-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 380px;
  margin: var(--space-4);
  transform: translateY(8px) scale(0.97);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}
.shortcuts-modal-backdrop.open .shortcuts-modal {
  transform: translateY(0) scale(1);
}

.shortcuts-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: var(--border-width-1) solid var(--chat-border-subtle);
}
.shortcuts-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--chat-text);
}
.shortcuts-modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--chat-text-muted);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.shortcuts-modal-close:hover {
  background: var(--chat-surface-hover);
  color: var(--chat-text);
}

.shortcuts-modal-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.shortcuts-group {
  padding: var(--space-1) 0;
}
.shortcuts-group + .shortcuts-group {
  border-top: var(--border-width-1) solid var(--chat-border-subtle);
  padding-top: var(--space-2);
  margin-top: var(--space-1);
}
.shortcuts-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--chat-text-dim);
  padding: 0 var(--space-1) var(--space-2);
}

.shortcuts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-1) var(--space-1);
  border-radius: var(--radius-sm);
}
.shortcuts-label {
  font-size: 0.875rem;
  color: var(--chat-text-muted);
}
html[data-theme="dark"] .shortcuts-label {
  color: #999999;
}
html[data-theme="dark"] .shortcuts-keys kbd {
  color: #999999;
}
.shortcuts-keys {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 var(--space-1);
  background: var(--chat-surface);
  border: var(--border-width-1) solid var(--chat-border);
  border-radius: 0.3rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--chat-text-muted);
  line-height: 1;
}

/* Bug report modal */
.bug-report-modal {
  max-width: 420px;
}
.bug-report-modal .shortcuts-modal-header {
  border-bottom: none;
  padding: var(--space-6) var(--space-6) var(--space-2);
}
.bug-report-modal .shortcuts-modal-close {
  display: none;
}
.bug-report-body {
  padding: 0 var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.bug-report-desc {
  font-size: 0.875rem;
  color: var(--chat-text-muted);
  margin: 0;
  line-height: 1.6;
}
.bug-report-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.bug-report-textarea {
  width: 100%;
  background: var(--chat-input-bg);
  border: var(--border-width-1) solid var(--chat-border);
  border-radius: var(--radius-md);
  color: var(--chat-text);
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.6;
  padding: var(--space-2) var(--space-3);
  resize: none;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.bug-report-textarea::placeholder {
  color: var(--chat-text-faint);
}
.bug-report-textarea:focus {
  border-color: var(--chat-text-muted);
}
.bug-report-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}
.bug-report-char-count {
  margin-right: auto;
  font-size: 0.75rem;
  color: var(--chat-text-faint);
  opacity: 0;
  transition: color 0.15s;
}
.bug-report-char-count.warn {
  color: var(--chat-error-text);
}
.bug-report-cancel {
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: var(--border-width-1) solid var(--chat-border);
  border-radius: var(--radius-full);
  color: var(--chat-text-muted);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.bug-report-cancel:hover {
  border-color: var(--chat-text-muted);
  color: var(--chat-text);
}
.bug-report-submit {
  padding: var(--space-2) var(--space-4);
  background: var(--chat-accent);
  border: none;
  border-radius: var(--radius-full);
  color: var(--chat-bg);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.bug-report-submit:hover {
  opacity: 0.85;
}
.bug-report-submit:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── Figma prototype modal ── */
.figma-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}

.figma-modal.open {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.figma-modal-panel {
  display: flex;
  flex-direction: column;
  width: min(480px, 95vw);
  height: 88vh;
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: var(--border-width-1) solid var(--color-border);
  flex-shrink: 0;
}

.figma-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: var(--border-width-1) solid var(--color-border);
  flex-shrink: 0;
}

.figma-modal-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.figma-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.figma-modal-close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.figma-modal-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--color-bg);
}

/* Shortcuts modal header — bug-report modal keeps its full header at all sizes */
.shortcuts-modal:not(.bug-report-modal) .shortcuts-modal-header {
  border-bottom: none;
}

/* Desktop: drop the close button (overlay click closes the modal). Mobile keeps it. */
@media (min-width: 769px) {
  .shortcuts-modal:not(.bug-report-modal) .shortcuts-modal-close {
    display: none;
  }
}

@media (max-width: 768px) {

  .figma-modal {
    padding: 0;
    gap: 0;
    align-items: stretch;
    justify-content: stretch;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(0, 0, 0, 0.8);
  }

  .figma-modal-panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
}
