/* Global styles */
* {
  box-sizing: border-box;
}
body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f9f9f9;
  color: #000;
}
:root {
  /* Custom property for viewport height */
  --vh: 1vh;
}

/* Top bar */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: #fff;
  border-bottom: 3px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10001;
}
#top-logo {
  height: 30px;
}
#omni-input {
  flex: 1;
  margin-left: 20px;
  padding: 8px 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Omnibar processing effect */
@keyframes omni-processing {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
#omni-input.processing {
  animation: omni-processing 2s ease infinite;
  background: linear-gradient(90deg, #FF00FF, #00FFFF, #FF00FF);
  background-size: 200% 200%;
  color: #fff;
  border-color: #fff;
}
/* Preview iframe */
#preview {
  position: fixed;
  top: 60px;
  left: 0;
  width: 100vw;
  height: calc(var(--vh, 1vh) * 100 - 60px);
  border: none;
}
/* Settings icon button in top bar */
#chat-toggle {
  position: static;
  margin-left: 20px;
  background: transparent;
  color: #000;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
/* Fullscreen Edit Panel */
.chat-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  /* Use custom viewport height for better mobile support */
  height: calc(var(--vh, 1vh) * 100);
  background: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: auto;
}
.chat-modal.hidden {
  display: none;
}
.chat-header {
  padding: 15px;
  background: #fff;
  color: #000;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  border-bottom: 1px solid #ddd;
}
.chat-close {
  background: transparent;
  border: none;
  color: #000;
  font-size: 24px;
  cursor: pointer;
}
/* Tabs styling */
.chat-tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
}
.tab-button {
  flex: 1;
  padding: 15px;
  background: #fff;
  color: #000;
  border: 1px solid #ddd;
  border-bottom: none;
  cursor: pointer;
  font-size: 16px;
}
.tab-button.active {
  border-bottom: 3px solid #000;
  font-weight: bold;
}
.chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 15px;
}
.tab-content {
  flex: 1;
  display: none;
  flex-direction: column;
  height: 100%;
}
.tab-content.active {
  display: flex;
}
/* Chat Tab */
#chat-log {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: #fff;
  font-size: 14px;
}
.message {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 4px;
  max-width: 80%;
  word-break: break-all;
}
.user-message {
  background: #e9e9e9;
  align-self: flex-end;
}
.ai-message {
  background: #f1f1f1;
  align-self: flex-start;
  white-space: pre-wrap;
  font-family: monospace;
}
.chat-input-area {
  display: flex;
  border-top: 1px solid #ddd;
  padding-top: 10px;
}
/* Multi-line auto-resizing textarea */
#user-input {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: none;
  overflow: hidden;
  min-height: 50px;
}
#user-input:focus {
  outline: none;
  border-color: #000;
}
#send-btn {
  padding: 10px 15px;
  border: 1px solid #ddd;
  background: #fff;
  color: #000;
  cursor: pointer;
  font-size: 14px;
  margin-left: 10px;
}
/* Code Tab */
#code-editor {
  flex: 1;
  width: 100%;
  padding: 10px;
  font-family: monospace;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: none;
  outline: none;
}
#apply-code-btn {
  padding: 10px;
  border: 1px solid #ddd;
  background: #fff;
  color: #000;
  cursor: pointer;
  font-size: 14px;
  margin-top: 10px;
}
/* Instructions Tab */
#instructions-editor {
  flex: 1;
  width: 100%;
  padding: 10px;
  font-family: monospace;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: none;
  outline: none;
}
/* Settings Tab */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.settings-container label {
  font-size: 14px;
  font-weight: bold;
}
.settings-container input {
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
}
/* Touch-friendly adjustments */
button,
input,
textarea {
  touch-action: manipulation;
}
/* Mobile adjustments */
@media (max-width: 600px) {
  .chat-header,
  .chat-tabs,
  .chat-content,
  .chat-input-area {
    padding: 10px;
  }
  #chat-toggle {
    width: 50px;
    height: 50px;
    font-size: 14px;
  }
  .tab-button {
    padding: 10px;
    font-size: 14px;
  }
}
