*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: #1e1e1e;
  color: #e5e5e5;
  min-height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #2d2d2d;
  background: #292929;
  display: flex;
  align-items: center;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-logo {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
}

.app-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #e5e5e5;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.header-btn {
  background: #3d3d3d;
  border: 1px solid #4d4d4d;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: #e5e5e5;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:hover:not(:disabled) {
  background: #4d4d4d;
}

.header-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: #0a84ff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.export-btn:hover {
  background: #0071e3;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #292929;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #3d3d3d;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.close-modal {
  background: none;
  border: none;
  color: #a0a0a0;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.close-modal:hover {
  background: #3d3d3d;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #3d3d3d;
  display: flex;
  justify-content: flex-end;
}

/* Icon Picker Modal */
#icon-picker-modal .modal-content {
  max-width: 600px;
  max-height: 85vh;
}

#icon-search {
  width: 100%;
  margin-bottom: 1rem;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.5rem;
  background: #1e1e1e;
  border: 2px solid #3d3d3d;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.icon-item:hover {
  background: #2d2d2d;
  border-color: #0a84ff;
  transform: translateY(-2px);
}

.icon-item i {
  font-size: 1.5rem;
  color: #e5e5e5;
  margin-bottom: 0.5rem;
}

.icon-item span {
  font-size: 0.65rem;
  color: #a0a0a0;
  word-break: break-word;
}

/* Builder */
.builder {
  display: flex;
  height: calc(100vh - 61px);
  max-height: calc(100vh - 61px);
}

.panel {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
  border-right: 1px solid #2d2d2d;
}

.panel-title {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #a0a0a0;
  text-transform: uppercase;
}

.panel-left {
  width: 260px;
  background: #252525;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

.panel-left-top {
  flex: 0 0 60%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #3d3d3d;
}

.panel-left-bottom {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
}

/* Root Navigator Styles */
.root-navigator {
  flex: 1;
  overflow-y: auto;
}

.navigator-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #666;
  font-size: 0.85rem;
}

.navigator-item {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  background: #2d2d2d;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #e5e5e5;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s;
}

.navigator-item:hover {
  background: #3d3d3d;
}

.navigator-item.selected {
  background: #0a84ff;
  color: white;
}

.navigator-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navigator-item-icon svg {
  width: 14px;
  height: 14px;
  stroke: #999;
}

.navigator-item.selected .navigator-item-icon svg {
  stroke: white;
}

.navigator-toggle {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  color: #999;
  user-select: none;
  flex-shrink: 0;
}

.navigator-toggle:hover {
  color: #e5e5e5;
}

.navigator-toggle.collapsed::before {
  content: '▶';
}

.navigator-toggle.expanded::before {
  content: '▼';
}

.navigator-item.has-children {
  padding-left: 0.5rem;
}

.navigator-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigator-item-type {
  font-size: 0.7rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.navigator-item.selected .navigator-item-type {
  color: rgba(255, 255, 255, 0.7);
}

.navigator-children {
  margin-left: 1rem;
  border-left: 1px solid #3d3d3d;
  padding-left: 0.5rem;
  margin-top: 0.25rem;
}

.navigator-children.collapsed {
  display: none;
}

.panel-center {
  flex: 1;
  background: #1e1e1e;
  border-right: none;
}

.panel-right {
  width: 280px;
  background: #252525;
  overflow-y: auto;
}

/* Resize Handles */
.resize-handle {
  background: #2d2d2d;
  position: relative;
  z-index: 100;
  transition: background 0.15s;
}

.resize-handle:hover {
  background: #4a9eff;
}

.resize-handle-vertical {
  width: 4px;
  cursor: ew-resize;
  flex-shrink: 0;
}

.resize-handle-horizontal {
  height: 4px;
  cursor: ns-resize;
  flex-shrink: 0;
  width: 100%;
}

.resize-handle:active {
  background: #4a9eff;
}

/* Widgets */
.widgets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.widget {
  padding: 0.75rem 0.5rem;
  border-radius: 6px;
  background: #1e1e1e;
  border: 1px solid #3d3d3d;
  font-size: 0.75rem;
  text-align: center;
  cursor: grab;
  user-select: none;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.widget-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.widget:hover {
  background: #2d2d2d;
  border-color: #0a84ff;
  transform: translateY(-1px);
}

.widget:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.hint {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: #808080;
  text-align: center;
}

/* Canvas Toolbar */
.canvas-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #2d2d2d;
}

.page-tabs {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  overflow-x: auto;
}

.tabs-container {
  display: flex;
  gap: 0.4rem;
  flex: 1;
  overflow-x: auto;
}

.page-tab {
  padding: 0.4rem 0.75rem;
  background: #2d2d2d;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  color: #a0a0a0;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  min-width: fit-content;
}

.page-tab:hover {
  background: #3d3d3d;
  color: #e5e5e5;
}

.page-tab.active {
  background: #0a84ff;
  border-color: #0a84ff;
  color: white;
}

.page-tab .close-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  margin-left: 0.25rem;
  opacity: 0.7;
  font-size: 1rem;
  line-height: 1;
  transition: opacity 0.15s;
}

.page-tab .close-btn:hover {
  opacity: 1;
}

.add-page-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 6px;
  background: #2d2d2d;
  border: 1px solid #3d3d3d;
  color: #a0a0a0;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.add-page-btn svg {
  width: 14px;
  height: 14px;
}

.add-page-btn:hover {
  background: #3d3d3d;
  color: #e5e5e5;
}

.canvas-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.page-navigator {
  flex: 1;
  min-width: 150px;
  background: #2d2d2d;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: #a0a0a0;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.page-navigator:focus {
  border-color: #0a84ff;
}

.device-selector {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

#device-type {
  background: #2d2d2d;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: #a0a0a0;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

#device-type:focus {
  border-color: #0a84ff;
}

.zoom-controls {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

#zoom-level {
  font-size: 0.75rem;
  color: #a0a0a0;
  min-width: 45px;
  text-align: center;
}

.icon-btn {
  background: #2d2d2d;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  padding: 0.4rem;
  color: #a0a0a0;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: #3d3d3d;
  color: #e5e5e5;
}

.icon-btn.delete {
  color: #ff3b30;
  border-color: #ff3b30;
}

.icon-btn.delete:hover {
  background: rgba(255, 59, 48, 0.1);
  color: #ff5a4f;
  border-color: #ff5a4f;
}

/* Icon Circle Buttons */
.icon-btn-circle {
  background: none;
  border: none;
  color: #0a84ff;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn-circle:hover {
  color: #0071e3;
  transform: scale(1.1);
}

.icon-btn-circle.delete {
  color: #ff3b30;
}

.icon-btn-circle.delete:hover {
  color: #ff5a4f;
  transform: scale(1.1);
}

/* Draggable Item Styling */
.toolbar-item-wrapper,
.sidebar-item-wrapper,
.menu-item-wrapper,
.appbar-action-wrapper {
  cursor: move;
  transition: all 0.2s;
}

.toolbar-item-wrapper.dragging,
.sidebar-item-wrapper.dragging,
.menu-item-wrapper.dragging,
.appbar-action-wrapper.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.toolbar-item-wrapper:hover,
.sidebar-item-wrapper:hover,
.menu-item-wrapper:hover,
.appbar-action-wrapper:hover {
  transform: translateY(-1px);
}

/* Drag handle icon */
.drag-handle {
  color: #666;
  cursor: move;
  font-size: 1rem;
  margin-right: 0.5rem;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.drag-handle:hover {
  opacity: 1;
}

/* Canvas */
.canvas-wrapper {
  flex: 1;
  margin-top: 0.75rem;
  overflow: auto;
  padding: 1rem;
  background: #1a1a1a;
  border-radius: 8px;
}

.canvas {
  background: white;
  border-radius: 4px;
  padding: 1rem;
  min-height: 600px;
  margin: 0 auto;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transform-origin: top center;
  position: relative;
  overflow: hidden;
}

.canvas > * {
  max-width: 100%;
  box-sizing: border-box;
}

.canvas .canvas-element {
  max-width: calc(100% - 40px);
}

/* Device sizes with borders */
.canvas.phone {
  width: 375px;
  min-height: 667px;
  border: 12px solid #1e1e1e;
  border-radius: 36px;
  box-shadow: 0 0 0 2px #3d3d3d, 0 4px 12px rgba(0, 0, 0, 0.4);
  position: relative;
}

.canvas.phone::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: #2d2d2d;
  border-radius: 2px;
}

.canvas.phone.landscape {
  width: 667px;
  min-height: 375px;
  border: 12px solid #1e1e1e;
  border-radius: 36px;
}

.canvas.phone.landscape::before {
  top: 50%;
  left: -8px;
  transform: translateY(-50%);
  width: 4px;
  height: 80px;
}

.canvas.tablet {
  width: 768px;
  min-height: 1024px;
  border: 16px solid #1e1e1e;
  border-radius: 24px;
  box-shadow: 0 0 0 2px #3d3d3d, 0 4px 16px rgba(0, 0, 0, 0.4);
}

.canvas.tablet.landscape {
  width: 1024px;
  min-height: 768px;
  border: 16px solid #1e1e1e;
  border-radius: 24px;
}

.canvas.laptop {
  width: 1280px;
  min-height: 720px;
  border: 8px solid #2d2d2d;
  border-radius: 8px;
  box-shadow: 0 0 0 1px #4d4d4d, 0 4px 20px rgba(0, 0, 0, 0.5);
  position: relative;
}

.canvas.laptop::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: -50px;
  right: -50px;
  height: 8px;
  background: linear-gradient(to bottom, #2d2d2d, #1e1e1e);
  border-radius: 0 0 12px 12px;
}

.canvas.desktop {
  width: 100%;
  max-width: 1920px;
  min-height: 800px;
  border: 2px solid #2d2d2d;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.canvas-placeholder {
  color: #999;
  text-align: center;
  padding: 3rem 1rem;
  border-radius: 8px;
  border: 2px dashed #e0e0e0;
  font-size: 0.9rem;
}

.canvas.drag-over {
  border-color: #0a84ff !important;
  background: #f5f5f5;
}

.canvas-element {
  margin: 0.5rem 0;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: move;
  transition: all 0.15s;
  position: relative;
  color: #000;
}

.canvas-element:hover {
  border-color: #0a84ff;
  background: rgba(10, 132, 255, 0.05);
}

.canvas-element.selected {
  border-color: #0a84ff;
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.2);
  background: rgba(10, 132, 255, 0.08);
}

.canvas-element.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

/* Layout elements */
.canvas-element.layout-row,
.canvas-element.layout-column,
.canvas-element.layout-stack {
  min-height: 100px;
  background: #f9f9f9;
  border: 1px dashed #ccc;
  position: relative;
}

.canvas-element.layout-row {
  display: flex;
  gap: 0.5rem;
  flex-direction: row;
}

.canvas-element.layout-column {
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
}

.canvas-element.layout-stack {
  position: relative;
  display: block;
}

.canvas-element.layout-stack > * {
  margin: 0;
}

/* Drop zones for nested layouts */
.layout-row.drag-over,
.layout-column.drag-over,
.layout-stack.drag-over {
  background: #e8f4ff !important;
  border-color: #0a84ff !important;
}

/* Stack child positioning */
.stack-child {
  position: absolute !important;
  margin: 0 !important;
}

/* Layout badges */
.layout-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(10, 132, 255, 0.9);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 10;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* TextField Wrapper */
.textfield-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.5rem;
  background: white;
}

.textfield-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
}

.textfield-wrapper i {
  color: #999;
}

/* List Tile */
.list-tile {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  gap: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.list-tile:hover {
  background: #f5f5f5;
}

.list-tile i:first-child {
  font-size: 1.5rem;
  color: #007aff;
  width: 40px;
  text-align: center;
}

.list-tile > div {
  flex: 1;
}

.list-tile i:last-child {
  font-size: 1.2rem;
  color: #999;
}

/* Desktop UI Elements Styles */

/* Sidebar */
.desktop-sidebar {
  display: flex;
  background: #f5f5f5;
  border-right: 1px solid #e0e0e0;
  min-height: 400px;
  width: 250px;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
}

.sidebar-items {
  flex: 1;
  padding: 0.5rem 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #333;
  font-size: 0.85rem;
}

.sidebar-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.sidebar-item.active {
  background: #007aff;
  color: white;
}

.sidebar-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

/* Toolbar */
.desktop-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
}

.toolbar-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  background: white;
  border: 1px solid #d0d0d0;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  color: #333;
}

.toolbar-item:hover {
  background: #e8e8e8;
  border-color: #b0b0b0;
}

.toolbar-item i {
  font-size: 0.9rem;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: #d0d0d0;
  margin: 0 0.25rem;
}

/* Pulldown Menu Button */
.desktop-pulldown {
  position: relative;
  display: inline-block;
}

.pulldown-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #f5f5f5;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  color: #333;
  font-weight: 500;
}

.pulldown-button:hover {
  background: #e8e8e8;
  border-color: #b0b0b0;
}

.pulldown-button i.fa-chevron-down {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.pulldown-button.active i.fa-chevron-down {
  transform: rotate(180deg);
}

.pulldown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  overflow: hidden;
  z-index: 100;
}

.pulldown-menu-item {
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.85rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pulldown-menu-item:hover {
  background: #f5f5f5;
}

.pulldown-menu-item i {
  width: 16px;
  text-align: center;
  font-size: 0.9rem;
}

.pulldown-menu-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 0.25rem 0;
}

/* Popup Menu */
.desktop-popupmenu {
  position: relative;
  display: inline-block;
}

.popupmenu-trigger {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #007aff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  font-weight: 500;
}

.popupmenu-trigger:hover {
  background: #0066d6;
}

.popupmenu-trigger i {
  font-size: 0.9rem;
}

.popup-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  min-width: 220px;
  overflow: hidden;
  z-index: 100;
}

.popup-menu-item {
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.85rem;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.popup-menu-item:hover {
  background: #f5f5f5;
}

.popup-menu-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.popup-menu-item i {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
}

.popup-menu-item-shortcut {
  font-size: 0.75rem;
  color: #999;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.popup-menu-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 0.25rem 0;
}

/* Properties Panel */
.no-selection {
  font-size: 0.8rem;
  color: #808080;
  padding: 1rem;
  text-align: center;
  border-radius: 8px;
  background: #1e1e1e;
  border: 1px solid #3d3d3d;
}

.no-selection p {
  margin: 0.5rem 0;
}

.properties-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 0.8rem;
}

.properties-form.disabled {
  display: none;
}

.properties-section {
  padding-top: 1rem;
  border-top: 1px solid #3d3d3d;
}

.section-title {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #a0a0a0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.75rem;
  color: #a0a0a0;
  font-weight: 500;
}

.field small {
  font-size: 0.7rem;
  color: #808080;
}

.element-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.element-badge {
  background: #3d3d3d;
  border: 1px solid #4d4d4d;
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  font-size: 0.7rem;
  color: #e5e5e5;
  font-weight: 500;
}

.element-actions {
  display: flex;
  gap: 0.4rem;
}

input[type="text"],
input[type="number"],
textarea,
select {
  background: #1e1e1e;
  border-radius: 6px;
  border: 1px solid #3d3d3d;
  padding: 0.5rem;
  color: #e5e5e5;
  font-family: inherit;
  font-size: 0.8rem;
  outline: none;
  transition: all 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: #0a84ff;
  background: #252525;
}

textarea {
  resize: vertical;
  font-family: 'SF Mono', 'Consolas', monospace;
}

input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #3d3d3d;
  background: transparent;
  cursor: pointer;
}

input[type="file"] {
  font-size: 0.75rem;
  color: #a0a0a0;
}

input[type="range"] {
  width: 100%;
}

input[type="checkbox"] {
  cursor: pointer;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#opacity-value {
  font-size: 0.75rem;
  color: #a0a0a0;
  min-width: 40px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.stack-position-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.stack-position-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #0a84ff;
  color: white;
}

.btn-primary:hover {
  background: #0071e3;
}

.btn-secondary {
  background: #3d3d3d;
  color: #e5e5e5;
  border: 1px solid #4d4d4d;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background: #4d4d4d;
  border-color: #0a84ff;
}

/* Canvas Element Defaults */
.canvas-element h1,
.canvas-element h2,
.canvas-element h3,
.canvas-element p {
  margin: 0;
  color: #000;
}

.canvas-element a {
  color: #007aff;
  text-decoration: none;
}

.canvas-element a:hover {
  text-decoration: underline;
}

.canvas-element hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 1rem 0;
}

.canvas-element ul,
.canvas-element ol {
  margin: 0;
  padding-left: 1.5rem;
}

.canvas-element img {
  display: block;
  object-fit: cover;
}

.canvas-element video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
  background: #4d4d4d;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5d5d5d;
}

/* Responsive */
@media (max-width: 1024px) {
  .panel-left {
    width: 220px;
  }
  
  .panel-right {
    width: 240px;
  }
}

@media (max-width: 768px) {
  .builder {
    flex-direction: column;
    height: auto;
    max-height: unset;
  }

  .panel-left,
  .panel-right {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #2d2d2d;
  }

  .panel-center {
    order: -1;
    min-height: 500px;
  }
}

/* Element Search */
.element-search-container {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #2d2d2d;
}

#element-search {
  width: 100%;
  padding: 0.5rem;
  background: #1e1e1e;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  color: #e5e5e5;
  font-size: 0.85rem;
}

#element-search:focus {
  outline: none;
  border-color: #0a84ff;
}

/* Preview Modal */
.preview-modal {
  background: rgba(0, 0, 0, 0.95);
}

.preview-modal .modal-content {
  max-width: none;
  width: 100%;
  height: 100%;
  max-height: 100vh;
  margin: 0;
}

.preview-modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #1e1e1e;
  border-radius: 0;
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #2d2d2d;
  border-bottom: 1px solid #3d3d3d;
}

.preview-controls-left,
.preview-controls-center,
.preview-controls-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.preview-device-select {
  padding: 0.4rem 0.6rem;
  background: #3d3d3d;
  border: 1px solid #4d4d4d;
  border-radius: 6px;
  color: #e5e5e5;
  font-size: 0.85rem;
  cursor: pointer;
}

.preview-device-select:focus {
  outline: none;
  border-color: #0a84ff;
}

.preview-btn {
  background: #3d3d3d;
  border: 1px solid #4d4d4d;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: #e5e5e5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.preview-btn:hover {
  background: #4d4d4d;
}

#preview-zoom-level {
  font-size: 0.85rem;
  color: #e5e5e5;
  min-width: 50px;
  text-align: center;
}

.preview-wrapper {
  flex: 1;
  overflow: auto;
  background: #1e1e1e;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.preview-canvas {
  background: white;
  min-height: 100%;
  width: 100%;
  height: 100%;
  overflow: auto;
  transition: transform 0.2s;
  position: relative;
}

.preview-canvas > * {
  max-width: 100%;
  box-sizing: border-box;
}

.preview-canvas.phone {
  width: 375px;
  height: 100%;
}

.preview-canvas.tablet {
  width: 1024px;
  height: 100%;
}

.preview-canvas.laptop {
  width: 1920px;
  height: 100%;
}

.preview-canvas.desktop {
  width: 100%;
  height: 100%;
}

/* Tooltip styles for canvas elements */
.canvas-element.tooltip-container {
  position: relative;
  display: inline-block;
  cursor: help;
}

.canvas-element .tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.canvas-element .tooltip-bubble {
  position: absolute;
  background: #333;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.canvas-element .tooltip-wrapper:hover .tooltip-bubble {
  opacity: 1;
}

.canvas-element .tooltip-bubble.top {
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
}

.canvas-element .tooltip-bubble.bottom {
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
}

.canvas-element .tooltip-bubble.left {
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 8px;
}

.canvas-element .tooltip-bubble.right {
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
}

/* Tap Detector styles */
.canvas-element.tap-detector {
  padding: 1rem;
  border: 2px dashed #0a84ff;
  border-radius: 8px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(10, 132, 255, 0.05);
}

.canvas-element.tap-detector:hover {
  background: rgba(10, 132, 255, 0.1);
  border-color: #0071e3;
}

.canvas-element.tap-detector::before {
  content: '👆 Tap Detector';
  color: #0a84ff;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Custom DateTime Picker styles */
.custom-datetime-picker {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 320px;
}

.datetime-display {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.datetime-display-date {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.25rem;
}

.datetime-display-time {
  font-size: 1rem;
  color: #666;
}

.datetime-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  background: #f5f5f5;
  padding: 0.25rem;
  border-radius: 8px;
}

.datetime-tab {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: #666;
  transition: all 0.2s;
}

.datetime-tab.active {
  background: white;
  color: #007aff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.datetime-tab:hover:not(.active) {
  color: #333;
}

.datetime-content {
  min-height: 260px;
}

.datetime-panel {
  display: none;
}

.datetime-panel.active {
  display: block;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.calendar-nav-btn {
  background: transparent;
  border: none;
  color: #007aff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.calendar-nav-btn:hover {
  background: #f0f0f0;
}

.calendar-month-year {
  font-weight: 600;
  color: #333;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.calendar-day-name {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #999;
  padding: 0.5rem;
}

.calendar-day {
  aspect-ratio: 1;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: #333;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day:hover:not(.disabled) {
  background: #f0f0f0;
}

.calendar-day.selected {
  background: #007aff;
  color: white;
  font-weight: 600;
}

.calendar-day.today {
  border: 2px solid #007aff;
}

.calendar-day.disabled {
  color: #ccc;
  cursor: not-allowed;
}

.time-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
}

.time-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.time-label {
  font-size: 0.75rem;
  color: #999;
  text-transform: uppercase;
  font-weight: 600;
}

.time-value {
  font-size: 2.5rem;
  font-weight: 600;
  color: #333;
  text-align: center;
  min-width: 60px;
}

.time-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.time-control-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e0e0e0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #007aff;
  transition: all 0.2s;
}

.time-control-btn:hover {
  background: #f0f0f0;
  border-color: #007aff;
}

.time-separator {
  font-size: 2rem;
  color: #999;
  align-self: center;
}

.datetime-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

.datetime-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.datetime-btn-secondary {
  background: #f5f5f5;
  color: #666;
}

.datetime-btn-secondary:hover {
  background: #e0e0e0;
}

.datetime-btn-primary {
  background: #007aff;
  color: white;
}

.datetime-btn-primary:hover {
  background: #0066cc;
}

/* API Calls Section */
.api-calls-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.api-call-item {
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  padding: 0.75rem;
  background: #1e1e1e;
  transition: all 0.2s;
}

.api-call-item:hover {
  border-color: #505050;
  background: #252525;
}

.api-call-item label {
  font-size: 0.7rem;
  color: #a0a0a0;
  margin-bottom: 0.25rem;
  display: block;
  font-weight: 500;
}

.api-call-item input[type="text"],
.api-call-item textarea,
.api-call-item select {
  width: 100%;
  background: #252525;
  border: 1px solid #3d3d3d;
  border-radius: 4px;
  padding: 0.4rem;
  color: #e5e5e5;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.api-call-item textarea {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  resize: vertical;
  min-height: 50px;
}

.api-call-item input[type="text"]:focus,
.api-call-item textarea:focus,
.api-call-item select:focus {
  border-color: #0a84ff;
  background: #2a2a2a;
  outline: none;
}

.api-call-header {
  cursor: pointer;
  user-select: none;
}

.api-call-header:hover .collapse-arrow {
  stroke: #0a84ff;
}

.collapse-arrow {
  transition: transform 0.2s, stroke 0.2s;
  stroke: #a0a0a0;
  flex-shrink: 0;
}

.api-name {
  transition: background 0.2s;
  cursor: text;
}

.api-name:hover {
  background: #2a2a2a !important;
}

.api-name:focus {
  outline: 1px solid #0a84ff;
  outline-offset: 0;
}

.api-call-content {
  transition: opacity 0.2s;
}

.remove-api-call {
  background: none;
  border: none;
  color: #ff4444;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
  flex-shrink: 0;
}

.remove-api-call:hover {
  color: #ff6666;
  transform: scale(1.1);
}

/* Loading Spinner Animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Functions Modal */
.functions-modal-content {
  max-width: 90vw;
  width: 1200px;
  max-height: 85vh;
}

.functions-modal-body {
  display: flex;
  gap: 1rem;
  padding: 0;
  height: 70vh;
}

.functions-sidebar {
  width: 250px;
  padding: 1rem;
  border-right: 1px solid #3d3d3d;
  overflow-y: auto;
  flex-shrink: 0;
}

.functions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.function-list-item {
  padding: 0.75rem;
  background: #3d3d3d;
  border: 1px solid #4d4d4d;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.function-list-item:hover {
  background: #4d4d4d;
}

.function-list-item.active {
  background: #0a84ff;
  border-color: #0a84ff;
}

.function-list-item-name {
  font-weight: 500;
  font-size: 0.9rem;
}

.function-list-item-actions {
  display: flex;
  gap: 0.25rem;
}

.function-list-item-btn {
  background: none;
  border: none;
  color: #a0a0a0;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.function-list-item-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e5e5;
}

.function-list-item-btn.delete:hover {
  color: #ff6666;
}

.function-editor {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.function-flow-area {
  margin-top: 1.5rem;
}

.function-flow-canvas {
  background: #1e1e1e;
  border: 1px solid #3d3d3d;
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 400px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.flow-start-node {
  background: linear-gradient(135deg, #0a84ff 0%, #0071e3 100%);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

.add-action-btn {
  background: #3d3d3d;
  border: 2px dashed #4d4d4d;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #a0a0a0;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.add-action-btn:hover {
  background: #4d4d4d;
  border-color: #0a84ff;
  color: #e5e5e5;
}

.flow-actions-palette {
  margin-top: 1.5rem;
  background: #2a2a2a;
  border: 1px solid #3d3d3d;
  border-radius: 8px;
  padding: 1rem;
}

.flow-actions-palette h4 {
  margin: 0 0 1rem 0;
  font-size: 0.85rem;
  color: #808080;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.flow-action-item {
  background: #3d3d3d;
  border: 1px solid #4d4d4d;
  border-left: 3px solid #4d4d4d;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  user-select: none;
}

.flow-action-item:hover {
  background: #4d4d4d;
  border-left-color: #0a84ff;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(10, 132, 255, 0.2);
}

.flow-action-item:active {
  transform: scale(0.98);
}

.flow-action-item svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.flow-action-item:hover svg {
  opacity: 1;
}

.flow-action-node {
  background: #3d3d3d;
  border: 2px solid #4d4d4d;
  border-left: 4px solid #0a84ff;
  border-radius: 8px;
  padding: 1rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  cursor: move;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.flow-action-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Action color variations */
.flow-action-node.action-color-blue {
  border-left-color: #0a84ff;
}

.flow-action-node.action-color-orange {
  border-left-color: #ff9500;
}

.flow-action-node.action-color-green {
  border-left-color: #30d158;
}

.flow-action-node.action-color-purple {
  border-left-color: #bf5af2;
}

.flow-action-node.action-color-pink {
  border-left-color: #ff375f;
}

.flow-action-node.action-color-red {
  border-left-color: #ff453a;
}

.flow-action-node.action-color-gray {
  border-left-color: #8e8e93;
}

.flow-action-node.action-color-default {
  border-left-color: #0a84ff;
}

.flow-action-node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.flow-action-node-drag-handle {
  color: #808080;
  cursor: grab;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.flow-action-node-drag-handle:hover {
  background: #4d4d4d;
  color: #e5e5e5;
}

.flow-action-node-drag-handle:active {
  cursor: grabbing;
}

.flow-action-node-type {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e5e5e5;
  flex: 1;
  font-size: 0.9rem;
}

.flow-action-node-remove {
  background: none;
  border: none;
  color: #a0a0a0;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.flow-action-node-remove:hover {
  background: #4d4d4d;
  color: #ff6666;
}

.flow-action-node-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flow-field {
  display: flex;
  flex-direction: column;
}

.flow-input {
  background: #2a2a2a;
  border: 1px solid #4d4d4d;
  border-radius: 6px;
  padding: 0.5rem;
  color: #e5e5e5;
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

.flow-input:focus {
  border-color: #0a84ff;
  background: #1e1e1e;
}

.flow-input::placeholder {
  color: #666;
}

.flow-connector {
  width: 2px;
  height: 20px;
  background: linear-gradient(to bottom, #4d4d4d 0%, #4d4d4d 100%);
  margin: 0 auto;
}

/* Bottom Panel (VS Code style) */
.bottom-panel {
  background: #1e1e1e;
  border-top: 1px solid #3d3d3d;
  display: flex;
  flex-direction: column;
  height: 250px;
  min-height: 100px;
  max-height: 500px;
}

.bottom-panel.collapsed {
  height: 35px;
  min-height: 35px;
}

.bottom-panel-header {
  padding: 0;
  background: #252525;
  border-bottom: 1px solid #3d3d3d;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  height: 35px;
}

.bottom-panel-tabs {
  display: flex;
  gap: 0;
  height: 100%;
}

.bottom-panel-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #808080;
  cursor: pointer;
  padding: 0 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.3px;
  height: 100%;
}

.bottom-panel-tab:hover {
  color: #e5e5e5;
  background: rgba(255, 255, 255, 0.05);
}

.bottom-panel-tab.active {
  color: #e5e5e5;
  border-bottom-color: #0a84ff;
  background: #1e1e1e;
}

.bottom-panel-tab-badge {
  background: #3d3d3d;
  color: #e5e5e5;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.bottom-panel-tab.active .bottom-panel-tab-badge {
  background: #0a84ff;
}

.bottom-panel-actions {
  display: flex;
  gap: 0.25rem;
  padding: 0 0.5rem;
}

.bottom-panel-btn {
  background: none;
  border: none;
  color: #808080;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-panel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e5e5;
}

.bottom-panel-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.bottom-panel-pane {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 0.75rem;
}

.bottom-panel-pane.active {
  display: block;
}

.bottom-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #808080;
}

.bottom-panel-empty p {
  margin: 0.5rem 0 0 0;
  font-size: 0.9rem;
}

.error-item {
  background: #2a2a2a;
  border-left: 3px solid #ff6666;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.error-item.warning {
  border-left-color: #ffcc00;
}

.error-item.info {
  border-left-color: #0a84ff;
}

.error-item-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.5rem;
}

.error-item-type {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.error-item.error .error-item-type {
  color: #ff6666;
}

.error-item.warning .error-item-type {
  color: #ffcc00;
}

.error-item.info .error-item-type {
  color: #0a84ff;
}

.error-item-message {
  color: #e5e5e5;
  line-height: 1.4;
}

.error-item-location {
  color: #808080;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  font-family: monospace;
}

/* Console Output */
.console-output {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

.console-log-item {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  gap: 0.75rem;
}

.console-log-item.error {
  background: rgba(255, 102, 102, 0.1);
  color: #ff6666;
}

.console-log-item.warn {
  background: rgba(255, 204, 0, 0.1);
  color: #ffcc00;
}

.console-log-item.info {
  color: #0a84ff;
}

.console-log-time {
  color: #808080;
  font-size: 0.75rem;
  min-width: 60px;
}

/* Test API Container */
.test-api-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  height: 100%;
}

.test-api-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-api-form .field {
  margin-bottom: 0;
}

.test-api-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: #a0a0a0;
}

.test-api-form input,
.test-api-form select,
.test-api-form textarea {
  width: 100%;
  background: #2a2a2a;
  border: 1px solid #3d3d3d;
  color: #e5e5e5;
  padding: 0.5rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

.test-api-response {
  display: flex;
  flex-direction: column;
  background: #252525;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  overflow: hidden;
}

.test-api-response h4 {
  margin: 0;
  padding: 0.75rem;
  background: #2a2a2a;
  border-bottom: 1px solid #3d3d3d;
  font-size: 0.85rem;
  color: #a0a0a0;
}

.test-api-response-content {
  flex: 1;
  padding: 0.75rem;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

.test-api-response-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Adjust panel-center to accommodate bottom panel */
.panel-center {
  display: flex;
  flex-direction: column;
}

.canvas-wrapper {
  flex: 1;
  overflow: auto;
  min-height: 300px;
}

#resize-error-panel {
  cursor: ns-resize;
}

/* Carousel Styles */
.carousel-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #1e1e1e;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
}

.carousel-slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e1e1e;
}

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 18px;
  border-radius: 4px;
  z-index: 10;
  transition: background 0.3s ease;
}

.carousel-control:hover {
  background: rgba(0, 0, 0, 0.8);
}

.carousel-prev {
  left: 10px;
}

.carousel-next {
  right: 10px;
}

.carousel-indicators {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.carousel-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.3s ease;
}

.carousel-indicator:hover {
  background: rgba(255, 255, 255, 0.8);
}

.carousel-indicator.active {
  background: white;
}

.carousel-item-wrapper {
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: #1e1e1e;
}

.carousel-item-wrapper:hover {
  border-color: #007aff;
}

/* Builder AI Styles */
.builder-ai-container {
  display: flex;
  height: 100%;
  gap: 0;
}

.builder-ai-input-section {
  display: flex;
  flex-direction: column;
  min-width: 200px;
  width: 50%;
  height: 100%;
  position: relative;
}

.builder-ai-prompt-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0.5rem;
}

.builder-ai-prompt-container textarea {
  flex: 1;
  width: 100%;
  background: #2a2a2a;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  color: #e5e5e5;
  padding: 0.75rem;
  padding-bottom: 2.5rem;
  font-size: 0.85rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  resize: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.builder-ai-prompt-container textarea:focus {
  outline: none;
  border-color: #0a84ff;
}

.builder-ai-prompt-container textarea::placeholder {
  color: #606060;
}

.builder-ai-actions {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.builder-ai-attach-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3d3d3d;
  border: none;
  color: #a0a0a0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 12px;
}

.builder-ai-attach-btn:hover {
  background: #4d4d4d;
  color: #e5e5e5;
}

.builder-ai-attach-btn.has-image {
  background: #0a84ff;
  color: white;
}

.builder-ai-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0a84ff;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 14px;
}

.builder-ai-send-btn:hover {
  background: #0071e3;
  transform: scale(1.05);
}

.builder-ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.builder-ai-send-btn.loading i {
  animation: pulse 1s ease-in-out infinite;
}

.builder-ai-image-preview {
  position: absolute;
  bottom: 2.75rem;
  right: 0.75rem;
  background: #2a2a2a;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.builder-ai-image-preview img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}

.builder-ai-remove-image {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff6666;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.2s;
}

.builder-ai-remove-image:hover {
  background: #ff4444;
  transform: scale(1.1);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.builder-ai-resize-handle {
  width: 4px;
  background: #3d3d3d;
  cursor: col-resize;
  transition: background 0.2s;
  flex-shrink: 0;
}

.builder-ai-resize-handle:hover {
  background: #0a84ff;
}

.builder-ai-options {
  display: none;
}

.builder-ai-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #0a84ff;
  cursor: pointer;
}

.builder-ai-checkbox span {
  user-select: none;
}

.builder-ai-output-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 200px;
  height: 100%;
  overflow: hidden;
}

.builder-ai-output {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  background: #1e1e1e;
}

.builder-ai-output pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e5e5e5;
}

.builder-ai-output code {
  background: #1e1e1e;
  padding: 0.75rem;
  border-radius: 4px;
  display: block;
  overflow-x: auto;
}

.builder-ai-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #808080;
}

.builder-ai-placeholder p {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

.builder-ai-placeholder .builder-ai-hint {
  font-size: 0.75rem;
  color: #606060;
  margin-top: 0.25rem;
}

.builder-ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
}

.builder-ai-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #3d3d3d;
  border-top-color: #0a84ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.builder-ai-loading-text {
  color: #808080;
  font-size: 0.85rem;
}

.builder-ai-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #ff6666;
  padding: 1rem;
}

.builder-ai-error svg {
  margin-bottom: 0.5rem;
}

.builder-ai-status-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.builder-ai-preview {
  border: 1px solid #3d3d3d;
  border-radius: 4px;
  padding: 1rem;
  background: #ffffff;
  margin-bottom: 0.5rem;
}

.builder-ai-code-block {
  position: relative;
}

.builder-ai-code-label {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.65rem;
  color: #606060;
  background: #2a2a2a;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}