body {
    font-family: 'JetBrains Mono', monospace;
    background-color: #1e1e1e !important;
    color: #F5F5F7;
}

.navbar {
    position: absolute;
    width: calc(100% - 22px);
    margin: 10px;
    background-color: #303030;
    border: 2px solid #505050;
    border-radius: 14px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    height: 52px;
    align-items: stretch;
}

/* Navbar sections */
.navbar-left {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
}

.navbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
}

.navbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
}

/* Make dropdown containers relative for positioning */
.navbar-left .dropdown,
.navbar-right .dropdown {
  position: relative;
  display: flex;
  align-items: stretch;
  height: 100%;
}

/* first navbar entity must have border radius 14px on left top n bottom */
.navbar-left .dropdown:first-child .dropbtn {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}
/* last navbar entity */
.navbar-right > *:last-child .dropbtn,
.navbar-right > *:last-child > a,
.navbar-right > *:last-child > button {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Standardized padding for all navbar elements */
.navbar a {
  font-size: 16px;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}

.dropdown .dropbtn {
  font-size: 16px;  
  border: none;
  outline: none;
  color: white;
  padding: 14px 16px;
  background-color: inherit;
  font-family: inherit;
  margin: 0;
  height: 100%;
  display: flex;
  align-items: center;      /* vertikální střed */
  justify-content: center;  /* horizontální střed (volitelné) */
}

.navbar a:hover, .dropdown:hover .dropbtn, .dropdown:hover > a {
  background-color: #880589;
}

/* Ensure navbar-right icons have rounded corners on hover */
.navbar-right a {
  border-radius: 0;
  transition: background-color 0.2s ease;
}

/* Last item in navbar-right should have border radius */
.navbar-right > a:last-child,
.navbar-right .dropdown:last-child > a,
.navbar-right .dropdown:last-child > button {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1000;
}

/* Right-align dropdown in navbar-right */
.navbar-right .dropdown-content {
  right: 0;
  left: auto;
}

/* Standardized padding for dropdown content */
.dropdown-content a {
  float: none;
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  white-space: nowrap;
}

.dropdown-content a:hover {
  background-color: #ddd;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.blocklyToolboxCategory .blocklyTreeRow:hover {
  background-color: #505050 !important;
}

/* Category icons styling */
.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  vertical-align: middle;
  opacity: 0.85;
}

.category-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.blocklyTreeSelected .category-icon {
  opacity: 1;
}

/* Module links - show on hover */
.module-item:hover .module-links {
  opacity: 1 !important;
}

/* Utility classes to replace inline styles */
.flex-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flex-center-justify {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cursor-pointer {
  cursor: pointer;
}

/* Connection Status Indicator */
#connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  margin-right: 4px;
  border: 2px solid transparent;
}

#connection-status svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

#connection-status-text {
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Disconnected state */
#connection-status.disconnected {
  background-color: rgba(128, 128, 128, 0.15);
  border-color: rgba(128, 128, 128, 0.3);
  color: #9ca3af;
}

#connection-status.disconnected svg {
  color: #9ca3af;
}

/* Connected USB state */
#connection-status.connected-usb {
  background-color: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

#connection-status.connected-usb svg {
  color: #22c55e;
}

/* Connected Bluetooth state */
#connection-status.connected-ble {
  background-color: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #3b82f6;
}

#connection-status.connected-ble svg {
  color: #3b82f6;
}

/* Error state */
#connection-status.error {
  background-color: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

#connection-status.error svg {
  color: #ef4444;
  animation: pulse-error 2s ease-in-out infinite;
}

/* Hover effects */
#connection-status:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#connection-status.disconnected:hover {
  background-color: rgba(128, 128, 128, 0.25);
  border-color: rgba(128, 128, 128, 0.5);
}

#connection-status.connected-usb:hover {
  background-color: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.6);
}

#connection-status.connected-ble:hover {
  background-color: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.6);
}

#connection-status.error:hover {
  background-color: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
}

/* Pulse animation for error state */
@keyframes pulse-error {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Iframe mode styles - minimální rozhraní */
body.iframe-mode .navbar-left > .dropdown:not(.iframe-visible) {
  display: none;
}

body.iframe-mode .navbar-right > *:not(.iframe-visible) {
  display: none;
}

body.iframe-mode .navbar-center > *:not(.iframe-visible) {
  display: none;
}

/* Skrytí položek v rámci dropdownu v iframe režimu */
body.iframe-mode .dropdown-content .iframe-hide {
  display: none !important;
}

/* Označení iframe režimu - remove it, too crowded */
/* Indicator removed to prevent overlap with connection status */

/* Hide Blockly toolbox by default in iframe mode */
body.iframe-mode .blocklyToolboxDiv {
  display: none !important;
}

/* Show toolbox when toggle is active */
body.iframe-mode.toolbox-visible .blocklyToolboxDiv {
  display: block !important;
}

/* Toolbox toggle button styles */
body.iframe-mode .toolbox-toggle {
  display: flex !important;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 60px;
  background: #303030;
  border: 2px solid #505050;
  border-left: none;
  border-radius: 0 8px 8px 0;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: background 0.3s ease, border-color 0.3s ease;
  color: #F5F5F7;
}

body.iframe-mode .toolbox-toggle:hover {
  background: #404040;
  border-color: #606060;
}

/* When toolbox is visible, move button to the right edge of toolbox + scrollbar width */
body.iframe-mode.toolbox-visible .toolbox-toggle {
  left: calc(156px + var(--scrollbar-width, 0px));
  background: #880589;
  border-color: #880589;
}

/* When flyout is also visible, move button further right beyond flyout */
body.iframe-mode.toolbox-visible .toolbox-toggle.flyout-active {
  left: calc(156px + var(--flyout-width, 0px) + var(--scrollbar-width, 0px));
}

body.iframe-mode .toolbox-toggle.active {
  background: #880589;
  border-color: #880589;
}

body.iframe-mode .toolbox-toggle svg {
  transition: transform 0.3s ease;
}

body.iframe-mode .toolbox-toggle.active svg {
  transform: rotate(180deg);
}
