body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
  font-family: "Roboto Mono", "Fira Code", monospace;
}

#titleBar {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  background: #070707;
  color: white;  
  font-size: 18px;
}

#titleBar img {
  height: 32px;
  width: 32px;
  margin-right: 8px;
}

#projectBar {
  padding: 3px 12px;
  background: #333;
  color: #fff;  
  font-weight: 500;
  font-size: 13px;
  text-indent: 10px;
}

/* barra menu */
#menuBar {
  position: relative;
  padding: 5px 10px;
  border-bottom: 1px solid #b5b5b5;
  background: #d5d5d5;
  font-size: 12px;
}
.menu-group {
  position: relative;
  display: inline-block;
}
.menu-item {
  display: inline-block;
  padding: 5px 10px;
  cursor: pointer;  
  user-select: none;
}
.menu-item:hover {
  background: #dfdede;
}
.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  width: max-content;
  z-index: 1000;
  margin: 0;
  padding: 5px 0;
  border: 1px solid #ccc;
  background: white;
  list-style: none;  
  display: none;
}
.submenu li {
  padding: 5px 12px;
  border-bottom: 1px solid #eee;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.submenu li:last-child {
  border-bottom: none;
}
.submenu li .shortcut {
  margin-left: 1rem;
  color: #666;
  font-size: 0.85em;  
}
.menu-item.open + .submenu {
  display: block;
}

/* menu rapido standby */
#welcomeDiv {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 80vh;
  gap: 0.8rem;
  text-align: center;  
  color: #6c757d;
}
#welcomeDiv p {
  margin: 0;
  font-size: 1.1rem;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s ease;
  font-size: 18px;
}
#welcomeDiv p:hover {
  color: #0078d7;
}

#editor {
  flex: 1;
  padding: 2px;
  background: white;
  overflow: auto;
  font-family: var(--bs-font-sans-serif);
}

/* pannelli nascosti fissi */
.hidden { 
  display: none !important; 
}
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  background: rgba(0,0,0,0.6);  
}
.overlay-content {
  width: 300px;
  border: 2px solid #070707;
  background: #f3f3f3;  
  box-shadow: 0 0 8px rgba(0,0,0,.3);
  font-size: 12px;
}
.overlay-open-save-content {
  width: 500px;
  max-width: 90%;
  border: 2px solid #070707;
  background: #f3f3f3;  
  box-shadow: 0 0 8px rgba(0,0,0,.3);  
  font-size: 12px;
}
.overlay-lorem-content {
  width: 400px;
  max-width: 90%;
  border: 2px solid #070707;
  background: #f3f3f3;  
  box-shadow: 0 0 8px rgba(0,0,0,.3);
  font-size: 12px;
}
.overlay-about-content {
  width: 400px;
  max-width: 90%;
  border: 2px solid #070707;
  background: #f3f3f3;  
  box-shadow: 0 0 8px rgba(0,0,0,.3);
  font-size: 12px;
}
.overlay-header {
  padding: 5px;
  color: #fff;
  background: #070707;  
  font-weight: bold;
  font-size: 13px;
}
.overlay-about-header {
  padding: 6px 8px;
  color: #fff;
  background: #070707;
  font-weight: bold;
  font-size: 13px;
}
.overlay-lorem-header {
  padding: 6px 8px;
  color: #fff;
  background: #070707;  
  font-weight: bold;
  font-size: 13px;
}
.overlay-body {
  padding: 10px;
}
.overlay-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 10px;
}
.overlay-confirm-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 10px;
}
.overlay-about-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 10px;
}
.overlay-element-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 10px;
}
.overlay-footer button {
  padding: 4px 8px;
  border: 1px solid #070707;
  background: #e5e5e5;
  cursor: pointer;  
}
.overlay-confirm-footer button {
  flex: 1;
  max-width: 70px;
  text-align: center;
  padding: 3px 3px;
  border: 1px solid #070707;
  background: #e5e5e5;
  cursor: pointer;  
}
.overlay-about-footer button {
  padding: 4px 8px;
  border: 1px solid #070707;
  background: #e5e5e5;
  cursor: pointer;  
}
.overlay-element-footer button {
  flex: 1;
  max-width: 70px;
  text-align: center;
  padding: 3px 3px;
  border: 1px solid #070707;
  background: #e5e5e5;
  cursor: pointer;  
}
.overlay-projects-list {
  height: 180px;
  margin-bottom: 10px;
  border: 1px solid #aaa;
  background: #fff;  
  overflow-y: auto;
  font-size: 12px;
}
.overlay-project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid #eee;  
  cursor: default;
}
.overlay-project-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.overlay-project-date {
  flex-shrink: 0;
  margin-left: 12px;
  color: #666;
  font-size: 11px;  
}
.overlay-project-item:hover {
  background: #cce5ff;
}
.overlay-project-item.selected {
  color: #fff;
  background: #0078d7;
}
.overlay-input {
  width: 100%;
  padding: 6px;
  border: 1px solid #aaa;
  font-size: 12px;
}
.lorem-intro {
  margin-bottom: 20px;
  color: #555;
  font-size: 13px;  
}
.overlay-lorem-output {
  padding: 10px;
  border-top: 1px solid #aaa;
}
#loremOutput {
  width: 100%;
  padding: 5px;
  border: 1px solid #aaa;
  background: #fff;
  resize: none;
  font-size: 12px;  
  cursor: pointer;  
}
.lorem-message {
  margin-top: 5px;
  color: green;
  font-size: 11px;  
}
.about-intro {
  margin-bottom: 20px;
  color: #555;
  font-size: 13px;  
}
.about-section {
  margin-bottom: 15px;
}

/* toast messaggi di interazione */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 8px 14px;
  border-radius: 4px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  z-index: 3000;
  color: #fff;
  background: #333;
  font-size: 13px;  
}
.toast.show {
  opacity: 1;
}

/* sidebar pannelli scambiabili */
#sideBar {
  position: fixed;
  left: 0;
  top: calc(50% - 60px);
  width: 40px;
  background: #d5d5d5;
  border: 1px solid #b5b5b5;
  border-radius: 10px;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#sideBarHeader {
  display: flex;
  width: 100%;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #cecece;
  font-size: 16px;
  cursor: move;  
  user-select: none;
}
.sideBarIcons {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 12px;
}
.sideBarIcons i {
  padding: 6px 0;
  color: #000;
  font-size: 16px;  
  cursor: pointer;  
}
.sideBarIcons i:hover {
  border-radius: 4px;
  background: #bbb;
}

/* pannello di navigazione progetto */
#treePanel {
  position: fixed;
  display: flex;
  flex-direction: column;
  min-width: 240px;
  max-width: 100vw;
  max-height: 40vh;
  z-index: 2000;
  border: 2px solid #070707;
  box-shadow: 0 0 8px rgba(0,0,0,.3);
  background: #f3f3f3;  
  font-size: 12px;  
  visibility: hidden;
}
#treePanel.visible {
  visibility: visible;
}
#treeHeader {
  flex-shrink: 0;
  padding: 5px;
  color: #fff;
  background: #070707;  
  font-weight: bold;
  font-size: 13px;
  cursor: move;  
}
#treeContent {
  flex: 1;
  padding-right: 6px;
  overflow-y: auto;  
}
#treeRoot {
  padding-left: 12px;
  margin: 0;
  list-style-type: none;  
  white-space: nowrap;
}
#treeRoot ul {
  margin: 0;
  padding-left: 12px;
  list-style: none;  
}
#treeRoot li {
  position: relative;
  padding-left: 8px;
  list-style-position: outside;
  white-space: nowrap;  
  cursor: pointer;
}
#treeRoot li::after {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: -1;
  background: inherit;
  content: "";  
}
#treeRoot li::marker {
  content: "▸";
  color: #070707;
  font-size: 0.9em;
}

/* pannello proprietà elementi */
#propertiesPanel {
  position: fixed;
  top: 100px;
  right: 20px;
  width: 280px;
  height: 50Vh;
  display: flex;
  flex-direction: column;
  border: 2px solid #070707;
  z-index: 2000;
  box-shadow: 0 0 8px rgba(0,0,0,.3);
  background: #f3f3f3;
  font-size: 12px;  
}
#propertiesHeader {
  flex-shrink: 0;
  padding: 5px;
  color: #fff;
  background: #070707;
  font-weight: bold;
  font-size: 13px;
  cursor: move;  
}
#propertiesContent {
  flex: 1;
  overflow-y: auto;
}
.prop-block {
  border-bottom: 1px solid #ccc;
  margin-bottom: 4px;
}
.prop-header {
  padding: 4px 6px;
  background: #e5e5e5;  
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}
.prop-content {
  padding: 6px;
  display: none;
}
.prop-block.open .prop-content {
  display: block;
}
.prop-block.actions .prop-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 8px 4px 8px 4px;
  width: 90%;
  margin: 0 auto;
}
.action-btn {
  border: 2px outset #888;
  background-color: #e5e5e5;
  font-size: 12px;
  padding: 3px;
  text-align: center;
  box-sizing: border-box;
}
.action-btn:hover {
  border: 2px inset #888;
  background-color: #c9c9c9;
}
.prop-content label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.prop-content label input[type="radio"],
.prop-content label input[type="checkbox"],
.prop-content label input[type="color"] {
  pointer-events: auto;
}
.prop-content label * {
  pointer-events: auto;
}
.box-input {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 8px 0;
}
.box-input .middle-row {
  display: flex;
  align-items: center;
}
.box-input input {
  width: 60px;
  margin: 4px;
  text-align: center;
  font-size: 11px;
}
.box-input input.top,
.box-input input.bottom,
.box-input input.left,
.box-input input.right {
  text-align: center;
}
.box-input .box-preview {
  width: 60px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #aaa;
  background: #f9f9f9;
  font-size: 10px;  
}
#propertiesContent label {
  display: flex;
  align-items: center;
  margin: 4px 0;
}
#propertiesContent input[type="checkbox"],
#propertiesContent input[type="color"] {
  margin-right: 6px;
}
#propertiesHeader,
#elementsHeader,
#treeHeader {
  touch-action: none !important;
  -webkit-user-drag: none;
  user-select: none;
}
.typography-btn {
  padding: 4px 6px;
  border: 1px solid #999;
  background: none;
  cursor: pointer;  
}
.typography-btn.active {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}
.col-input {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.col-input input[type="text"] {
  flex: 0 0 120px;
  max-width: 120px;
  min-width: 80px;
  overflow: hidden;
}
.col-input button {
  flex: 0 0 auto;
}

/* pannello elementi editabili */
#elementsPanel {
  position: fixed;
  display: flex;
  flex-direction: column;
  top: calc(50% - 150px);
  left: calc(50% - 130px);
  min-width: 260px;
  max-height: 60vh;
  border: 2px solid #070707;
  z-index: 2100;
  box-shadow: 0 0 8px rgba(0,0,0,.3);
  background: #f3f3f3;
  font-size: 12px;  
  visibility: hidden;
}
#elementsPanel.visible {
  visibility: visible;
}
#elementsHeader {
  flex-shrink: 0;
  padding: 5px;
  color: #fff;
  background: #070707;  
  font-weight: bold;
  font-size: 13px;
  cursor: move;
}
#elementsContent {
  flex: 1;
  overflow-y: auto;
}
.popup-category {
  padding: 6px 8px;
  border-bottom: 1px solid #ccc;
  background: #e5e5e5;
  cursor: pointer;
}
.popup-category:hover {
  background: #ddd;
}
.popup-submenu {
  display: none;
  padding: 6px 12px;
  background: #fff;
}
.popup-submenu li {
  margin: 2px 0;
  padding: 4px 6px;
  border: 1px dashed #ccc;
  list-style: none;  
  cursor: grab;
}

/* elementi di preview */
#gdws-preview-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: #fff;  
}
#gdws-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.exit-preview-btn {
  position: fixed;
  bottom: 15px;
  right: 15px;
  padding: 10px 16px;
  z-index: 10000;
  display: flex;
  align-items: center;
  border: none;
  border-radius: 20px;
  color: #fff;
  background: rgba(0,0,0,0.7);  
  font-size: 14px;
  cursor: pointer;
}
.exit-preview-btn:hover {
  background: rgba(0,0,0,0.9);
}

/* assistente interattivo */
#assistantContainer {
  position: fixed;
  bottom: 20px;
  left: -400px;
  z-index: 9999;
  transition: left 0.5s ease, opacity 0.5s ease;
  opacity: 0;
}
#assistantContainer.active {
  left: 20px;
  opacity: 1;
}
#assistantBubble {
  position: relative;
  text-align: center;
  width: 300px;
  padding: 12px 16px;
  border: 2px solid #333;
  border-radius: 12px;
  background: #fff; 
  box-shadow: 2px 2px 8px rgba(0,0,0,0.2);  
  font-family: var(--bs-font-sans-serif);  
}
#assistantHeader {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
#assistantImg {
  width: 70px;
  height: auto;
  border-radius: 50%;
  border: 2px solid #333;
  background: #fafafa;
  padding: 4px;
}
#assistantMessage {
  max-height: 150px;
  line-height: 1.4em;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-width: none;
  font-size: 13px;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#assistantMessage.show {
  opacity: 1;
  transform: translateY(0);
}
#assistantMessage::-webkit-scrollbar {
  width: 0;
  background: transparent;
}
#assistantMessage button {
  padding: 0;
  margin-top: 10px;
  border: none;
  color: #0078d7;
  background: none;
  text-decoration: underline;  
  font-size: 12px;  
  cursor: pointer;
}
#assistantMessage button:hover {
  color: #005fa3;
  text-decoration: none;
}
#assistantClose {
  position: absolute;
  top: 5px;
  right: 8px;
  border: none;
  background: transparent;
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
}