/* Loading Spinner Styles */
.blockly-loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
}

.blockly-loading-text {
  font-size: 18px;
  color: #555;
}
/* Estilos para destaque de blocos durante execução */
.blocklySelected > .blocklyPath {
  stroke: #667eea !important;
  stroke-width: 1px !important;
  filter: drop-shadow(0 0 10px rgba(53, 2, 92, 1.7)) !important;
}

.blocklySelected {
  z-index: 999 !important;
}

/* ===== BLOCKLY CUSTOMIZATIONS ===== */
.blocklyScrollbarVertical,
.blocklyScrollbarHorizontal,
.blocklyToolboxDiv .blocklyScrollbarVertical,
.blocklyToolboxDiv .blocklyScrollbarHorizontal,
.blocklyFlyout .blocklyScrollbarVertical,
.blocklyFlyout .blocklyScrollbarHorizontal,
.blocklyWorkspace .blocklyScrollbarVertical,
.blocklyWorkspace .blocklyScrollbarHorizontal,
.blocklyDiv .blocklyScrollbarVertical,
.blocklyDiv .blocklyScrollbarHorizontal,
.blocklyDiv * .blocklyScrollbarVertical,
.blocklyDiv * .blocklyScrollbarHorizontal,
.blocklyScrollbarHandle,
.blocklyScrollbarKnob,
.blocklyScrollbarBackground,
div[class*="blockly"] .blocklyScrollbarVertical,
div[class*="blockly"] .blocklyScrollbarHorizontal,
svg[class*="blockly"] .blocklyScrollbarVertical,
svg[class*="blockly"] .blocklyScrollbarHorizontal {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
}

.blocklyWorkspace,
.blocklyWorkspace svg,
.blocklyToolboxDiv,
.blocklyToolboxDiv *,
.blocklyFlyout,
.blocklyFlyout *,
.blocklyDiv,
.blocklyDiv *,
.blocklyMainBackground,
.blocklyTreeRoot {
  overflow: hidden !important;
}

.blocklyDiv {
  background-color: #f8f9fa;
  min-height: 200px;
}

.blocklyDiv .blocklyWorkspace {
  background-color: #f8f9fa !important;
}

.blocklyDiv .blocklyFlyout,
.blocklyDiv .blocklyToolboxDiv {
  transition: opacity 0.2s ease-in-out;
}

.blocklyDiv:empty {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
}

@media (max-width: 480px) {
  .fixed.z-50 {
    z-index: 1000 !important;
  }

  nav {
    z-index: 100 !important;
  }

  .blocklyDiv,
  .injectionDiv {
    z-index: 10 !important;
    position: relative !important;
  }

  .blocklyToolboxDiv {
    z-index: 30 !important;
  }
}

.blocklyTreeLabel svg {
  vertical-align: middle;
  margin-right: 4px;
}

/* ================================================================================================== */
.blocklyToolboxCategoryLabel {
  font-size: 1.2em;
}

.blocklyToolboxContents {
  padding: 0.5em;
}

.blocklyToolboxCategory {
  padding: 0.5em;
  margin-top: 0.5em;
  margin-bottom: 0.2em;
  margin-left: 0.5em;
  margin-right: 0.5em;
  border-radius: 10px;
  border: 5px solid #ffffff;
}

.customIcon {
  color: #fff;
}

.blocklyTreeRowContentContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.blocklyToolboxCategory {
  height: initial;
}

@media (max-width: 480px) {
  .blocklyToolboxCategory {
    padding: 0px;
    border: none;
    border-radius: 0%;
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 0;
    width: 42px;
    height: 40px;
    /* Esconde o texto */
  }

  .blocklyToolboxCategoryLabel {
    display: none;
    /* Some completamente */
  }

  .blocklyTreeRowContentContainer {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    width: 100% !important;
    height: 100% !important;
  }

  .blocklyToolboxCategoryIcon {
    /* font-size: 32px !important; */
    margin: 0 !important;
    color: white !important;
  }

  .blocklyText {
    font-size: small !important;
  }
}

.blockly-debug-solution-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1000; /* Aumentado para ficar sobre tudo */
  padding: 0.5rem;
  background-color: white;
  border: none;
  border-radius: 9999px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: background-color 0.2s;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blockly-debug-solution-btn:hover {
  background-color: #f3e8ff;
}

.blockly-debug-solution-btn:active {
  background-color: #e9d5ff;
}

@media (max-width: 768px) {
  .blockly-debug-solution-btn {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.5rem;
  }

  .blockly-debug-solution-btn svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

@media (max-width: 480px) {
  .blockly-debug-solution-btn {
    top: 0.375rem;
    right: 0.375rem;
    padding: 0.375rem;
  }

  .blockly-debug-solution-btn svg {
    width: 1rem;
    height: 1rem;
  }
}
