* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
}

.hidden {
  display: none !important;
}

/* Login Screen */
.login-screen {
  width: 100%;
  height: 100%;
  background: #008080;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-window {
  min-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 12px;
}

/* Desktop */
.desktop {
  width: 100%;
  height: 100%;
  background: #008080;
  position: relative;
}

.desktop-icons {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  padding: 16px;
  height: calc(100% - 36px);
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  padding: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.15);
}

.desktop-icon.selected {
  background: #000080;
}

.desktop-icon.selected span {
  color: #fff;
}

.desktop-icon img {
  width: 32px;
  height: 32px;
  margin-bottom: 4px;
}

.desktop-icon span {
  font-size: 11px;
  color: #fff;
  text-align: center;
  text-shadow: 1px 1px 1px #000;
  word-break: break-word;
}

/* Taskbar */
.taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: #c0c0c0;
  border-top: 2px solid #fff;
  display: flex;
  align-items: center;
  padding: 2px 4px;
  z-index: 9999;
}

.start-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: bold;
  font-size: 11px;
  padding: 2px 6px;
  height: 28px;
  min-width: 60px;
}

.start-btn img {
  width: 16px;
  height: 16px;
}

.taskbar-windows {
  display: flex;
  flex: 1;
  gap: 2px;
  margin-left: 4px;
  overflow: hidden;
}

.taskbar-item {
  height: 24px;
  min-width: 100px;
  max-width: 160px;
  font-size: 11px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.taskbar-item.active {
  font-weight: bold;
}

.taskbar-clock {
  font-size: 11px;
  padding: 0 8px;
  border-left: 1px solid #808080;
  height: 24px;
  display: flex;
  align-items: center;
  min-width: 60px;
}

/* Windows */
.app-window {
  position: absolute;
  min-width: 200px;
  min-height: 100px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.app-window.focused {
  z-index: 1000;
}

.app-window .title-bar {
  cursor: move;
  user-select: none;
}

.app-window .title-bar-controls button {
  cursor: pointer;
}

.app-window .window-body {
  overflow: auto;
  position: relative;
}

.app-window .window-body.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}

.app-window .window-body.loading::after {
  content: "⏳ Generating UI...";
  font-size: 12px;
  color: #666;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Search Dialog */
.search-dialog {
  width: 360px;
}

.search-dialog .search-results {
  margin-top: 8px;
  min-height: 100px;
}

.search-dialog .search-result-item {
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-dialog .search-result-item:hover {
  background: #000080;
  color: #fff;
}

.search-dialog .search-result-item .result-icon {
  font-size: 18px;
}

/* AI content styles */
.ai-window-content {
  padding: 0;
}

.ai-window-content button {
  box-sizing: border-box;
  min-width: 0;
}

.ai-window-content button[data-action] {
  cursor: pointer;
}

.ai-window-content input,
.ai-window-content textarea,
.ai-window-content select {
  cursor: text;
}

/* Resize handle */
.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
}
