/* Updated style.css for full UI/UX fixes and clean production layout */

:root {
  --background-light: #ffffff;
  --text-primary: #000000;
  --text-secondary: #555555;
  --border-color: #e9e9eb;
  --font-main: 'Inter', sans-serif;
  --accent-red: #c53030;
  --user-bubble-bg: #007aff;
  --assistant-bubble-bg: #f0f0f0;
}

body {
  background-color: var(--background-light);
  font-family: var(--font-main);
  color: var(--text-primary);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app-container {
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

#sub-header {
  text-align: center;
  padding: 1.5rem 0 1rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

#sub-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

#sub-header h2 {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

#chat-container {
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  flex-grow: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: var(--background-light);
  max-height: 70vh;
}

#chat-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 768px;
  margin: 0 auto;
  padding: 1rem;
}

.message-bubble {
  max-width: 80%;
  padding: 1rem;
  border-radius: 1rem;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-family: 'Inter', sans-serif;
}

.user-bubble {
  align-self: flex-end;
  background-color: var(--user-bubble-bg);
  color: white;
  text-align: right;
  border-top-right-radius: 0;
}

.assistant-bubble {
  align-self: flex-start;
  background-color: var(--assistant-bubble-bg);
  color: black;
  text-align: left;
  border-top-left-radius: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.assistant-bubble strong {
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
}

.assistant-bubble pre {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.assistant-bubble button {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  text-decoration: underline;
  color: #2563eb;
}

.assistant-bubble .explanation {
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.message-bubble .text-xs {
  font-size: 0.75rem;
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  color: #6b7280;
}

#input-area {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

#message-input {
  width: 100%;
  min-height: 54px;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid #ccc;
  resize: none;
  font-size: 1rem;
  line-height: 1.5;
}

#send-btn {
  background-color: #000;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  font-weight: 500;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease-in-out;
}

#send-btn:hover {
  background-color: #333;
}

#secondary-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

#model-selector,
#clear-chat-btn {
  width: 100%;
  height: 54px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  background-color: white;
}

#clear-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

#clear-chat-btn:hover {
  background-color: #f5f5f5;
}

#model-selector {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2.5rem;
  cursor: pointer;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1em;
}

.dot-animation::after {
  content: '...';
  animation: dots 1.2s steps(3, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  100% { content: '...'; }
}

#help-drawer {
  position: fixed;
  top: 4rem;
  right: 1rem;
  width: 16rem;
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  z-index: 1000;
}

.assistant-bubble .hidden {
  display: none;
}

.assistant-bubble .space-y-2 > * + * {
  margin-top: 0.5rem;
}

button:focus {
  outline: none;
}

#chat-inner:empty {
  overflow: hidden;
}

.tooltip {
  display: none !important;
}

@media (min-width: 768px) {
  #secondary-controls {
    grid-template-columns: 2fr 1fr;
  }
}

#visual-mode-btn {
  color: #000;
  font-weight: bold;
  background: #f5f5f5;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
}
/* === Visual Chat Enhancements === */

.chat-box {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.chat-box h3 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-weight: 600;
  padding-left: 0.25rem;
}

.message-bubble {
  max-width: 90%;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: background-color 0.3s ease;
}

.user-bubble {
  background-color: var(--user-bubble-bg);
  color: #ffffff;
  align-self: flex-end;
  border-top-right-radius: 0.25rem;
  text-align: left;
}

.assistant-bubble {
  background-color: var(--assistant-bubble-bg);
  color: #000000;
  align-self: flex-start;
  border-top-left-radius: 0.25rem;
  text-align: left;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.assistant-bubble strong {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  display: block;
}

.assistant-bubble pre {
  background: #f9f9f9;
  border: 1px solid #e5e7eb;
  padding: 0.75rem;
  border-radius: 0.5rem;
  white-space: pre-wrap;
  font-family: var(--font-main);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 0.5rem;
}

.message-bubble .text-xs {
  font-size: 0.75rem;
  color: #888888;
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.message-bubble button:hover {
  text-decoration: underline;
}
/* === Prompt Form Grid Layout === */

#chat-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

#chat-form .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  #chat-form .grid {
    grid-template-columns: 1fr 1fr;
  }
}

#chat-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  resize: vertical;
  font-size: 1rem;
  line-height: 1.5;
  font-family: var(--font-main);
  transition: border-color 0.2s ease;
}

#chat-form textarea:focus {
  border-color: #000;
  outline: none;
  box-shadow: 0 0 0 1px #000;
}
.typing-indicator {
  display: flex;
  gap: 6px;
  padding: 1rem;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  background-color: #999;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
