/* Reset & base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #181818;
  color: #d4d4d4;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', 'Menlo', monospace;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top bar */
#top-bar {
  height: 38px;
  min-height: 38px;
  background: #252526;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  padding: 0 16px;
  -webkit-app-region: drag;
}

.app-logo {
  height: 22px;
  width: 22px;
  margin-right: 8px;
  border-radius: 4px;
}

.app-title {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Editor wrapper */
#editor-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Editor container */
#editor {
  width: 100%;
  height: 100%;
}

/* Editor hint / watermark */
#editor-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #444;
  font-size: 14px;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1;
  white-space: nowrap;
}

#editor-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

#editor-hint kbd {
  background: #2a2a2a;
  border: 1px solid #444;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 2px 8px;
  font-family: inherit;
  font-size: 12px;
  color: #777;
  margin: 0 2px;
}

/* Status bar */
#status-bar {
  height: 26px;
  min-height: 26px;
  background: #21252b;
  border-top: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: #666;
}

#credit {
  color: #777;
  font-size: 11px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

#credit .heart {
  color: #e25555;
  font-size: 13px;
  display: inline-block;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.credit-link {
  color: #666;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s ease;
  margin-left: 2px;
}

.credit-link:hover {
  color: #d4d4d4;
}

#shortcut-hint {
  color: #555;
  font-size: 11px;
  letter-spacing: 0.3px;
}

/* Command Palette Overlay */
#command-palette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 1000;
}

#command-palette.hidden {
  display: none;
}

#palette-container {
  width: 100%;
  max-width: 500px;
  background: #252526;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Search input */
#search {
  width: 100%;
  padding: 14px 16px;
  background: #2d2d2d;
  color: #d4d4d4;
  border: none;
  border-bottom: 1px solid #333;
  outline: none;
  font-family: inherit;
  font-size: 14px;
}

#search::placeholder {
  color: #666;
}

/* Results list */
#results {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 0;
}

#results::-webkit-scrollbar {
  width: 6px;
}

#results::-webkit-scrollbar-track {
  background: transparent;
}

#results::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

#results li {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.1s ease;
}

#results li:hover {
  background: #2a2d2e;
}

#results li.active {
  background: #094771;
}

#results li .script-name {
  font-size: 13px;
  color: #d4d4d4;
  font-weight: 500;
}

#results li .script-desc {
  font-size: 11px;
  color: #888;
}

#results li.active .script-desc {
  color: #aaa;
}

/* Toast notifications */
#toast {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast-message {
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  color: #fff;
  pointer-events: auto;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  white-space: nowrap;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-message.error {
  background: #c0392b;
}

.toast-message.info {
  background: #2980b9;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}
