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

.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  z-index: 10;
}

.main-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  z-index: 10;
}

.main-content {
  flex: 1;
  padding-top: 50px;  /* exact cât nav */
  padding-bottom: 40px; /* exact cât footer */
  box-sizing: border-box;
  overflow: hidden;
}

.container {
  display: flex;
  flex: 1;
  gap: 0.5rem;
  padding: 0.5rem;
  height: calc(100vh - 90px); /* nav + footer */
  box-sizing: border-box;
}

.column {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  background: #fafafa;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px;
  min-height: 0;
  overflow: hidden;
}

.column.left {
  flex: 1;

}

.column.preview {
  flex: 1;

  background: #f1f8e9;
}

.column.chat {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.column.left .box {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
}

textarea {
  flex: 1;
  resize: none;
  font-family: monospace;
  font-size: 13px;
  width: 100%;
  border-radius: 8px;
}

input[type="text"] {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 13px;
  resize: none;
  box-sizing: border-box;
}

.preview-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  overflow: auto;
  position: relative;
  max-width: 100%;
  max-height: 100%;
}

.preview-wrapper iframe {
  display: block;
  margin: auto;
  border: none;
  max-width: 100%;
  max-height: 100%;
}

iframe {

  border: none;
  background: white;
}

#previewFrame {
  overflow: visible;
  display: block;
  border: none;
  max-width: none;
  max-height: none;
}

:fullscreen .preview-wrapper {
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

:fullscreen iframe {
  display: block;
  margin: auto;
  max-width: 100vw;
  max-height: 100vh;
}

.chat-output-area {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
  margin-bottom: 10px;
}

.chat-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding-top: 6px;
  width: 100%;
  box-sizing: border-box;
}


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

.fullscreen-btn {
  font-size: 12px;
  padding: 6px 10px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
}

.code-box {
  position: relative;
  background: #d0d0d0;
  border: 1px solid #c9d8e4;
  border-radius: 8px;
  padding: 20px;
  margin: 10px;
  overflow-x: auto;
}

.code-box pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-box .copy-btn {
  position: absolute;
  top: 30px;
  right: 30px;
  background-color: #007bff;
  color: white;
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
  z-index: 1;
}

.code-box .copy-btn:hover {
  background-color: #0056b3;
}

.chat-controls button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-controls button[type="submit"] {
  background-color: #c8f7c5;
  color: #1b5e20;
}

.chat-controls button[type="submit"]:hover {
  background-color: #a5d6a7;
}

.chat-controls button[type="button"] {
  background-color: #f8d7da;
  color: #842029;
}

.chat-controls button[type="button"]:hover {
  background-color: #f1b0b7;
}

#sendButton {
  background-color: #c8f7c5;
  color: #1b5e20;
  border:1px solid #1b5e20;
}

#sendButton:hover {
  background-color: #a5d6a7;
}

#clearChat {
  background-color: #f8d7da;
  color: #842029;
  border:1px solid #842029;
}

#clearChat:hover {
  background-color: #f1b0b7;
}

#chatInput {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 13px;
  resize: none;
  box-sizing: border-box;
  min-height: 36px;
  height: 36px;
}

.gpt-typing {
  font-style: italic;
  color: #777;
  padding: 5px 10px;
  animation: blink 1.2s infinite steps(1, start);
}

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