/* Base layout */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

.top-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.settings-btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
}

.chat {
  flex: 1 1 auto;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.message {
  display: block;
  max-width: 60%;
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.35;
  word-wrap: break-word;
}

.message.bot {
  background: #eef2ff;
  color: #1e3a8a;
}

.message.user {
  background: #dcfce7;
  color: #064e3b;
  margin-left: auto;
}

.chat-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.chat-form textarea {
  flex: 1 1 auto;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  outline: none;
  background: #fff;
  resize: none;
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.35;
}

.chat-form textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.chat-form button[type="submit"] {
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: #4f46e5;
  color: #fff;
  cursor: pointer;
  height: 48px;
  align-self: flex-start;
}

.chat-form button[type="submit"]:hover {
  background: #4338ca;
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none; /* hidden by default */
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay[aria-hidden="false"] {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px 16px;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  padding: 0 16px 16px 16px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.text-field {
  width: 100%;
  padding: 12px 40px 12px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  outline: none;
  box-sizing: border-box;
}

.toggle-password-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  transition: color 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}

.toggle-password-btn:hover {
  color: #374151;
  background-color: #f3f4f6;
}

.toggle-password-btn:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.help-text {
  color: #6b7280;
  margin-top: 6px;
  font-size: 12px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 8px 16px 16px 16px;
}

.primary-btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: #4f46e5;
  color: #fff;
  cursor: pointer;
}

.secondary-btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
}

/* Loading message styles */
.loading-message {
  display: block;
  max-width: 60%;
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.35;
  background: #eef2ff;
  color: #1e3a8a;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.loading-message.show {
  opacity: 1;
  transform: translateY(0);
}

.loading-dots {
  display: inline-block;
  margin-left: 0;
  min-width: 20px;
}


