@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --bg-main: #f8fafc;
  --bg-chat: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --radius-lg: 1rem;
  --radius-md: 0.75rem;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Overlay Prompt */
.overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.overlay-box {
  background: white;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.overlay-box h2 {
  font-weight: 700;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  color: var(--text-main);
}

.overlay-box input {
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: all 0.2s;
  box-sizing: border-box;
}

.overlay-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.overlay-box button {
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  width: 100%;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s;
}

.overlay-box button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.group-options {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.group-option-btn {
  flex: 1;
  background-color: #f1f5f9 !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
}

.group-option-btn:hover {
  background-color: #e2e8f0 !important;
}

.group-form {
  display: none;
  margin-top: 1rem;
}

/* Chat Container */
.chat-container {
  width: 100%;
  max-width: 800px;
  height: 90vh;
  background: var(--bg-chat);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

/* Chat Header */
.chat-header {
  background: white;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

#typingIndicator {
  font-size: 0.875rem;
  color: var(--text-muted);
  height: 1rem;
  margin-top: 0.25rem;
}

/* Messages List */
.chat-messages {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  margin: 0;
  background: #fcfcfc;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-messages li {
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 4px 16px 16px 16px;
  max-width: 80%;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
  position: relative;
  align-self: flex-start;
  transition: transform 0.2s;
}

.chat-messages li.me {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-radius: 16px 4px 16px 16px;
  border: none;
}

.chat-messages li.me strong {
  color: #c7d2fe;
}

.chat-messages li strong {
  display: block;
  font-size: 0.75rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* System messages */
.chat-messages li.system {
  align-self: center;
  background: none;
  border: none;
  box-shadow: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
  margin: 0.5rem 0;
  font-weight: 500;
}

.chat-messages li.system::before,
.chat-messages li.system::after {
  content: "—";
  margin: 0 0.5rem;
  color: var(--border-color);
}

/* Chat Form */
.chat-form {
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
  background: white;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.chat-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
}

.chat-form input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.chat-form button {
  width: 2.75rem;
  height: 2.75rem;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-form button:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.chat-form button svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .chat-container {
    height: 100vh;
    border-radius: 0;
    border: none;
  }
  
  .overlay-box {
    margin: 1rem;
    padding: 1.5rem;
  }
}